fix(e2e): re-focus prompt after terminal opens in slash-terminal test (#17113)
This commit is contained in:
@@ -6,16 +6,24 @@ test("/terminal toggles the terminal panel", async ({ page, gotoSession }) => {
|
|||||||
|
|
||||||
const prompt = page.locator(promptSelector)
|
const prompt = page.locator(promptSelector)
|
||||||
const terminal = page.locator(terminalSelector)
|
const terminal = page.locator(terminalSelector)
|
||||||
|
const slash = page.locator('[data-slash-id="terminal.toggle"]').first()
|
||||||
|
|
||||||
await expect(terminal).not.toBeVisible()
|
await expect(terminal).not.toBeVisible()
|
||||||
|
|
||||||
await prompt.fill("/terminal")
|
await prompt.fill("/terminal")
|
||||||
await expect(page.locator('[data-slash-id="terminal.toggle"]').first()).toBeVisible()
|
await expect(slash).toBeVisible()
|
||||||
await page.keyboard.press("Enter")
|
await page.keyboard.press("Enter")
|
||||||
await expect(terminal).toBeVisible()
|
await expect(terminal).toBeVisible()
|
||||||
|
|
||||||
await prompt.fill("/terminal")
|
// Terminal panel retries focus (immediate, RAF, 120ms, 240ms) after opening,
|
||||||
await expect(page.locator('[data-slash-id="terminal.toggle"]').first()).toBeVisible()
|
// which can steal focus from the prompt and prevent fill() from triggering
|
||||||
|
// the slash popover. Re-attempt click+fill until all retries are exhausted
|
||||||
|
// and the popover appears.
|
||||||
|
await expect.poll(async () => {
|
||||||
|
await prompt.click().catch(() => false)
|
||||||
|
await prompt.fill("/terminal").catch(() => false)
|
||||||
|
return slash.isVisible().catch(() => false)
|
||||||
|
}, { timeout: 10_000 }).toBe(true)
|
||||||
await page.keyboard.press("Enter")
|
await page.keyboard.press("Enter")
|
||||||
await expect(terminal).not.toBeVisible()
|
await expect(terminal).not.toBeVisible()
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user