diff options
| author | Luke Parker <[email protected]> | 2026-03-12 12:03:38 +1000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-12 12:03:38 +1000 |
| commit | 1d9c83b576c51623f81014c94ce68c85734434fa (patch) | |
| tree | e2bc71b2a6696964fbd346be636427c96cf7a982 /packages/app | |
| parent | 2c825c32234753c1a3c4a165092ddaef904c7f62 (diff) | |
| download | opencode-1d9c83b576c51623f81014c94ce68c85734434fa.tar.gz opencode-1d9c83b576c51623f81014c94ce68c85734434fa.zip | |
fix(e2e): re-focus prompt after terminal opens in slash-terminal test (#17113)
Diffstat (limited to 'packages/app')
| -rw-r--r-- | packages/app/e2e/prompt/prompt-slash-terminal.spec.ts | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/packages/app/e2e/prompt/prompt-slash-terminal.spec.ts b/packages/app/e2e/prompt/prompt-slash-terminal.spec.ts index bf9f96b47..793b34ff8 100644 --- a/packages/app/e2e/prompt/prompt-slash-terminal.spec.ts +++ b/packages/app/e2e/prompt/prompt-slash-terminal.spec.ts @@ -6,16 +6,24 @@ test("/terminal toggles the terminal panel", async ({ page, gotoSession }) => { const prompt = page.locator(promptSelector) const terminal = page.locator(terminalSelector) + const slash = page.locator('[data-slash-id="terminal.toggle"]').first() await expect(terminal).not.toBeVisible() 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 expect(terminal).toBeVisible() - await prompt.fill("/terminal") - await expect(page.locator('[data-slash-id="terminal.toggle"]').first()).toBeVisible() + // Terminal panel retries focus (immediate, RAF, 120ms, 240ms) after opening, + // 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 expect(terminal).not.toBeVisible() }) |
