mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-10 12:37:55 +01:00
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 <noreply@anthropic.com>
This commit is contained in:
1 parent
4a34c17d75
commit
d7834a3408
2 files changed
+4
-3
No files matched your search
@@ -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<string, unknown> = { click: first, filter: () => ({ click: forbidden }), getByText: () => ({}) };
|
||||
const control: Record<string, unknown> = { 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/);
|
||||
|
||||
@@ -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() });
|
||||
|
||||
Reference in new issue
Block a user