refactor(ui): replace middle-dot separators with clearer hierarchy (#6087)

* refactor(ui): replace middle-dot separators with clearer hierarchy

* refactor(ui): use layout instead of punctuation separators
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-07 15:19:55 +08:00
1 parent d6ddceed99
commit 7cb396788c
82 files changed
+433 -462

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
import { cleanup, render, screen, within } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { afterEach, expect, it } from "vitest";
import { ActivityStep } from "@/components/thread/activity/ActivityStep";
afterEach(cleanup);
it("keeps truncated activity details available on keyboard focus", async () => {
render(<ActivityStep label="Used Blender" detail="--json project new" />);
const detail = screen.getByText("--json project new");
Object.defineProperties(detail, {
scrollWidth: { value: 240 },
clientWidth: { value: 80 },
});
await userEvent.tab();
expect(screen.getByLabelText("Used Blender, --json project new")).toHaveFocus();
const tooltip = await screen.findByRole("tooltip");
expect(within(tooltip).getByText(/Used Blender/)).toHaveTextContent("--json project new");
});
+23 -23
View File
@@ -160,8 +160,8 @@ describe("AgentActivityCluster", () => {
expect(screen.getByText(`Searched files “${query}”`)).toBeInTheDocument();
expect(screen.getByText(`Reading file ${path}`)).toBeInTheDocument();
expect(screen.getByText("Using Blender · --json --background scene.blend")).toBeInTheDocument();
expect(screen.getByText("Opening example.com · Browserbase")).toBeInTheDocument();
expect(screen.getByLabelText("Using Blender, --json --background scene.blend")).toBeInTheDocument();
expect(screen.getByLabelText("Opening example.com, Browserbase")).toBeInTheDocument();
expect(screen.getByText("Edited")).toBeInTheDocument();
expect(screen.getByTestId("activity-file-reference")).toHaveTextContent(path);
@@ -169,19 +169,19 @@ describe("AgentActivityCluster", () => {
expect(screen.getByText(`文件搜索完成 “${query}”`)).toBeInTheDocument();
expect(screen.getByText(`正在读取文件 ${path}`)).toBeInTheDocument();
expect(screen.getByText("正在使用 Blender · --json --background scene.blend")).toBeInTheDocument();
expect(screen.getByText("正在打开 example.com · Browserbase")).toBeInTheDocument();
expect(screen.getByLabelText("正在使用 Blender, --json --background scene.blend")).toBeInTheDocument();
expect(screen.getByLabelText("正在打开 example.com, Browserbase")).toBeInTheDocument();
expect(screen.getByText("编辑")).toBeInTheDocument();
expect(screen.getByTestId("activity-file-reference")).toHaveTextContent(path);
await act(async () => setAppLanguage("ja"));
expect(screen.getByText(`“${query}” · ファイル検索完了`)).toBeInTheDocument();
expect(screen.getByText(`${path} · ファイルを読み取り中`)).toBeInTheDocument();
expect(screen.getByText("Blender を使用中 · --json --background scene.blend")).toBeInTheDocument();
expect(screen.getByText("example.com · 開いています · Browserbase")).toBeInTheDocument();
expect(screen.getByText(`“${query}” ファイル検索完了`)).toBeInTheDocument();
expect(screen.getByText(`${path} ファイルを読み取り中`)).toBeInTheDocument();
expect(screen.getByLabelText("Blender を使用中, --json --background scene.blend")).toBeInTheDocument();
expect(screen.getByLabelText("example.com 開いています, Browserbase")).toBeInTheDocument();
expect(screen.getByTestId("activity-file-reference").closest('[data-testid="activity-step"]'))
.toHaveTextContent(`${path} · 編集`);
.toHaveTextContent(`${path} 編集`);
});
it("loads deferred trace details only after completed activity is expanded", async () => {
@@ -231,7 +231,7 @@ describe("AgentActivityCluster", () => {
);
expect(
screen.getByText("Connection failed · retrying in 5s · attempt 1/4"),
screen.getByText("Connection failed. Retrying in 5s (attempt 1/4)."),
).toBeInTheDocument();
});
@@ -618,7 +618,7 @@ describe("AgentActivityCluster", () => {
retryStatus={{ state: "waiting", attempt: 1, max_attempts: 4, error_kind: "connection" }}
/>,
);
expect(screen.getByRole("status", { name: "Connection failed · retrying in 0s · attempt 1/4" }))
expect(screen.getByRole("status", { name: "Connection failed. Retrying in 0s (attempt 1/4)." }))
.toBeVisible();
unmount();
render(<AgentActivityCluster messages={messages} isTurnStreaming={false} hasBodyBelow />);
@@ -1117,7 +1117,7 @@ describe("AgentActivityCluster", () => {
/>,
);
expect(screen.getByText("Using Blender · --json --background scene.blend")).toBeInTheDocument();
expect(screen.getByLabelText("Using Blender, --json --background scene.blend")).toBeInTheDocument();
expect(screen.getByTestId("activity-cli-logo-blender")).toBeInTheDocument();
expect(screen.queryByText(/run_cli_app/)).not.toBeInTheDocument();
});
@@ -1165,8 +1165,8 @@ describe("AgentActivityCluster", () => {
/>,
);
const searchRow = screen.getByText("Searched nanobot architecture").closest('[data-testid="activity-step"]');
const cliRow = screen.getByText("Used Blender · --json project new").closest('[data-testid="activity-step"]');
const searchRow = screen.getByLabelText("Searched the web, nanobot architecture").closest('[data-testid="activity-step"]');
const cliRow = screen.getByLabelText("Used Blender, --json project new").closest('[data-testid="activity-step"]');
const fetchRow = screen.getByText("example.com/diagram").closest('[data-testid="activity-step"]');
expect(searchRow).not.toBeNull();
@@ -1211,7 +1211,7 @@ describe("AgentActivityCluster", () => {
/>,
);
expect(screen.getByText("Searched agent frameworks")).toBeInTheDocument();
expect(screen.getByLabelText("Searched the web, agent frameworks")).toBeInTheDocument();
expect(screen.queryByText("2 sources")).not.toBeInTheDocument();
const openAiLink = screen.getByText("OpenAI Agents SDK").closest("a");
@@ -1231,7 +1231,7 @@ describe("AgentActivityCluster", () => {
expect(screen.getByTestId("activity-web-favicon-anthropic.com")).toBeInTheDocument();
expect(screen.queryByText("Internal dashboard")).not.toBeInTheDocument();
expect(screen.queryByText("Build and deploy agentic applications.")).not.toBeInTheDocument();
const searchStep = screen.getByText("Searched agent frameworks").closest(
const searchStep = screen.getByLabelText("Searched the web, agent frameworks").closest(
'[data-testid="activity-step"]',
);
const openAiStep = openAiLink!.closest('[data-testid="activity-step"]');
@@ -1273,7 +1273,7 @@ describe("AgentActivityCluster", () => {
);
fireEvent.click(screen.getByRole("button", { name: /^Worked/ }));
expect(screen.getByText("Searched X · nanobot oauth")).toBeInTheDocument();
expect(screen.getByLabelText("Searched X, nanobot oauth")).toBeInTheDocument();
expect(screen.queryByText(/Completed X search/i)).not.toBeInTheDocument();
expect(screen.getAllByTestId("activity-step")).toHaveLength(1);
});
@@ -1308,7 +1308,7 @@ describe("AgentActivityCluster", () => {
fireEvent.click(screen.getByRole("button", { name: /^Worked/ }));
expect(screen.queryByText(/signed-secret|secret1234|url-secret/)).not.toBeInTheDocument();
expect(screen.getByText("Searched release notes access_token=<redacted>")).toBeInTheDocument();
expect(screen.getByLabelText("Searched the web, release notes access_token=<redacted>")).toBeInTheDocument();
expect(screen.getByText("Release <redacted>")).toBeInTheDocument();
expect(screen.getByText("Release <redacted>").closest("a")).toHaveAttribute(
"href",
@@ -1357,7 +1357,7 @@ describe("AgentActivityCluster", () => {
);
expect(screen.getAllByTestId("activity-step")).toHaveLength(1);
expect(screen.getByText("Could not search LinkedIn · Evomap startup")).toBeInTheDocument();
expect(screen.getByLabelText("Could not search LinkedIn, Evomap startup")).toBeInTheDocument();
expect(screen.queryByText(/site:linkedin/i)).not.toBeInTheDocument();
expect(screen.queryByText("Web research")).not.toBeInTheDocument();
});
@@ -1411,7 +1411,7 @@ describe("AgentActivityCluster", () => {
fireEvent.click(screen.getByRole("button", { name: "Worked" }));
const row = screen.getByText("Could not use GitHub · --json repo view").closest(
const row = screen.getByLabelText("Could not use GitHub, --json repo view").closest(
'[data-testid="activity-step"]',
);
expect(row).toBeInTheDocument();
@@ -1445,7 +1445,7 @@ describe("AgentActivityCluster", () => {
/>,
);
expect(screen.getByText("Opening example.com · Browserbase")).toBeInTheDocument();
expect(screen.getByLabelText("Opening example.com, Browserbase")).toBeInTheDocument();
expect(screen.queryByText("Using")).not.toBeInTheDocument();
expect(screen.queryByText(/browser_navigate/)).not.toBeInTheDocument();
expect(screen.getByTestId("activity-mcp-logo-browserbase")).toBeInTheDocument();
@@ -1606,7 +1606,7 @@ describe("AgentActivityCluster", () => {
);
fireEvent.click(screen.getByRole("button", { name: /^Worked/ }));
const run = screen.getByText(/Reviewed sources.*2 files/).closest('[data-testid="activity-step"]');
const run = screen.getByLabelText(/Reviewed sources.*2 files/).closest('[data-testid="activity-step"]');
expect(run).toBeInTheDocument();
expect(screen.queryByText(firstPath)).not.toBeInTheDocument();
expect(screen.queryByText(secondPath)).not.toBeInTheDocument();
@@ -1708,7 +1708,7 @@ describe("AgentActivityCluster", () => {
fireEvent.click(screen.getByRole("button", { name: "Worked" }));
expect(screen.getByText("Ran command cat << 'EOF' | bash · script, 6 lines")).toBeInTheDocument();
expect(screen.getByLabelText("Ran command cat << 'EOF' | bash, script, 6 lines")).toBeInTheDocument();
expect(screen.queryByText(/SECRET_TOKEN/)).not.toBeInTheDocument();
expect(screen.queryByText(/for id in/)).not.toBeInTheDocument();
expect(screen.queryByText(/^Done$/)).not.toBeInTheDocument();
+9 -9
View File
@@ -698,7 +698,7 @@ describe("App layout", () => {
expect(await screen.findByRole("heading", { name: "Channels" })).toBeVisible();
expect(window.location.hash).toBe("#/channels");
expect(channels).toHaveAttribute("aria-current", "page");
expect(document.title).toBe("Channels · nanobot");
expect(document.title).toBe("Channels");
fireEvent.click(within(sidebar).getByRole("button", { name: "New topic" }));
await waitFor(() => expect(window.location.hash).toBe("#/new"));
fireEvent.keyDown(window, { key: "$", code: "Digit4", ctrlKey: true, shiftKey: true });
@@ -918,7 +918,7 @@ describe("App layout", () => {
expect(within(screen.getByTestId("thread-header")).getByText(
"first private message",
)).toBeInTheDocument();
await waitFor(() => expect(document.title).toBe("first private message · nanobot"));
await waitFor(() => expect(document.title).toBe("first private message"));
expect(screen.queryByRole("button", { name: "Temporary chat" })).not.toBeInTheDocument();
fireEvent.click(within(sidebar).getByRole("button", {
@@ -1390,7 +1390,7 @@ describe("App layout", () => {
"aria-current",
"page",
);
expect(document.title).toBe("Skills · nanobot");
expect(document.title).toBe("Skills");
fireEvent.click(screen.getByRole("button", { name: "Back to chat" }));
expect(await screen.findByText(HERO_GREETING_PATTERN)).toBeInTheDocument();
@@ -1796,7 +1796,7 @@ describe("App layout", () => {
"aria-current",
"page",
);
expect(document.title).toBe("Automations · nanobot");
expect(document.title).toBe("Automations");
});
@@ -2085,7 +2085,7 @@ describe("App layout", () => {
expect(screen.queryByText("近期无问题")).not.toBeInTheDocument();
expect(screen.queryByText("Workspace automations")).not.toBeInTheDocument();
expect(screen.queryByRole("button", { name: "刷新" })).not.toBeInTheDocument();
expect(document.title).toBe("自动任务 · nanobot");
expect(document.title).toBe("自动任务");
});
it("resizes the sidebar, collapses at the drag threshold and restores its saved width", async () => {
@@ -2456,7 +2456,7 @@ describe("App layout", () => {
expect(screen.queryByRole("tooltip")).not.toBeInTheDocument();
await user.click(await within(sheet).findByRole("button", { name: `${title} mobile chat` }));
await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
await waitFor(() => expect(document.title).toBe(`${title} mobile chat · nanobot`));
await waitFor(() => expect(document.title).toBe(`${title} mobile chat`));
expect(screen.getByRole("button", { name: `${title} mobile chat` }))
.toHaveAttribute("aria-current", "page");
}
@@ -2874,7 +2874,7 @@ describe("App layout", () => {
render(<App />);
await waitFor(() => expect(connectSpy).toHaveBeenCalled());
await waitFor(() => expect(document.title).toBe("Active after reload · nanobot"));
await waitFor(() => expect(document.title).toBe("Active after reload"));
const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" });
expect(
within(sidebar).getByRole("button", { name: /^Active after reload$/ }),
@@ -3048,7 +3048,7 @@ describe("App layout", () => {
"duration-200",
"motion-reduce:animate-none",
);
expect(document.title).toBe("Apps · nanobot");
expect(document.title).toBe("Apps");
fireEvent.click(within(sidebar).getByRole("button", { name: "Skills" }));
@@ -3068,7 +3068,7 @@ describe("App layout", () => {
"data-active-id",
"utility:skills",
);
expect(document.title).toBe("Skills · nanobot");
expect(document.title).toBe("Skills");
});
it("returns from settings to the blank start page when no session was active", async () => {
+3 -3
View File
@@ -119,7 +119,7 @@ describe("sidebar action focus", () => {
const move = await screen.findByRole("menuitem", { name: "Move to", exact: true });
act(() => move.focus());
await user.keyboard("{ArrowRight}");
await screen.findByRole("menuitem", { name: "Group · 2/4" });
await screen.findByRole("menuitem", { name: "Group 2/4" });
await user.keyboard("{Escape}");
await waitFor(() => expect(screen.queryByRole("menu")).not.toBeInTheDocument());
await waitFor(() => expect(trigger).toHaveFocus());
@@ -134,10 +134,10 @@ describe("sidebar action focus", () => {
const move = await screen.findByRole("menuitem", { name: "Move to", exact: true });
act(() => move.focus());
await user.keyboard("{ArrowRight}");
await screen.findByRole("menuitem", { name: "Group · 2/4" });
await screen.findByRole("menuitem", { name: "Group 2/4" });
await user.keyboard("{ArrowLeft}");
await waitFor(() => expect(move).toHaveFocus());
expect(screen.queryByRole("menuitem", { name: "Group · 2/4" })).not.toBeInTheDocument();
expect(screen.queryByRole("menuitem", { name: "Group 2/4" })).not.toBeInTheDocument();
await user.click(screen.getByRole("menuitem", { name: "Rename", exact: true }));
const input = await screen.findByPlaceholderText("Topic name");
await waitFor(() => expect(screen.queryByRole("menu")).not.toBeInTheDocument());
+3 -3
View File
@@ -372,12 +372,12 @@ describe("ChatList", () => {
expect(screen.queryByRole("menuitem", { name: "Target pane" }))
.not.toBeInTheDocument();
const fullTarget = await screen.findByRole("menuitem", {
name: "Existing group · 4/4",
name: "Existing group 4/4",
});
expect(fullTarget).toHaveAttribute("aria-disabled", "true");
fireEvent.click(fullTarget);
expect(onAttachPane).not.toHaveBeenCalled();
fireEvent.click(await screen.findByRole("menuitem", { name: "Fine group · 1/4" }));
fireEvent.click(await screen.findByRole("menuitem", { name: "Fine group 1/4" }));
expect(onAttachPane).toHaveBeenCalledWith("websocket:solo", "tab:fine");
});
@@ -635,7 +635,7 @@ describe("ChatList", () => {
}), { button: 0, ctrlKey: false });
const moveTo = await screen.findByRole("menuitem", { name: "Move to" });
fireEvent.pointerMove(moveTo, { pointerType: "mouse" });
fireEvent.click(await screen.findByRole("menuitem", { name: "Target tab · 2/4" }));
fireEvent.click(await screen.findByRole("menuitem", { name: "Target tab 2/4" }));
expect(onAttachPane).toHaveBeenCalledWith("websocket:child", "websocket:target");
fireEvent.pointerDown(screen.getByRole("button", {
+9 -7
View File
@@ -35,11 +35,13 @@ describe("host switcher", () => {
it("announces the host only once when its display name is the hostname", async () => {
const value = { ...picker(1), name: "team-host", hostname: "team-host" };
render(<HostNavigationContext.Provider value={value}><HostSwitcher /></HostNavigationContext.Provider>);
expect(screen.getByRole("status").textContent).toBe("team-host · Connected");
expect(screen.getByRole("status").textContent).toBe("team-host, Connected");
const trigger = screen.getByRole("button", { name: "Switch host" });
expect(trigger).not.toHaveAttribute("title");
await userEvent.hover(trigger);
expect(await screen.findByRole("tooltip")).toHaveTextContent("team-host · Connected");
const tooltip = await screen.findByRole("tooltip");
expect(within(tooltip).getByText("team-host")).toBeVisible();
expect(within(tooltip).getByText("Connected")).toBeVisible();
});
it("does not borrow the local socket's Connected status while restoring a remote", () => {
@@ -61,7 +63,7 @@ describe("host switcher", () => {
expect(within(trigger).getByText("Local", { exact: true })).toBeVisible();
await userEvent.hover(trigger);
expect(await screen.findByRole("tooltip")).toHaveTextContent("Connecting to Server 1");
expect(within(trigger).getByRole("status")).toHaveTextContent("Local · My-Mac · Connected · Connecting to Server 1");
expect(within(trigger).getByRole("status")).toHaveTextContent("Local, My-Mac, Connected. Connecting to Server 1");
await userEvent.click(trigger);
expect(screen.getByRole("menuitem", { name: "Local nanobot My-Mac" })).toHaveAttribute("aria-current", "true");
expect(screen.getByRole("menuitem", { name: "Server 1 ubuntu@host-1.test" })).not.toHaveAttribute("aria-current");
@@ -71,7 +73,7 @@ describe("host switcher", () => {
const value = { ...picker(2), error: "Destination SSH is unreachable" };
render(<HostNavigationContext.Provider value={value}><HostSwitcher /></HostNavigationContext.Provider>);
const trigger = screen.getByRole("button", { name: "Switch host" });
expect(within(trigger).getByRole("status")).toHaveTextContent("Local · My-Mac · Connected");
expect(within(trigger).getByRole("status")).toHaveTextContent("Local, My-Mac, Connected");
await userEvent.hover(trigger);
expect(await screen.findByRole("tooltip")).toHaveTextContent(value.error);
expect(trigger).not.toHaveTextContent("Offline");
@@ -82,7 +84,7 @@ describe("host switcher", () => {
it("keeps a truly disconnected host offline independently of switch errors", () => {
const value = { ...picker(2), offline: true, name: "Team server", hostname: "team-host" };
render(<HostNavigationContext.Provider value={value}><HostSwitcher /></HostNavigationContext.Provider>);
expect(screen.getByRole("status")).toHaveTextContent("Team server · team-host · Server connection lost");
expect(screen.getByRole("status")).toHaveTextContent("Team server, team-host, Server connection lost");
});
it("keeps remote sidebar identity and connection status separate from pending or failed switches", async () => {
@@ -90,9 +92,9 @@ describe("host switcher", () => {
const view = render(<HostNavigationContext.Provider value={value}><HostSwitcher /></HostNavigationContext.Provider>);
const trigger = screen.getByRole("button", { name: "Switch host" });
expect(within(trigger).getByText("Team server", { exact: true })).toBeVisible();
expect(within(trigger).getByRole("status")).toHaveTextContent("Team server · team-host · Connected · Connecting to Another server");
expect(within(trigger).getByRole("status")).toHaveTextContent("Team server, team-host, Connected. Connecting to Another server");
view.rerender(<HostNavigationContext.Provider value={{ ...value, pendingName: undefined, error: "Destination SSH is unreachable" }}><HostSwitcher /></HostNavigationContext.Provider>);
expect(within(trigger).getByRole("status")).toHaveTextContent("Team server · team-host · Connected");
expect(within(trigger).getByRole("status")).toHaveTextContent("Team server, team-host, Connected");
await userEvent.hover(trigger);
expect(await screen.findByRole("tooltip")).toHaveTextContent("Destination SSH is unreachable");
});
+5 -5
View File
@@ -60,8 +60,8 @@ describe("localized agent activity contracts", () => {
expect(generic.detail).toBe("src/app.tsx");
expect(command.detail).toBe("bun run test");
expect(browser.target).toBe("Enter");
expect(search).toContain("release notes");
expect([generic.label, command.label, browser.action, search].join(" "))
expect(search.detail).toBe("release notes");
expect([generic.label, command.label, browser.action, search.label].join(" "))
.not.toMatch(/message\.agentActivity|{{/);
}
for (const count of [0, 1, 2]) {
@@ -105,13 +105,13 @@ describe("localized agent activity contracts", () => {
const original = JSON.stringify(messages);
render(<AgentActivityCluster messages={messages} isTurnStreaming={false} hasBodyBelow expanded />);
expect(screen.getByText("Ran command bun run test")).toBeInTheDocument();
expect(screen.getByText("Could not search release notes")).toBeInTheDocument();
expect(screen.getByLabelText("Could not search the web, release notes")).toBeInTheDocument();
await act(async () => setAppLanguage("zh-CN"));
expect(screen.getByText("已运行命令 bun run test")).toBeInTheDocument();
expect(screen.getByText("无法搜索 release notes")).toBeInTheDocument();
expect(screen.getByLabelText("无法搜索 网页, release notes")).toBeInTheDocument();
await act(async () => setAppLanguage("en"));
expect(screen.getByText("Could not search release notes")).toBeInTheDocument();
expect(screen.getByLabelText("Could not search the web, release notes")).toBeInTheDocument();
expect(JSON.stringify(messages)).toBe(original);
});
-1
View File
@@ -76,7 +76,6 @@ const LOCALIZED_SETTINGS_COPY_KEYS = [
"settings.sections.capabilities",
"settings.sections.apps",
"settings.apps.description",
"settings.apps.caption",
"settings.apps.restartRequired",
"settings.mcp.connectingAccount",
"settings.mcp.continueSignIn",
+1 -1
View File
@@ -690,7 +690,7 @@ describe("MessageBubble", () => {
const timestamp = document.querySelector("[data-message-timestamp]")!;
const automation = document.querySelector("[data-automation-trigger]")!;
expect(timestamp).toHaveTextContent(formatMessageEndTime(completedAt));
expect(automation).toHaveTextContent("Triggered automatically · drink water");
expect(automation).toHaveTextContent("Triggered automatically drink water");
expect(timestamp.compareDocumentPosition(automation) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
});
+2 -2
View File
@@ -157,7 +157,7 @@ describe("ModelPresetBadge selected preset tooltip", () => {
expect(container.querySelector("[title]")).toBeNull();
await user.hover(trigger);
const tooltip = await screen.findByRole("tooltip");
expect(tooltip).toHaveTextContent("zhipu · glm-5");
expect(tooltip).toHaveTextContent("zhipu glm-5");
expect(tooltip).not.toHaveTextContent("codex");
await user.click(trigger);
expect(await screen.findByRole("listbox")).toBeInTheDocument();
@@ -179,7 +179,7 @@ describe("ModelPresetBadge selected preset tooltip", () => {
expect(trigger).toHaveAttribute("tabindex", "0");
fireEvent.focus(trigger);
expect(await screen.findByRole("tooltip")).toHaveTextContent(
"zhipu · glm-5",
"zhipu glm-5",
);
fireEvent.keyDown(trigger, { key: "Escape" });
await waitFor(() => expect(screen.queryByRole("tooltip")).not.toBeInTheDocument());
+15 -15
View File
@@ -103,8 +103,8 @@ describe("remote instance UX", () => {
compatibility: { status, client_version: "1.0.0", host_version: "2.0.0" } }] });
mocks.request.mockRejectedValue(new Error(code));
view();
await screen.findByText(i18n.t(`remote.compatibility.${status}`));
expect(screen.queryByText("Server connection lost", { exact: true })).not.toBeInTheDocument();
await screen.findByRole("region", { name: i18n.t(`remote.compatibility.${status}`) });
expect(screen.queryByRole("region", { name: "Server connection lost" })).not.toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Version & compatibility" }));
expect(within(await screen.findByRole("dialog")).getByRole("status")).toHaveTextContent(i18n.t(`remote.compatibility.${status}`));
expect(screen.queryByRole("textbox", { name: "SSH address" })).not.toBeInTheDocument();
@@ -182,7 +182,7 @@ describe("remote instance UX", () => {
expect(screen.getByTitle("nanobot on 腾讯云 nanobot")).toBe(frame);
expect(frame).toHaveAttribute("src", connection.url);
expect(readSelectedRemote()).toMatchObject({ id: profile.id, name: "腾讯云 nanobot" });
expect(document.title).toBe("腾讯云 nanobot · nanobot");
expect(document.title).toBe("腾讯云 nanobot");
expect(source.postMessage).toHaveBeenLastCalledWith(expect.objectContaining({ type: "init", name: "腾讯云 nanobot" }), "http://127.0.0.1:23456");
expect(mocks.request.mock.calls.map(([action]) => action)).toEqual(["remote.connect", "remote.rename"]);
fireEvent.click(screen.getByRole("button", { name: "腾讯云 nanobot ubuntu@example.test" }));
@@ -672,7 +672,7 @@ describe("remote instance UX", () => {
: action === "remote.fingerprint" ? { fingerprint: "SHA256:verified-test", challenge: "nonce" } : {});
await addAndInspect();
await screen.findByText("SHA256:verified-test");
fireEvent.click(screen.getByRole("button", { name: "Fingerprint matches · Connect" }));
fireEvent.click(screen.getByRole("button", { name: "Connect to verified host" }));
expect(await screen.findByText("No nanobot configuration found")).toBeVisible();
expect(mocks.inspect).toHaveBeenCalledTimes(2);
expect(mocks.request.mock.calls.some(([action]) => action === "remote.connect")).toBe(false);
@@ -801,7 +801,7 @@ describe("remote instance UX", () => {
expect(frame).toHaveAttribute("src", connection.url);
expect(frame).toHaveAttribute("sandbox", expect.not.stringContaining("allow-top-navigation"));
expect(document.querySelector('[data-host-view="local"]')).toHaveAttribute("inert");
expect(within(screen.getByRole("button", { name: "Switch host" })).getByRole("status")).toHaveTextContent("Team server · team-host");
expect(within(screen.getByRole("button", { name: "Switch host" })).getByRole("status")).toHaveTextContent("Team server, team-host");
expect(mocks.request).toHaveBeenCalledWith("remote.connect", { id: profile.id }, 65_000);
expect(window.sessionStorage.getItem("nanobot.remote-instance")).not.toContain("secret");
expect(readRecentRemotes()).toEqual([profile.id]);
@@ -900,7 +900,7 @@ describe("remote instance UX", () => {
rememberSelectedRemote(connection);
mocks.request.mockRejectedValue(new Error("ssh_unreachable"));
view();
await screen.findByText("Server connection lost");
await screen.findByRole("region", { name: "Server connection lost" });
expect(screen.queryByText("Local conversations")).not.toBeVisible();
expect(screen.getByRole("button", { name: "Reconnect" })).toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Back to local nanobot" }));
@@ -927,7 +927,7 @@ describe("remote instance UX", () => {
rememberSelectedRemote(connection);
mocks.request.mockRejectedValue(new Error("ssh_unreachable"));
view();
await screen.findByText("Server connection lost");
await screen.findByRole("region", { name: "Server connection lost" });
fireEvent.click(screen.getByRole("button", { name: "Back to local nanobot" }));
await screen.findByText("Local conversations");
mocks.request.mockResolvedValue(connection);
@@ -1304,7 +1304,7 @@ describe("remote instance UX", () => {
await screen.findByText("SHA256:example");
expect(mocks.request.mock.calls.some(([action]) => action === "remote.trust")).toBe(false);
mocks.request.mockImplementation(async (action: string) => action === "remote.connect" ? connection : {});
fireEvent.click(screen.getByRole("button", { name: "Fingerprint matches · Connect" }));
fireEvent.click(screen.getByRole("button", { name: "Connect to verified host" }));
await readyRemote();
expect(mocks.request).toHaveBeenCalledWith("remote.trust", { id: profile.id, challenge: "one-use" }, 65_000);
});
@@ -1317,14 +1317,14 @@ describe("remote instance UX", () => {
const frame = await readyRemote();
fireEvent.load(frame);
await act(async () => { tick?.(); });
expect(screen.queryByText("Server connection lost")).not.toBeInTheDocument();
expect(screen.queryByRole("region", { name: "Server connection lost" })).not.toBeInTheDocument();
await act(async () => { tick?.(); });
await screen.findByText("Server connection lost");
await screen.findByRole("region", { name: "Server connection lost" });
expect(screen.getByTitle("nanobot on Team server")).toBeInTheDocument();
expect(frame.parentElement).toHaveAttribute("inert");
expect(document.querySelector('[data-host-view="local"]')).toHaveAttribute("inert");
fireEvent.click(screen.getByRole("button", { name: "Reconnect" }));
await waitFor(() => expect(screen.queryByText("Server connection lost")).not.toBeInTheDocument());
await waitFor(() => expect(screen.queryByRole("region", { name: "Server connection lost" })).not.toBeInTheDocument());
expect(screen.queryByText("Opening your server…")).not.toBeInTheDocument();
expect(screen.getByTitle("nanobot on Team server")).toBe(frame);
expect(frame.parentElement).not.toHaveAttribute("inert");
@@ -1340,11 +1340,11 @@ describe("remote instance UX", () => {
expect(mocks.read).toHaveBeenCalledTimes(1);
await act(async () => { document.dispatchEvent(new Event("visibilitychange")); });
expect(mocks.read).toHaveBeenCalledTimes(2);
await screen.findByText("Server connection lost");
await screen.findByRole("region", { name: "Server connection lost" });
mocks.read.mockResolvedValue({ available: true, profiles: [{ ...profile, connected: true }] });
await act(async () => { window.dispatchEvent(new Event("pageshow")); });
expect(mocks.read).toHaveBeenCalledTimes(3);
expect(screen.queryByText("Server connection lost")).not.toBeInTheDocument();
expect(screen.queryByRole("region", { name: "Server connection lost" })).not.toBeInTheDocument();
expect(screen.getByTitle("nanobot on Team server")).toBe(frame);
expect(readSelectedRemote()?.id).toBe(profile.id);
expect(mocks.request.mock.calls.filter(([action]) => action === "remote.connect")).toHaveLength(1);
@@ -1392,11 +1392,11 @@ describe("remote instance UX", () => {
rememberSelectedRemote(connection);
mocks.request.mockRejectedValue(new Error("ssh_unreachable"));
view();
await screen.findByText("Server connection lost");
await screen.findByRole("region", { name: "Server connection lost" });
fireEvent.pointerDown(screen.getByRole("button", { name: "Switch host" }), { button: 0, ctrlKey: false });
fireEvent.click(await screen.findByRole("button", { name: "Close" }));
fireEvent.keyDown(screen.getByRole("menu"), { key: "Escape" });
expect(screen.getByText("Server connection lost")).toBeVisible();
expect(screen.getByRole("region", { name: "Server connection lost" })).toBeVisible();
expect(screen.getByRole("button", { name: "Reconnect" })).toBeVisible();
expect(screen.queryByText("Opening your server…")).not.toBeInTheDocument();
});
+2 -1
View File
@@ -136,7 +136,8 @@ describe("Settings system domains", () => {
expect(await screen.findByText("Computer Use")).toBeInTheDocument();
expect(screen.getByText("Plugins")).toBeInTheDocument();
expect(screen.getByText(/Control the desktop.*screen-recording, accessibility/)).toBeInTheDocument();
expect(screen.getByText(/Control the desktop/)).toBeInTheDocument();
expect(screen.getByText("screen-recording, accessibility")).toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Enable" }));
await waitFor(() => expect(requestMutationMock).toHaveBeenCalledWith(
@@ -46,7 +46,7 @@ describe("ThinkingReasoningShell", () => {
</ThinkingReasoningShell>
);
const view = render(shell(true));
const button = screen.getByRole("button", { name: "Working · Collapse activity details" });
const button = screen.getByRole("button", { name: "Working, Collapse activity details" });
const content = screen.getByTestId("agent-activity-content");
const headerClass = button.className;
const contentClass = content.className;
@@ -55,7 +55,7 @@ describe("ThinkingReasoningShell", () => {
view.rerender(shell(false));
expect(screen.getByRole("button", { name: "Worked · Collapse activity details" })).toBe(button);
expect(screen.getByRole("button", { name: "Worked, Collapse activity details" })).toBe(button);
expect(button.className).toBe(headerClass);
expect(screen.getByTestId("agent-activity-content")).toBe(content);
expect(content.className).toBe(contentClass);
+1 -1
View File
@@ -1102,7 +1102,7 @@ describe("ThreadMessages", () => {
const answer = screen.getByText("automated answer").closest<HTMLElement>("[data-thread-display-unit]")!;
const { menu } = openMessageBlockMenu(answer);
const metadata = menu.querySelector<HTMLElement>("[data-message-block-metadata]")!;
expect(metadata).toHaveTextContent("Triggered automatically · Review schedule");
expect(metadata).toHaveTextContent("Triggered automatically Review schedule");
expect(metadata.querySelector("time[datetime]")).toBeInTheDocument();
expect(metadata.querySelector("button, svg, [tabindex]")).toBeNull();
expect(metadata).toBe(menu.querySelector("[data-message-block-menu-actions]")?.lastElementChild);
+8 -8
View File
@@ -1172,7 +1172,7 @@ describe("ThreadShell", () => {
);
fireEvent.focus(await screen.findByLabelText("fast"));
expect(await screen.findByRole("tooltip")).toHaveTextContent("fast · gpt-5.5 · OpenAI Codex");
expect(await screen.findByRole("tooltip")).toHaveTextContent("fast gpt-5.5 OpenAI Codex");
fireEvent.blur(screen.getByLabelText("fast"));
expect(screen.queryByLabelText("Default")).not.toBeInTheDocument();
});
@@ -1199,7 +1199,7 @@ describe("ThreadShell", () => {
);
fireEvent.focus(await screen.findByLabelText("fast"));
expect(await screen.findByRole("tooltip")).toHaveTextContent("fast · gpt-5.5 · OpenAI Codex");
expect(await screen.findByRole("tooltip")).toHaveTextContent("fast gpt-5.5 OpenAI Codex");
fireEvent.blur(screen.getByLabelText("fast"));
expect(screen.queryByRole("button", { name: "Choose your AI" })).not.toBeInTheDocument();
});
@@ -1237,7 +1237,7 @@ describe("ThreadShell", () => {
"preset-order",
"/model fast",
);
expect(await screen.findByText("fast")).toBeInTheDocument();
expect(await screen.findByLabelText("fast", { selector: "button" })).toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "fast" }));
fireEvent.click(await screen.findByRole("option", { name: /^extra\b/i }));
expect(client.sendSystemCommand).toHaveBeenLastCalledWith(
@@ -1247,7 +1247,7 @@ describe("ThreadShell", () => {
expect(await screen.findByText("extra")).toBeInTheDocument();
rerender(view("fast"));
expect(await screen.findByText("fast")).toBeInTheDocument();
expect(await screen.findByLabelText("fast", { selector: "button" })).toBeInTheDocument();
});
it("uses the backend-resolved provider for an auto session preset", async () => {
@@ -1283,7 +1283,7 @@ describe("ThreadShell", () => {
);
fireEvent.focus(await screen.findByLabelText("fast"));
expect(await screen.findByRole("tooltip")).toHaveTextContent("fast · gpt-4 · Company Proxy");
expect(await screen.findByRole("tooltip")).toHaveTextContent("fast gpt-4 Company Proxy");
fireEvent.blur(screen.getByLabelText("fast"));
expect(screen.queryByRole("button", { name: "Choose your AI" })).not.toBeInTheDocument();
});
@@ -1335,7 +1335,7 @@ describe("ThreadShell", () => {
expect(configuredBadge).not.toHaveAttribute("data-fallback");
fireEvent.focus(screen.getByLabelText("Default"));
expect(await screen.findByRole("tooltip")).toHaveTextContent(
"Default · gpt-5.5 · OpenAI Codex",
"Default gpt-5.5 OpenAI Codex",
);
fireEvent.blur(screen.getByLabelText("Default"));
@@ -1832,7 +1832,7 @@ describe("ThreadShell", () => {
fireEvent.click(await screen.findByRole("button", { name: "Default" }));
fireEvent.click(await screen.findByRole("option", { name: /^fast\b/i }));
expect(await screen.findByText("fast")).toBeInTheDocument();
expect(await within(screen.getByTestId("thread-welcome-layout")).findByText("fast")).toBeInTheDocument();
expect(client.sendSystemCommand).not.toHaveBeenCalled();
fireEvent.change(screen.getByLabelText("Message input"), {
@@ -1850,7 +1850,7 @@ describe("ThreadShell", () => {
rerender(view(session("chat-new", "fast")));
});
fireEvent.focus(await screen.findByLabelText("fast"));
expect(await screen.findByRole("tooltip")).toHaveTextContent("fast · gpt-5.5 · OpenAI Codex");
expect(await screen.findByRole("tooltip")).toHaveTextContent("fast gpt-5.5 OpenAI Codex");
fireEvent.blur(screen.getByLabelText("fast"));
expect(screen.queryByText("Default")).not.toBeInTheDocument();
expect(client.sendMessage).not.toHaveBeenCalled();
+1 -1
View File
@@ -109,7 +109,7 @@ describe("Token usage card", () => {
expect(column).toHaveAccessibleName(/2026-09-09: 2,200 tokens/);
expect(column).toHaveAccessibleName(/model-5: 600/);
expect(column).toHaveAccessibleName(/Other \/ unattributed: 200/);
const legend = screen.getByLabelText("model-5: Total tokens: 600 · 27.3%, Cache hit rate: 80%");
const legend = screen.getByLabelText("model-5: Total tokens: 600 (27.3%), Cache hit rate: 80%");
expect(legend).toHaveAttribute("tabindex", "0");
});
});
+19 -10
View File
@@ -14,7 +14,7 @@ describe("trace activity semantics", () => {
});
it.each([
['web_search({"query":"nanobot latest release"})', "done", "Searched nanobot latest release", ""],
['web_search({"query":"nanobot latest release"})', "done", "Searched the web", "nanobot latest release"],
['web_fetch({"url":"https://example.com/docs?token=private"})', "done", "Read", "example.com/docs"],
['read_file({"path":"/Users/alice/project/README.md"})', "done", "Read", "~/project/README.md"],
['exec({"command":"date +%Y-%m-%d"})', "done", "Checked current time", ""],
@@ -30,19 +30,27 @@ describe("trace activity semantics", () => {
});
it.each([
["running", "Searching status test"],
["done", "Searched status test"],
["error", "Could not search status test"],
["running", "Searching the web"],
["done", "Searched the web"],
["error", "Could not search the web"],
] as const)("uses status-aware search copy for %s", (status, label) => {
expect(describeTrace('web_search({"query":"status test"})', status).label).toBe(label);
expect(describeTrace('web_search({"query":"status test"})', status)).toMatchObject({ label, detail: "status test" });
});
it.each([
["running", "Searching X · status test"],
["done", "Searched X · status test"],
["error", "Could not search X · status test"],
["running", "Searching X"],
["done", "Searched X"],
["error", "Could not search X"],
] as const)("identifies hosted X search activity for %s", (status, label) => {
expect(describeTrace('x_search({"query":"status test"})', status).label).toBe(label);
expect(describeTrace('x_search({"query":"status test"})', status)).toMatchObject({ label, detail: "status test" });
});
it("preserves query lines when extracting a search scope", () => {
const query = "site:linkedin.com/company Evomap startup\nsite:linkedin.com/company Evomap funding";
expect(describeTrace(`web_search(${JSON.stringify({ query })})`)).toMatchObject({
label: "Searched LinkedIn",
detail: "Evomap startup\nEvomap funding",
});
});
it("never exposes URL credentials, query secrets, or private-network links", () => {
@@ -63,7 +71,8 @@ describe("trace activity semantics", () => {
);
expect(result).toMatchObject({
label: "Ran command",
detail: "npm test · script, 3 lines",
detail: "npm test",
aside: "script, 3 lines",
});
expect(result.detail).not.toContain("second-secret-line");
});