Skip to content

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

fix(e2e): await search toggle before keyboard focus

Steven Enamakel7b205f87e46a
diff --git a/app/test/e2e/specs/chip-tabs-keyboard.spec.ts b/app/test/e2e/specs/chip-tabs-keyboard.spec.ts
index f4204c0fb4..46ae60bb3a 100644
--- a/app/test/e2e/specs/chip-tabs-keyboard.spec.ts
+++ b/app/test/e2e/specs/chip-tabs-keyboard.spec.ts
@@ -39,10 +39,11 @@ describe('ChipTabs keyboard traversal', () => {
// Start from the preceding control and enter with a real Tab event. This
// exercises entry focus in Radix's roving group before arrow-key checks.
- await browser.execute(() => {
- (document.querySelector('[data-testid="search-enabled-toggle"]') as HTMLElement).focus();
- });
- await expect(await waitForTestId('search-enabled-toggle')).toBeFocused();
+ // Search settings load asynchronously from the core. Wait for the switch
+ // before focusing it so this setup does not race the panel's loading state.
+ const enabledToggle = await waitForTestId('search-enabled-toggle', 15_000);
+ await browser.execute((element: HTMLElement) => element.focus(), enabledToggle);
+ await expect(enabledToggle).toBeFocused();
await browser.keys('Tab');
await expectSelectedAndFocused('routing');