From 83d3179d34063a0d3f46dbab1775ae8a9014c133 Mon Sep 17 00:00:00 2001 From: imccyu <276526105+imccyu@users.noreply.github.com> Date: Mon, 27 Jul 2026 10:14:37 +0800 Subject: [PATCH] disambiguate the snapshot's workspace-group lookup Latest master seeds a blank session also titled "fixture"; anchor the session-tree lookup on the expandable group row instead of the first text match. --- apps/web/tests/todo-display.snapshot.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/web/tests/todo-display.snapshot.ts b/apps/web/tests/todo-display.snapshot.ts index 8d0127cc54..3116bf4242 100644 --- a/apps/web/tests/todo-display.snapshot.ts +++ b/apps/web/tests/todo-display.snapshot.ts @@ -104,10 +104,13 @@ function visibleText(element: Element): string { /** Open the fixture history session (the alpha log carrying the todo_write turn) and wait for its tail. */ async function openFixtureSession(): Promise { const tree = await screen.findByRole('tree', { name: 'Sessions' }, { timeout: 10_000 }) - // Anchor on the Workspace title, not the session-count meta: the count - // shifts when a blank session joins the group. - const group = (await within(tree).findByText('fixture')).closest('[role="treeitem"]') - if (group === null) throw new Error('fixture Workspace group missing') + // Anchor on the expandable Workspace group row: the title and the blank + // session row can both read "fixture", and the session-count meta shifts + // when a blank session joins the group. + const group = (await within(tree).findAllByText('fixture')) + .map(el => el.closest('[role="treeitem"]')) + .find(el => el?.getAttribute('aria-expanded') !== null) + if (group === null || group === undefined) throw new Error('fixture Workspace group missing') if (group.getAttribute('aria-expanded') === 'false') { fireEvent.click(within(group).getByText('fixture')) await waitFor(() => {