From 9186ec245b0127e314c2ffcc1ff790fda79804f2 Mon Sep 17 00:00:00 2001 From: Zaid Marji Date: Tue, 26 May 2026 03:46:59 +0300 Subject: [PATCH] playwright: fix stale org-nav selectors against bundled web vault MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The product-switch links in the side nav ("Password Manager", "Admin Console", "Members") are icon-only on the current bundled web vault — the link element carries the accessible name but no visible text content. `locator('a').filter({ hasText: '…' })` therefore matches nothing, and every spec that calls into `setups/orgs.ts` (org create, member invite, policy edit, …) times out before doing anything. Switch to `getByRole('link', { name: '…' })` for the three navs. "Admin Console" appears twice once an org exists (in both `bit-nav-logo` and `navigation-product-switcher`); `.first()` picks the visible one. The "Members" entry inside an org also moved from a `
` to a ``, so the `locator('div').filter(...).nth(2)` selector is replaced with the same role-based selector. The org-switcher row has a hover tooltip that intercepts the click on the bundled vault, so the click is forced past the overlay. Verified empirically: with these changes, `organization.spec.ts` (1/1) and `sso_organization.spec.ts` (4/5; the remaining failure is an unrelated server-side master-password-policy enforcement issue) run green where they previously failed before any helper step. --- playwright/tests/setups/orgs.ts | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/playwright/tests/setups/orgs.ts b/playwright/tests/setups/orgs.ts index 04d81b45..48d40361 100644 --- a/playwright/tests/setups/orgs.ts +++ b/playwright/tests/setups/orgs.ts @@ -4,7 +4,11 @@ import * as utils from '../../global-utils'; export async function create(test, page: Page, name: string) { await test.step('Create Org', async () => { - await page.locator('a').filter({ hasText: 'Password Manager' }).first().click(); + // The product-switch nav links are icon-only (accessible name set on + // the link, no text content), so `filter({hasText})` no longer matches + // on the current bundled web vault — use the accessible-name role + // selector instead. + await page.getByRole('link', { name: 'Password Manager' }).click(); await expect(page.getByTitle('All vaults', { exact: true })).toBeVisible(); await page.getByRole('link', { name: 'New organisation' }).click(); await page.getByLabel('Organisation name (required)').fill(name); @@ -16,9 +20,11 @@ export async function create(test, page: Page, name: string) { export async function policies(test, page: Page, name: string) { await test.step(`Navigate to ${name} policies`, async () => { - await page.locator('a').filter({ hasText: 'Admin Console' }).first().click(); + await page.getByRole('link', { name: 'Admin Console' }).first().click(); await page.locator('org-switcher').getByLabel(/Toggle collapse/).click(); - await page.locator('org-switcher').getByRole('link', { name: `${name}` }).first().click(); + // The org row in the switcher has a hover tooltip that intercepts the + // click on the current bundled web vault; force-click past it. + await page.locator('org-switcher').getByRole('link', { name: `${name}` }).first().click({ force: true }); await expect(page.getByRole('heading', { name: `${name} collections` })).toBeVisible(); await page.getByRole('button', { name: 'Toggle collapse Settings' }).click(); await page.getByRole('link', { name: 'Policies' }).click(); @@ -28,11 +34,13 @@ export async function policies(test, page: Page, name: string) { export async function members(test, page: Page, name: string) { await test.step(`Navigate to ${name} members`, async () => { - await page.locator('a').filter({ hasText: 'Admin Console' }).first().click(); + await page.getByRole('link', { name: 'Admin Console' }).first().click(); await page.locator('org-switcher').getByLabel(/Toggle collapse/).click(); - await page.locator('org-switcher').getByRole('link', { name: `${name}` }).first().click(); + // The org row in the switcher has a hover tooltip that intercepts the + // click on the current bundled web vault; force-click past it. + await page.locator('org-switcher').getByRole('link', { name: `${name}` }).first().click({ force: true }); await expect(page.getByRole('heading', { name: `${name} collections` })).toBeVisible(); - await page.locator('div').filter({ hasText: 'Members' }).nth(2).click(); + await page.getByRole('link', { name: 'Members' }).click(); await expect(page.getByRole('heading', { name: 'Members' })).toBeVisible(); await expect(page.getByRole('cell', { name: 'All' })).toBeVisible(); });