diff options
| author | Adam <[email protected]> | 2026-02-11 09:11:41 -0600 |
|---|---|---|
| committer | opencode <[email protected]> | 2026-02-11 15:12:28 +0000 |
| commit | fc88dde63f1c4a7f547bbe0634c68c5ce9fc787c (patch) | |
| tree | 4e6aaad7afb646348c3b676a6269455dac63a7d8 /packages/app/e2e/settings/settings-keybinds.spec.ts | |
| parent | 4619e9d183d036f2f7234046927ec2f72d426168 (diff) | |
| download | opencode-fc88dde63f1c4a7f547bbe0634c68c5ce9fc787c.tar.gz opencode-fc88dde63f1c4a7f547bbe0634c68c5ce9fc787c.zip | |
test(app): more e2e tests (#13162)
Diffstat (limited to 'packages/app/e2e/settings/settings-keybinds.spec.ts')
| -rw-r--r-- | packages/app/e2e/settings/settings-keybinds.spec.ts | 74 |
1 files changed, 73 insertions, 1 deletions
diff --git a/packages/app/e2e/settings/settings-keybinds.spec.ts b/packages/app/e2e/settings/settings-keybinds.spec.ts index a8e7f3352..5e98bd158 100644 --- a/packages/app/e2e/settings/settings-keybinds.spec.ts +++ b/packages/app/e2e/settings/settings-keybinds.spec.ts @@ -9,7 +9,7 @@ test("changing sidebar toggle keybind works", async ({ page, gotoSession }) => { const dialog = await openSettings(page) await dialog.getByRole("tab", { name: "Shortcuts" }).click() - const keybindButton = dialog.locator(keybindButtonSelector("sidebar.toggle")) + const keybindButton = dialog.locator(keybindButtonSelector("sidebar.toggle")).first() await expect(keybindButton).toBeVisible() const initialKeybind = await keybindButton.textContent() @@ -51,6 +51,40 @@ test("changing sidebar toggle keybind works", async ({ page, gotoSession }) => { expect(finalClosed).toBe(initiallyClosed) }) +test("sidebar toggle keybind guards against shortcut conflicts", async ({ page, gotoSession }) => { + await gotoSession() + + const dialog = await openSettings(page) + await dialog.getByRole("tab", { name: "Shortcuts" }).click() + + const keybindButton = dialog.locator(keybindButtonSelector("sidebar.toggle")) + await expect(keybindButton).toBeVisible() + + const initialKeybind = await keybindButton.textContent() + expect(initialKeybind).toContain("B") + + await keybindButton.click() + await expect(keybindButton).toHaveText(/press/i) + + await page.keyboard.press(`${modKey}+Shift+KeyP`) + await page.waitForTimeout(100) + + const toast = page.locator('[data-component="toast"]').last() + await expect(toast).toBeVisible() + await expect(toast).toContainText(/already/i) + + await keybindButton.click() + await expect(keybindButton).toContainText("B") + + const stored = await page.evaluate(() => { + const raw = localStorage.getItem("settings.v3") + return raw ? JSON.parse(raw) : null + }) + expect(stored?.keybinds?.["sidebar.toggle"]).toBeUndefined() + + await closeDialog(page, dialog) +}) + test("resetting all keybinds to defaults works", async ({ page, gotoSession }) => { await page.addInitScript(() => { localStorage.setItem("settings.v3", JSON.stringify({ keybinds: { "sidebar.toggle": "mod+shift+x" } })) @@ -277,6 +311,44 @@ test("changing terminal toggle keybind works", async ({ page, gotoSession }) => await expect(terminal).not.toBeVisible() }) +test("terminal toggle keybind persists after reload", async ({ page, gotoSession }) => { + await gotoSession() + + const dialog = await openSettings(page) + await dialog.getByRole("tab", { name: "Shortcuts" }).click() + + const keybindButton = dialog.locator(keybindButtonSelector("terminal.toggle")) + await expect(keybindButton).toBeVisible() + + await keybindButton.click() + await expect(keybindButton).toHaveText(/press/i) + + await page.keyboard.press(`${modKey}+Shift+KeyY`) + await page.waitForTimeout(100) + + await expect(keybindButton).toContainText("Y") + await closeDialog(page, dialog) + + await page.reload() + + await expect + .poll(async () => { + return await page.evaluate(() => { + const raw = localStorage.getItem("settings.v3") + if (!raw) return + const parsed = JSON.parse(raw) + return parsed?.keybinds?.["terminal.toggle"] + }) + }) + .toBe("mod+shift+y") + + const reloaded = await openSettings(page) + await reloaded.getByRole("tab", { name: "Shortcuts" }).click() + const reloadedKeybind = reloaded.locator(keybindButtonSelector("terminal.toggle")).first() + await expect(reloadedKeybind).toContainText("Y") + await closeDialog(page, reloaded) +}) + test("changing command palette keybind works", async ({ page, gotoSession }) => { await gotoSession() |
