test(evals): pick Birch from the organization switcher by its visible name

Each organization row's accessible name starts with its avatar initial ("B Birch BIR"), so /^Birch/ never matched. Match the row inside the open menu by its exact organization name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DottaandClaude Opus 5.5 committed 2026-11-08 23:28:51 -06:00
1 parent 92d5d7771f
commit 30900a980a
2 files changed
+7 -2

No files matched your search

@@ -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<string, unknown> = { 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!;
@@ -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;