diff --git a/e2e/v137-sharing-managed-profiles-a11y.spec.ts b/e2e/v137-sharing-managed-profiles-a11y.spec.ts index 0037bc9d5..603948b2e 100644 --- a/e2e/v137-sharing-managed-profiles-a11y.spec.ts +++ b/e2e/v137-sharing-managed-profiles-a11y.spec.ts @@ -15,9 +15,9 @@ async function openProfileRecord(page: Page) { await page.goto("/"); await page.getByRole("button", { name: "User menu" }).first().click(); await page.locator('[data-slot="account-switcher-trigger"]').click(); - const entry = page - .locator('[data-slot="account-switcher-entry"]') - .filter({ hasText: "e2e-scope-profile" }); + const entry = page.locator( + '[data-slot="account-switcher-entry"][data-account-username="e2e-scope-profile"]', + ); await expect(entry).toHaveCount(1); await entry.click(); await expect(page).toHaveURL(/\/profile$/); @@ -60,11 +60,10 @@ test.describe("shared record accessibility states", () => { test("the shared profile read error state has no WCAG violations", async ({ page, }) => { - await openProfileRecord(page); await page.route("**/api/profile/summary", (route) => route.fulfill({ status: 500, body: "{}" }), ); - await page.reload(); + await openProfileRecord(page); await expect(page.locator('[data-slot="query-error-card"]')).toBeVisible(); await scan(page); await leaveRecord(page); diff --git a/e2e/v137-sharing-managed-profiles.spec.ts b/e2e/v137-sharing-managed-profiles.spec.ts index 95eb1a1b7..3664558a3 100644 --- a/e2e/v137-sharing-managed-profiles.spec.ts +++ b/e2e/v137-sharing-managed-profiles.spec.ts @@ -30,9 +30,9 @@ async function openRecord(page: Page, username: string) { await page.goto("/"); await openSwitcher(page); - const entry = page - .locator('[data-slot="account-switcher-entry"]') - .filter({ hasText: username }); + const entry = page.locator( + `[data-slot="account-switcher-entry"][data-account-username="${username}"]`, + ); await expect(entry).toHaveCount(1); const accountId = await entry.getAttribute("data-account-id"); if (accountId === null) { @@ -59,9 +59,9 @@ test.describe.serial("scoped sharing browser journeys", () => { await page.goto("/"); await openSwitcher(page); - const entry = page - .locator('[data-slot="account-switcher-entry"]') - .filter({ hasText: record.username }); + const entry = page.locator( + `[data-slot="account-switcher-entry"][data-account-username="${record.username}"]`, + ); await expect(entry).toHaveCount(1); const read = page.waitForResponse( diff --git a/src/components/layout/account-switcher-menu.tsx b/src/components/layout/account-switcher-menu.tsx index 66e39320c..8fac8a3b6 100644 --- a/src/components/layout/account-switcher-menu.tsx +++ b/src/components/layout/account-switcher-menu.tsx @@ -89,6 +89,7 @@ export function AccountSwitcherMenuItems() { key={account.accountId} data-slot="account-switcher-entry" data-account-id={account.accountId} + data-account-username={account.username} data-access-level={presentation.access} data-record-kind={presentation.recordKind} className="cursor-pointer"