test(ui): await the agent shortcut popup focus end state

The shortcut first focuses a hidden combobox input, opens its popup after 10 ms, and moves focus to its visible search. Sampling the intermediate input focus races normal popup opening.

Assert that the visible agent search opens and receives focus, then that Escape closes it, for both the conversation composer and the first-session composer. The selector and sidebar shortcut implementation is unchanged from dev; no product delay or weaker focus assertion is introduced.
This commit is contained in:
Pascal André 2026-11-14 21:18:04 +01:00
parent ab787cc3e6
commit ee92f7e385
No known key found for this signature in database

View file

@ -910,8 +910,12 @@ test("Clear and selector shortcuts drive the shown composer, in a conversation a
assert.equal(await send.isEnabled(), false)
assert.equal(await composer.evaluate(element => element === document.activeElement), true)
await page.keyboard.press("Control+Shift+A")
await page.waitForFunction(() => document.activeElement?.hasAttribute("data-agent-selector"))
await page.keyboard.press("Escape")
// The hidden combobox input owns focus only until the popup opens.
const agentSearch = page.locator('.selector-search-input[placeholder="Select agent..."]:visible')
await agentSearch.waitFor()
await page.waitForFunction(() => document.activeElement?.matches('.selector-search-input[placeholder="Select agent..."]'))
await page.keyboard.press("Escape")
await agentSearch.waitFor({ state: "hidden" })
await page.evaluate(() => (window as any).fixture.selectSession(null))
}
} finally { await page.close() }