Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(playwright): make activity group expansion deterministic

Steven Enamakela3ea170f02e6
diff --git a/app/test/playwright/specs/aui-tool-result-elements.spec.ts b/app/test/playwright/specs/aui-tool-result-elements.spec.ts
index 7542436d27..192337e891 100644
--- a/app/test/playwright/specs/aui-tool-result-elements.spec.ts
+++ b/app/test/playwright/specs/aui-tool-result-elements.spec.ts
@@ -107,7 +107,15 @@ async function openActivityGroup(page: Page): Promise<Locator> {
timeout: 30_000,
});
const trigger = group.locator('[data-slot="tool-group-trigger"]');
- if ((await trigger.getAttribute('aria-expanded')) === 'false') await trigger.click();
+ // sendTurn returns when the RPC is accepted, while this group is often still
+ // open because the turn is live. Toggle it closed and open again so the
+ // interaction records an explicit user choice; it then remains open when the
+ // response settles and ActivityGroup's live default changes to closed.
+ if ((await trigger.getAttribute('aria-expanded')) === 'true') {
+ await trigger.click();
+ await expect(trigger).toHaveAttribute('aria-expanded', 'false', { timeout: 10_000 });
+ }
+ await trigger.click();
await expect(trigger).toHaveAttribute('aria-expanded', 'true', { timeout: 10_000 });
return group;
}