diff --git a/tests/runner-e2e/chat-catalog-domains/identity-company-budget.test.ts b/tests/runner-e2e/chat-catalog-domains/identity-company-budget.test.ts index 63295e290fc..0dc52b3fae3 100644 --- a/tests/runner-e2e/chat-catalog-domains/identity-company-budget.test.ts +++ b/tests/runner-e2e/chat-catalog-domains/identity-company-budget.test.ts @@ -48,7 +48,8 @@ describe("two company acts share the original observation clock", () => { vi.useFakeTimers(); vi.setSystemTime(260_000); const ctx = context(0); const first = vi.fn(async () => { vi.setSystemTime(271_000); return { status: "active" }; }); const forbidden = vi.fn(() => { throw new Error("must not start another followup"); }); - const control = { click: first, filter: () => ({ click: forbidden }) }; + const control: Record = { click: first, filter: () => ({ click: forbidden }), getByText: () => ({}) }; + control.getByRole = () => control; ctx.input = { page: { url: () => "https://fixture.test/RUN/chats/ceo", getByRole: () => control }, fixtures: { company: { id: "company" } }, api: { get: first, post: forbidden } } as never; const act = companyLifecycleIdentityCases.find(row => row.scenarioId === id)!.act!; diff --git a/tests/runner-e2e/chat-catalog-domains/identity-company-lifecycle.ts b/tests/runner-e2e/chat-catalog-domains/identity-company-lifecycle.ts index 5f734b7cbd4..14bef9836f1 100644 --- a/tests/runner-e2e/chat-catalog-domains/identity-company-lifecycle.ts +++ b/tests/runner-e2e/chat-catalog-domains/identity-company-lifecycle.ts @@ -61,7 +61,11 @@ export const companyLifecycleIdentityCases: readonly ChatCatalogCase[] = [ remaining(); const source = ctx.input.page.url(); await ctx.input.page.getByRole("button", { name: /^Open .+ (?:organization|workspace|company) switcher$/i }).click({ timeout: remaining() }); - await ctx.input.page.getByRole("menuitem").filter({ hasText: /^Birch/ }).click({ timeout: remaining() }); + // Each organization row's accessible name starts with its avatar initial ("B Birch BIR"), + // so match the row by its exact visible organization name inside the open menu. + const organizations = ctx.input.page.getByRole("menu"); + await organizations.getByRole("menuitem").filter({ has: organizations.getByText("Birch", { exact: true }) }) + .click({ timeout: remaining() }); const prefix = String(state.foreignPrefix); await expect(ctx.input.page).toHaveURL(new RegExp(`/${prefix}/`), { timeout: remaining() }); state.switchedCompanyId = entity(state, "otherCompany").id;