From d7834a34089a676fc93b86e67affdaccbe95b9b9 Mon Sep 17 00:00:00 2001 From: Dotta Date: Sun, 8 Nov 2026 22:38:41 -0600 Subject: [PATCH] test(evals): resolve the Birch row filter from the page root A filter({ has }) locator is evaluated inside each candidate row, so a menu-scoped inner locator never matched. Start the inner text locator from the page. Co-Authored-By: Claude Opus 5.5 --- .../chat-catalog-domains/identity-company-budget.test.ts | 4 ++-- .../chat-catalog-domains/identity-company-lifecycle.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) 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 0dc52b3fae3..c4979b69368 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,9 +48,9 @@ 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: Record = { click: first, filter: () => ({ click: forbidden }), getByText: () => ({}) }; + const control: Record = { click: first, filter: () => ({ click: forbidden }) }; control.getByRole = () => control; - ctx.input = { page: { url: () => "https://fixture.test/RUN/chats/ceo", getByRole: () => control }, + ctx.input = { page: { url: () => "https://fixture.test/RUN/chats/ceo", getByRole: () => control, getByText: () => ({}) }, fixtures: { company: { id: "company" } }, api: { get: first, post: forbidden } } as never; const act = companyLifecycleIdentityCases.find(row => row.scenarioId === id)!.act!; await expect(act(ctx, {})).rejects.toThrow(/exhausted/); 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 14bef9836f1..32f727c69a9 100644 --- a/tests/runner-e2e/chat-catalog-domains/identity-company-lifecycle.ts +++ b/tests/runner-e2e/chat-catalog-domains/identity-company-lifecycle.ts @@ -63,8 +63,9 @@ export const companyLifecycleIdentityCases: readonly ChatCatalogCase[] = [ await ctx.input.page.getByRole("button", { name: /^Open .+ (?:organization|workspace|company) switcher$/i }).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. + // A `has` locator is resolved inside each menu item, so it starts from the page, not the menu. const organizations = ctx.input.page.getByRole("menu"); - await organizations.getByRole("menuitem").filter({ has: organizations.getByText("Birch", { exact: true }) }) + await organizations.getByRole("menuitem").filter({ has: ctx.input.page.getByText("Birch", { exact: true }) }) .click({ timeout: remaining() }); const prefix = String(state.foreignPrefix); await expect(ctx.input.page).toHaveURL(new RegExp(`/${prefix}/`), { timeout: remaining() });