diff options
| author | Dax Raad <[email protected]> | 2026-04-14 23:10:07 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2026-04-14 23:10:25 -0400 |
| commit | 627159acac04409d7697a6739e2c572c2a010943 (patch) | |
| tree | 5f87465ea69f41aff0cd96ae5411fe438da480b3 /packages/app/e2e/terminal | |
| parent | f44aa02e2677b2b89a1a9f517c0ff8990383deaa (diff) | |
| download | opencode-627159acac04409d7697a6739e2c572c2a010943.tar.gz opencode-627159acac04409d7697a6739e2c572c2a010943.zip | |
delete all e2e tests (#22501)
Cherry-picked from ea463e604cdd2a3e83e1c286e39b789455f0d413
Diffstat (limited to 'packages/app/e2e/terminal')
| -rw-r--r-- | packages/app/e2e/terminal/terminal-init.spec.ts | 28 | ||||
| -rw-r--r-- | packages/app/e2e/terminal/terminal-reconnect.spec.ts | 45 | ||||
| -rw-r--r-- | packages/app/e2e/terminal/terminal-tabs.spec.ts | 165 | ||||
| -rw-r--r-- | packages/app/e2e/terminal/terminal.spec.ts | 18 |
4 files changed, 0 insertions, 256 deletions
diff --git a/packages/app/e2e/terminal/terminal-init.spec.ts b/packages/app/e2e/terminal/terminal-init.spec.ts deleted file mode 100644 index 689d0436a..000000000 --- a/packages/app/e2e/terminal/terminal-init.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { test, expect } from "../fixtures" -import { waitTerminalFocusIdle, waitTerminalReady } from "../actions" -import { promptSelector, terminalSelector } from "../selectors" -import { terminalToggleKey } from "../utils" - -test("smoke terminal mounts and can create a second tab", async ({ page, gotoSession }) => { - await gotoSession() - - const terminals = page.locator(terminalSelector) - const tabs = page.locator('#terminal-panel [data-slot="tabs-trigger"]') - const opened = await terminals.first().isVisible() - - if (!opened) { - await page.keyboard.press(terminalToggleKey) - } - - await waitTerminalFocusIdle(page, { term: terminals.first() }) - await expect(terminals).toHaveCount(1) - - // Ghostty captures a lot of keybinds when focused; move focus back - // to the app shell before triggering `terminal.new`. - await page.locator(promptSelector).click() - await page.keyboard.press("Control+Alt+T") - - await expect(tabs).toHaveCount(2) - await expect(terminals).toHaveCount(1) - await waitTerminalReady(page, { term: terminals.first() }) -}) diff --git a/packages/app/e2e/terminal/terminal-reconnect.spec.ts b/packages/app/e2e/terminal/terminal-reconnect.spec.ts deleted file mode 100644 index 1a11a047a..000000000 --- a/packages/app/e2e/terminal/terminal-reconnect.spec.ts +++ /dev/null @@ -1,45 +0,0 @@ -import type { Page } from "@playwright/test" -import { disconnectTerminal, runTerminal, terminalConnects, waitTerminalReady } from "../actions" -import { test, expect } from "../fixtures" -import { terminalSelector } from "../selectors" -import { terminalToggleKey } from "../utils" - -async function open(page: Page) { - const term = page.locator(terminalSelector).first() - const visible = await term.isVisible().catch(() => false) - if (!visible) await page.keyboard.press(terminalToggleKey) - await waitTerminalReady(page, { term }) - return term -} - -test("terminal reconnects without replacing the pty", async ({ page, project }) => { - await project.open() - const name = `OPENCODE_E2E_RECONNECT_${Date.now()}` - const token = `E2E_RECONNECT_${Date.now()}` - - await project.gotoSession() - - const term = await open(page) - const id = await term.getAttribute("data-pty-id") - if (!id) throw new Error("Active terminal missing data-pty-id") - - const prev = await terminalConnects(page, { term }) - - await runTerminal(page, { - term, - cmd: `export ${name}=${token}; echo ${token}`, - token, - }) - - await disconnectTerminal(page, { term }) - - await expect.poll(() => terminalConnects(page, { term }), { timeout: 15_000 }).toBeGreaterThan(prev) - await expect.poll(() => term.getAttribute("data-pty-id"), { timeout: 5_000 }).toBe(id) - - await runTerminal(page, { - term, - cmd: `echo $${name}`, - token, - timeout: 15_000, - }) -}) diff --git a/packages/app/e2e/terminal/terminal-tabs.spec.ts b/packages/app/e2e/terminal/terminal-tabs.spec.ts deleted file mode 100644 index 5cb5bbf20..000000000 --- a/packages/app/e2e/terminal/terminal-tabs.spec.ts +++ /dev/null @@ -1,165 +0,0 @@ -import type { Page } from "@playwright/test" -import { runTerminal, waitTerminalReady } from "../actions" -import { test, expect } from "../fixtures" -import { dropdownMenuContentSelector, terminalSelector } from "../selectors" -import { terminalToggleKey, workspacePersistKey } from "../utils" - -type State = { - active?: string - all: Array<{ - id: string - title: string - titleNumber: number - buffer?: string - }> -} - -async function open(page: Page) { - const terminal = page.locator(terminalSelector) - const visible = await terminal.isVisible().catch(() => false) - if (!visible) await page.keyboard.press(terminalToggleKey) - await waitTerminalReady(page, { term: terminal }) -} - -async function store(page: Page, key: string) { - return page.evaluate((key) => { - const raw = localStorage.getItem(key) - if (raw) return JSON.parse(raw) as State - - for (let i = 0; i < localStorage.length; i++) { - const next = localStorage.key(i) - if (!next?.endsWith(":workspace:terminal")) continue - const value = localStorage.getItem(next) - if (!value) continue - return JSON.parse(value) as State - } - }, key) -} - -test("inactive terminal tab buffers persist across tab switches", async ({ page, project }) => { - await project.open() - const key = workspacePersistKey(project.directory, "terminal") - const one = `E2E_TERM_ONE_${Date.now()}` - const two = `E2E_TERM_TWO_${Date.now()}` - const tabs = page.locator('#terminal-panel [data-slot="tabs-trigger"]') - const first = tabs.filter({ hasText: /Terminal 1/ }).first() - const second = tabs.filter({ hasText: /Terminal 2/ }).first() - - await project.gotoSession() - await open(page) - - await runTerminal(page, { cmd: `echo ${one}`, token: one }) - - await page.getByRole("button", { name: /new terminal/i }).click() - await expect(tabs).toHaveCount(2) - - await runTerminal(page, { cmd: `echo ${two}`, token: two }) - - await first.click() - await expect(first).toHaveAttribute("aria-selected", "true") - - await expect - .poll( - async () => { - const state = await store(page, key) - const first = state?.all.find((item) => item.titleNumber === 1)?.buffer ?? "" - const second = state?.all.find((item) => item.titleNumber === 2)?.buffer ?? "" - return { - first: first.includes(one), - second: second.includes(two), - } - }, - { timeout: 5_000 }, - ) - .toEqual({ first: false, second: true }) - - await second.click() - await expect(second).toHaveAttribute("aria-selected", "true") - await expect - .poll( - async () => { - const state = await store(page, key) - const first = state?.all.find((item) => item.titleNumber === 1)?.buffer ?? "" - const second = state?.all.find((item) => item.titleNumber === 2)?.buffer ?? "" - return { - first: first.includes(one), - second: second.includes(two), - } - }, - { timeout: 5_000 }, - ) - .toEqual({ first: true, second: false }) -}) - -test("closing the active terminal tab falls back to the previous tab", async ({ page, project }) => { - await project.open() - const key = workspacePersistKey(project.directory, "terminal") - const tabs = page.locator('#terminal-panel [data-slot="tabs-trigger"]') - - await project.gotoSession() - await open(page) - - await page.getByRole("button", { name: /new terminal/i }).click() - await expect(tabs).toHaveCount(2) - - const second = tabs.filter({ hasText: /Terminal 2/ }).first() - await second.click() - await expect(second).toHaveAttribute("aria-selected", "true") - - await second.hover() - await page - .getByRole("button", { name: /close terminal/i }) - .nth(1) - .click({ force: true }) - - const first = tabs.filter({ hasText: /Terminal 1/ }).first() - await expect(tabs).toHaveCount(1) - await expect(first).toHaveAttribute("aria-selected", "true") - await expect - .poll( - async () => { - const state = await store(page, key) - return { - count: state?.all.length ?? 0, - first: state?.all.some((item) => item.titleNumber === 1) ?? false, - } - }, - { timeout: 15_000 }, - ) - .toEqual({ count: 1, first: true }) -}) - -test("terminal tab can be renamed from the context menu", async ({ page, project }) => { - await project.open() - const key = workspacePersistKey(project.directory, "terminal") - const rename = `E2E term ${Date.now()}` - const tab = page.locator('#terminal-panel [data-slot="tabs-trigger"]').first() - - await project.gotoSession() - await open(page) - - await expect(tab).toContainText(/Terminal 1/) - await tab.click({ button: "right" }) - - const menu = page.locator(dropdownMenuContentSelector).first() - await expect(menu).toBeVisible() - await menu.getByRole("menuitem", { name: /^Rename$/i }).click() - await expect(menu).toHaveCount(0) - - const input = page.locator('#terminal-panel input[type="text"]').first() - await expect(input).toBeVisible() - await input.fill(rename) - await input.press("Enter") - - await expect(input).toHaveCount(0) - await expect(tab).toContainText(rename) - await expect - .poll( - async () => { - const state = await store(page, key) - return state?.all[0]?.title - }, - { timeout: 5_000 }, - ) - .toBe(rename) -}) diff --git a/packages/app/e2e/terminal/terminal.spec.ts b/packages/app/e2e/terminal/terminal.spec.ts deleted file mode 100644 index 768f7c182..000000000 --- a/packages/app/e2e/terminal/terminal.spec.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { test, expect } from "../fixtures" -import { waitTerminalReady } from "../actions" -import { terminalSelector } from "../selectors" -import { terminalToggleKey } from "../utils" - -test("terminal panel can be toggled", async ({ page, gotoSession }) => { - await gotoSession() - - const terminal = page.locator(terminalSelector) - const initiallyOpen = await terminal.isVisible() - if (initiallyOpen) { - await page.keyboard.press(terminalToggleKey) - await expect(terminal).toHaveCount(0) - } - - await page.keyboard.press(terminalToggleKey) - await waitTerminalReady(page, { term: terminal }) -}) |
