Skip to content

Commit fe1e63c

Browse files
fix: scope mobile header E2E selector to header row (#1042) (#1045)
The locator `main.getByRole('button', { name: /database/i })` matched 500+ sidebar page buttons (e.g. "Untitled Database just now") in addition to the header action button, causing a strict mode violation. Scope the button locators to the header row by navigating to the h1's parent container, which contains only the workspace title and the two action buttons. Co-authored-by: Ona <no-reply@ona.com>
1 parent a89eb99 commit fe1e63c

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

e2e/workspace-home-mobile-header.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ test.describe("Workspace home — mobile header layout", () => {
1717
const heading = main.locator("h1").first();
1818
await expect(heading).toBeVisible({ timeout: 15_000 });
1919

20-
// Both action buttons should be visible (mobile labels: "Database" and "Page")
21-
const dbButton = main.getByRole("button", { name: /database/i });
22-
const pageButton = main.getByRole("button", { name: /page/i });
20+
// Scope to the header row (the container that holds the h1) to avoid
21+
// matching sidebar page buttons like "Untitled Database just now".
22+
const headerRow = heading.locator("..");
23+
const dbButton = headerRow.getByRole("button", { name: /database/i });
24+
const pageButton = headerRow.getByRole("button", { name: /page/i });
2325
await expect(dbButton).toBeVisible({ timeout: 5_000 });
2426
await expect(pageButton).toBeVisible({ timeout: 5_000 });
2527

0 commit comments

Comments
 (0)