Skip to content

Commit ce6d2f8

Browse files
committed
test(webui): find the workspace tabs by the buttons they now are
The workspace tab strip is a group of toggle buttons (aria-pressed), not a tablist, because each row carries a close button that a tablist may not own. The browser and terminal specs still asked for role="tab", so they could not find the pages they open.
1 parent b7e8e93 commit ce6d2f8

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎packages/webui/test/browser/browser-workspace.spec.mjs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,11 @@ test("the strip shows the page the runtime published, and the panel follows it",
262262

263263
// Two pages, two rows in the strip. The rows are the workspace's own tabs,
264264
// so they are found by the page's title -- which is what a person reads.
265-
await expect(page.getByRole("tab", { name: "Example Domain" })).toBeVisible();
266-
await expect(page.getByRole("tab", { name: "Another Page" })).toBeVisible();
265+
await expect(page.getByTestId("workspace-tab-strip").getByRole("button", { name: "Example Domain", exact: true })).toBeVisible();
266+
await expect(page.getByTestId("workspace-tab-strip").getByRole("button", { name: "Another Page", exact: true })).toBeVisible();
267267

268268
// Choosing one brings its page to the front, and the address bar names it.
269-
await page.getByRole("tab", { name: "Another Page" }).click();
269+
await page.getByTestId("workspace-tab-strip").getByRole("button", { name: "Another Page", exact: true }).click();
270270
await expect(page.getByTestId("browser-toolbar-url")).toHaveValue("https://another.test/");
271271
await expect(page.getByTestId("browser-panel-frame")).toBeVisible();
272272
});
@@ -305,7 +305,7 @@ test("a gesture names the page in front, not the page the Agent is on", async ({
305305
});
306306
await openApp(page);
307307
await openPanel(page);
308-
await page.getByRole("tab", { name: "Person page" }).click();
308+
await page.getByTestId("workspace-tab-strip").getByRole("button", { name: "Person page", exact: true }).click();
309309
await expect(page.getByTestId("browser-toolbar-url")).toHaveValue("https://person.test/");
310310

311311
await page.getByTestId("browser-panel-frame").click();

‎packages/webui/test/browser/terminal-cross-page.spec.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const openTerminalTab = async (page) => {
2929
.getByTestId("workspace-panel-controls")
3030
.getByRole("button", { name: "浏览器" })
3131
.click();
32-
const existing = page.getByTestId("workspace-panel").getByRole("tab", { name: "终端" });
32+
const existing = page.getByTestId("workspace-panel").getByRole("button", { name: "终端", exact: true });
3333
if (await existing.count()) {
3434
await existing.click();
3535
return;

0 commit comments

Comments
 (0)