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/prompt | |
| 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/prompt')
| -rw-r--r-- | packages/app/e2e/prompt/context.spec.ts | 95 | ||||
| -rw-r--r-- | packages/app/e2e/prompt/mock.ts | 15 | ||||
| -rw-r--r-- | packages/app/e2e/prompt/prompt-async.spec.ts | 54 | ||||
| -rw-r--r-- | packages/app/e2e/prompt/prompt-drop-file-uri.spec.ts | 22 | ||||
| -rw-r--r-- | packages/app/e2e/prompt/prompt-drop-file.spec.ts | 30 | ||||
| -rw-r--r-- | packages/app/e2e/prompt/prompt-footer-focus.spec.ts | 88 | ||||
| -rw-r--r-- | packages/app/e2e/prompt/prompt-history.spec.ts | 146 | ||||
| -rw-r--r-- | packages/app/e2e/prompt/prompt-mention.spec.ts | 26 | ||||
| -rw-r--r-- | packages/app/e2e/prompt/prompt-multiline.spec.ts | 24 | ||||
| -rw-r--r-- | packages/app/e2e/prompt/prompt-shell.spec.ts | 74 | ||||
| -rw-r--r-- | packages/app/e2e/prompt/prompt-slash-open.spec.ts | 22 | ||||
| -rw-r--r-- | packages/app/e2e/prompt/prompt-slash-share.spec.ts | 66 | ||||
| -rw-r--r-- | packages/app/e2e/prompt/prompt-slash-terminal.spec.ts | 18 | ||||
| -rw-r--r-- | packages/app/e2e/prompt/prompt.spec.ts | 28 |
14 files changed, 0 insertions, 708 deletions
diff --git a/packages/app/e2e/prompt/context.spec.ts b/packages/app/e2e/prompt/context.spec.ts deleted file mode 100644 index 366191fd7..000000000 --- a/packages/app/e2e/prompt/context.spec.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { test, expect } from "../fixtures" -import type { Page } from "@playwright/test" -import { promptSelector } from "../selectors" -import { withSession } from "../actions" - -function contextButton(page: Page) { - return page - .locator('[data-component="button"]') - .filter({ has: page.locator('[data-component="progress-circle"]').first() }) - .first() -} - -async function seedContextSession(input: { sessionID: string; sdk: Parameters<typeof withSession>[0] }) { - await input.sdk.session.promptAsync({ - sessionID: input.sessionID, - noReply: true, - parts: [ - { - type: "text", - text: "seed context", - }, - ], - }) - - await expect - .poll(async () => { - const messages = await input.sdk.session - .messages({ sessionID: input.sessionID, limit: 1 }) - .then((r) => r.data ?? []) - return messages.length - }) - .toBeGreaterThan(0) -} - -test("context panel can be opened from the prompt", async ({ page, sdk, gotoSession }) => { - const title = `e2e smoke context ${Date.now()}` - - await withSession(sdk, title, async (session) => { - await seedContextSession({ sessionID: session.id, sdk }) - - await gotoSession(session.id) - - const trigger = contextButton(page) - await expect(trigger).toBeVisible() - await trigger.click() - - const tabs = page.locator('[data-component="tabs"][data-variant="normal"]') - await expect(tabs.getByRole("tab", { name: "Context" })).toBeVisible() - }) -}) - -test("context panel can be closed from the context tab close action", async ({ page, sdk, gotoSession }) => { - await withSession(sdk, `e2e context toggle ${Date.now()}`, async (session) => { - await seedContextSession({ sessionID: session.id, sdk }) - await gotoSession(session.id) - - await page.locator(promptSelector).click() - - const trigger = contextButton(page) - await expect(trigger).toBeVisible() - await trigger.click() - - const tabs = page.locator('[data-component="tabs"][data-variant="normal"]') - const context = tabs.getByRole("tab", { name: "Context" }) - await expect(context).toBeVisible() - - await page.getByRole("button", { name: "Close tab" }).first().click() - await expect(context).toHaveCount(0) - }) -}) - -test("context panel can open file picker from context actions", async ({ page, sdk, gotoSession }) => { - await withSession(sdk, `e2e context tabs ${Date.now()}`, async (session) => { - await seedContextSession({ sessionID: session.id, sdk }) - await gotoSession(session.id) - - await page.locator(promptSelector).click() - - const trigger = contextButton(page) - await expect(trigger).toBeVisible() - await trigger.click() - - await expect(page.getByRole("tab", { name: "Context" })).toBeVisible() - await page.getByRole("button", { name: "Open file" }).first().click() - - const dialog = page - .getByRole("dialog") - .filter({ has: page.getByPlaceholder(/search files/i) }) - .first() - await expect(dialog).toBeVisible() - - await page.keyboard.press("Escape") - await expect(dialog).toHaveCount(0) - }) -}) diff --git a/packages/app/e2e/prompt/mock.ts b/packages/app/e2e/prompt/mock.ts deleted file mode 100644 index c7eb54b52..000000000 --- a/packages/app/e2e/prompt/mock.ts +++ /dev/null @@ -1,15 +0,0 @@ -type Hit = { body: Record<string, unknown> } - -export function bodyText(hit: Hit) { - return JSON.stringify(hit.body) -} - -/** - * Match requests whose body contains the exact serialized tool input. - * The seed prompts embed JSON.stringify(input) in the prompt text, which - * gets escaped again inside the JSON body — so we double-escape to match. - */ -export function inputMatch(input: unknown) { - const escaped = JSON.stringify(JSON.stringify(input)).slice(1, -1) - return (hit: Hit) => bodyText(hit).includes(escaped) -} diff --git a/packages/app/e2e/prompt/prompt-async.spec.ts b/packages/app/e2e/prompt/prompt-async.spec.ts deleted file mode 100644 index 403369947..000000000 --- a/packages/app/e2e/prompt/prompt-async.spec.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { test, expect } from "../fixtures" -import { promptSelector } from "../selectors" -import { assistantText, withSession } from "../actions" - -const text = (value: string | null) => (value ?? "").replace(/\u200B/g, "").trim() - -// Regression test for Issue #12453: the synchronous POST /message endpoint holds -// the connection open while the agent works, causing "Failed to fetch" over -// VPN/Tailscale. The fix switches to POST /prompt_async which returns immediately. -test("prompt succeeds when sync message endpoint is unreachable", async ({ page, project, assistant }) => { - test.setTimeout(120_000) - - // Simulate Tailscale/VPN killing the long-lived sync connection - await page.route("**/session/*/message", (route) => route.abort("connectionfailed")) - - const token = `E2E_ASYNC_${Date.now()}` - await project.open() - await assistant.reply(token) - const sessionID = await project.prompt(`Reply with exactly: ${token}`) - - await expect.poll(() => assistant.calls()).toBeGreaterThanOrEqual(1) - await expect.poll(() => assistantText(project.sdk, sessionID), { timeout: 90_000 }).toContain(token) -}) - -test("failed prompt send restores the composer input", async ({ page, sdk, gotoSession }) => { - await withSession(sdk, `e2e prompt failure ${Date.now()}`, async (session) => { - const prompt = page.locator(promptSelector) - const value = `restore ${Date.now()}` - - await page.route(`**/session/${session.id}/prompt_async`, (route) => - route.fulfill({ - status: 500, - contentType: "application/json", - body: JSON.stringify({ message: "e2e prompt failure" }), - }), - ) - - await gotoSession(session.id) - await prompt.click() - await page.keyboard.type(value) - await page.keyboard.press("Enter") - - await expect.poll(async () => text(await prompt.textContent())).toBe(value) - await expect - .poll( - async () => { - const messages = await sdk.session.messages({ sessionID: session.id, limit: 50 }).then((r) => r.data ?? []) - return messages.length - }, - { timeout: 15_000 }, - ) - .toBe(0) - }) -}) diff --git a/packages/app/e2e/prompt/prompt-drop-file-uri.spec.ts b/packages/app/e2e/prompt/prompt-drop-file-uri.spec.ts deleted file mode 100644 index add2d8d8b..000000000 --- a/packages/app/e2e/prompt/prompt-drop-file-uri.spec.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { test, expect } from "../fixtures" -import { promptSelector } from "../selectors" - -test("dropping text/plain file: uri inserts a file pill", async ({ page, gotoSession }) => { - await gotoSession() - - const prompt = page.locator(promptSelector) - await prompt.click() - - const path = process.platform === "win32" ? "C:\\opencode-e2e-drop.txt" : "/tmp/opencode-e2e-drop.txt" - const dt = await page.evaluateHandle((text) => { - const dt = new DataTransfer() - dt.setData("text/plain", text) - return dt - }, `file:${path}`) - - await page.dispatchEvent("body", "drop", { dataTransfer: dt }) - - const pill = page.locator(`${promptSelector} [data-type="file"]`).first() - await expect(pill).toBeVisible() - await expect(pill).toHaveAttribute("data-path", path) -}) diff --git a/packages/app/e2e/prompt/prompt-drop-file.spec.ts b/packages/app/e2e/prompt/prompt-drop-file.spec.ts deleted file mode 100644 index 0a138de99..000000000 --- a/packages/app/e2e/prompt/prompt-drop-file.spec.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { test, expect } from "../fixtures" -import { promptSelector } from "../selectors" - -test("dropping an image file adds an attachment", async ({ page, gotoSession }) => { - await gotoSession() - - const prompt = page.locator(promptSelector) - await prompt.click() - - const png = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO3+4uQAAAAASUVORK5CYII=" - const dt = await page.evaluateHandle((b64) => { - const dt = new DataTransfer() - const bytes = Uint8Array.from(atob(b64), (c) => c.charCodeAt(0)) - const file = new File([bytes], "drop.png", { type: "image/png" }) - dt.items.add(file) - return dt - }, png) - - await page.dispatchEvent("body", "drop", { dataTransfer: dt }) - - const img = page.locator('img[alt="drop.png"]').first() - await expect(img).toBeVisible() - - const remove = page.getByRole("button", { name: "Remove attachment" }).first() - await expect(remove).toBeVisible() - - await img.hover() - await remove.click() - await expect(page.locator('img[alt="drop.png"]')).toHaveCount(0) -}) diff --git a/packages/app/e2e/prompt/prompt-footer-focus.spec.ts b/packages/app/e2e/prompt/prompt-footer-focus.spec.ts deleted file mode 100644 index 4609f4b3d..000000000 --- a/packages/app/e2e/prompt/prompt-footer-focus.spec.ts +++ /dev/null @@ -1,88 +0,0 @@ -import type { Locator, Page } from "@playwright/test" -import { test, expect } from "../fixtures" -import { promptAgentSelector, promptModelSelector, promptSelector } from "../selectors" - -type Probe = { - agent?: string - model?: { providerID: string; modelID: string; name?: string } - models?: Array<{ providerID: string; modelID: string; name: string }> - agents?: Array<{ name: string }> -} - -async function probe(page: Page): Promise<Probe | null> { - return page.evaluate(() => { - const win = window as Window & { - __opencode_e2e?: { - model?: { - current?: Probe - } - } - } - return win.__opencode_e2e?.model?.current ?? null - }) -} - -async function state(page: Page) { - const value = await probe(page) - if (!value) throw new Error("Failed to resolve model selection probe") - return value -} - -async function ready(page: Page) { - const prompt = page.locator(promptSelector) - await prompt.click() - await expect(prompt).toBeFocused() - await prompt.pressSequentially("focus") - return prompt -} - -async function body(prompt: Locator) { - return prompt.evaluate((el) => (el as HTMLElement).innerText) -} - -test("agent select returns focus to the prompt", async ({ page, gotoSession }) => { - await gotoSession() - - const prompt = await ready(page) - - const info = await state(page) - const next = info.agents?.map((item) => item.name).find((name) => name !== info.agent) - test.skip(!next, "only one agent available") - if (!next) return - - await page.locator(`${promptAgentSelector} [data-slot="select-select-trigger"]`).first().click() - - const item = page.locator('[data-slot="select-select-item"]').filter({ hasText: next }).first() - await expect(item).toBeVisible() - await item.click({ force: true }) - - await expect(page.locator(`${promptAgentSelector} [data-slot="select-select-trigger-value"]`).first()).toHaveText( - next, - ) - await expect(prompt).toBeFocused() - await prompt.pressSequentially(" agent") - await expect.poll(() => body(prompt)).toContain("focus agent") -}) - -test("model select returns focus to the prompt", async ({ page, gotoSession }) => { - await gotoSession() - - const prompt = await ready(page) - - const info = await state(page) - const key = info.model ? `${info.model.providerID}:${info.model.modelID}` : null - const next = info.models?.find((item) => `${item.providerID}:${item.modelID}` !== key) - test.skip(!next, "only one model available") - if (!next) return - - await page.locator(`${promptModelSelector} [data-action="prompt-model"]`).first().click() - - const item = page.locator(`[data-slot="list-item"][data-key="${next.providerID}:${next.modelID}"]`).first() - await expect(item).toBeVisible() - await item.click({ force: true }) - - await expect(page.locator(`${promptModelSelector} [data-action="prompt-model"] span`).first()).toHaveText(next.name) - await expect(prompt).toBeFocused() - await prompt.pressSequentially(" model") - await expect.poll(() => body(prompt)).toContain("focus model") -}) diff --git a/packages/app/e2e/prompt/prompt-history.spec.ts b/packages/app/e2e/prompt/prompt-history.spec.ts deleted file mode 100644 index 55cb0c9aa..000000000 --- a/packages/app/e2e/prompt/prompt-history.spec.ts +++ /dev/null @@ -1,146 +0,0 @@ -import type { ToolPart } from "@opencode-ai/sdk/v2/client" -import type { Page } from "@playwright/test" -import { test, expect } from "../fixtures" -import { assistantText } from "../actions" -import { promptSelector } from "../selectors" -import { createSdk } from "../utils" - -const text = (value: string | null) => (value ?? "").replace(/\u200B/g, "").trim() -type Sdk = ReturnType<typeof createSdk> - -const isBash = (part: unknown): part is ToolPart => { - if (!part || typeof part !== "object") return false - if (!("type" in part) || part.type !== "tool") return false - if (!("tool" in part) || part.tool !== "bash") return false - return "state" in part -} - -async function wait(page: Page, value: string) { - await expect.poll(async () => text(await page.locator(promptSelector).textContent())).toBe(value) -} - -async function reply(sdk: Sdk, sessionID: string, token: string) { - await expect.poll(() => assistantText(sdk, sessionID), { timeout: 90_000 }).toContain(token) -} - -async function shell(sdk: Sdk, sessionID: string, cmd: string, token: string) { - await expect - .poll( - async () => { - const messages = await sdk.session.messages({ sessionID, limit: 50 }).then((r) => r.data ?? []) - const part = messages - .filter((item) => item.info.role === "assistant") - .flatMap((item) => item.parts) - .filter(isBash) - .find((item) => item.state.input?.command === cmd && item.state.status === "completed") - - if (!part || part.state.status !== "completed") return - return typeof part.state.metadata?.output === "string" ? part.state.metadata.output : part.state.output - }, - { timeout: 90_000 }, - ) - .toContain(token) -} - -test("prompt history restores unsent draft with arrow navigation", async ({ page, project, assistant }) => { - test.setTimeout(120_000) - - const firstToken = `E2E_HISTORY_ONE_${Date.now()}` - const secondToken = `E2E_HISTORY_TWO_${Date.now()}` - const first = `Reply with exactly: ${firstToken}` - const second = `Reply with exactly: ${secondToken}` - const draft = `draft ${Date.now()}` - - await project.open() - await assistant.reply(firstToken) - const sessionID = await project.prompt(first) - await wait(page, "") - await reply(project.sdk, sessionID, firstToken) - - await assistant.reply(secondToken) - await project.prompt(second) - await wait(page, "") - await reply(project.sdk, sessionID, secondToken) - - const prompt = page.locator(promptSelector) - await prompt.click() - await page.keyboard.type(draft) - await wait(page, draft) - - await prompt.fill("") - await wait(page, "") - - await page.keyboard.press("ArrowUp") - await wait(page, second) - - await page.keyboard.press("ArrowUp") - await wait(page, first) - - await page.keyboard.press("ArrowDown") - await wait(page, second) - - await page.keyboard.press("ArrowDown") - await wait(page, "") -}) - -test.fixme("shell history stays separate from normal prompt history", async ({ page, sdk, gotoSession }) => { - test.setTimeout(120_000) - - const firstToken = `E2E_SHELL_ONE_${Date.now()}` - const secondToken = `E2E_SHELL_TWO_${Date.now()}` - const normalToken = `E2E_NORMAL_${Date.now()}` - const first = `echo ${firstToken}` - const second = `echo ${secondToken}` - const normal = `Reply with exactly: ${normalToken}` - - await gotoSession() - - const prompt = page.locator(promptSelector) - - await prompt.click() - await page.keyboard.type("!") - await page.keyboard.type(first) - await page.keyboard.press("Enter") - await wait(page, "") - - await expect(page).toHaveURL(/\/session\/[^/?#]+/, { timeout: 30_000 }) - const sessionID = sessionIDFromUrl(page.url())! - await shell(sdk, sessionID, first, firstToken) - - await prompt.click() - await page.keyboard.type("!") - await page.keyboard.type(second) - await page.keyboard.press("Enter") - await wait(page, "") - await shell(sdk, sessionID, second, secondToken) - - await page.keyboard.press("Escape") - await wait(page, "") - - await prompt.click() - await page.keyboard.type("!") - await page.keyboard.press("ArrowUp") - await wait(page, second) - - await page.keyboard.press("ArrowUp") - await wait(page, first) - - await page.keyboard.press("ArrowDown") - await wait(page, second) - - await page.keyboard.press("ArrowDown") - await wait(page, "") - - await page.keyboard.press("Escape") - await wait(page, "") - - await prompt.click() - await page.keyboard.type(normal) - await page.keyboard.press("Enter") - await wait(page, "") - await reply(sdk, sessionID, normalToken) - - await prompt.click() - await page.keyboard.press("ArrowUp") - await wait(page, normal) -}) diff --git a/packages/app/e2e/prompt/prompt-mention.spec.ts b/packages/app/e2e/prompt/prompt-mention.spec.ts deleted file mode 100644 index 5cc9f6e68..000000000 --- a/packages/app/e2e/prompt/prompt-mention.spec.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { test, expect } from "../fixtures" -import { promptSelector } from "../selectors" - -test("smoke @mention inserts file pill token", async ({ page, gotoSession }) => { - await gotoSession() - - await page.locator(promptSelector).click() - const sep = process.platform === "win32" ? "\\" : "/" - const file = ["packages", "app", "package.json"].join(sep) - const filePattern = /packages[\\/]+app[\\/]+\s*package\.json/ - - await page.keyboard.type(`@${file}`) - - const suggestion = page.getByRole("button", { name: filePattern }).first() - await expect(suggestion).toBeVisible() - await suggestion.hover() - - await page.keyboard.press("Tab") - - const pill = page.locator(`${promptSelector} [data-type="file"]`).first() - await expect(pill).toBeVisible() - await expect(pill).toHaveAttribute("data-path", filePattern) - - await page.keyboard.type(" ok") - await expect(page.locator(promptSelector)).toContainText("ok") -}) diff --git a/packages/app/e2e/prompt/prompt-multiline.spec.ts b/packages/app/e2e/prompt/prompt-multiline.spec.ts deleted file mode 100644 index 3584773bb..000000000 --- a/packages/app/e2e/prompt/prompt-multiline.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { test, expect } from "../fixtures" -import { promptSelector } from "../selectors" - -test("shift+enter inserts a newline without submitting", async ({ page, gotoSession }) => { - await gotoSession() - - await expect(page).toHaveURL(/\/session\/?$/) - - const prompt = page.locator(promptSelector) - await prompt.focus() - await expect(prompt).toBeFocused() - - await prompt.pressSequentially("line one") - await expect(prompt).toBeFocused() - - await prompt.press("Shift+Enter") - await expect(page).toHaveURL(/\/session\/?$/) - await expect(prompt).toBeFocused() - - await prompt.pressSequentially("line two") - - await expect(page).toHaveURL(/\/session\/?$/) - await expect.poll(() => prompt.evaluate((el) => el.innerText)).toBe("line one\nline two") -}) diff --git a/packages/app/e2e/prompt/prompt-shell.spec.ts b/packages/app/e2e/prompt/prompt-shell.spec.ts deleted file mode 100644 index 81af4cb1b..000000000 --- a/packages/app/e2e/prompt/prompt-shell.spec.ts +++ /dev/null @@ -1,74 +0,0 @@ -import type { ToolPart } from "@opencode-ai/sdk/v2/client" -import { test, expect } from "../fixtures" -import { closeDialog, openSettings, withSession } from "../actions" -import { promptModelSelector, promptSelector, promptVariantSelector } from "../selectors" - -const isBash = (part: unknown): part is ToolPart => { - if (!part || typeof part !== "object") return false - if (!("type" in part) || part.type !== "tool") return false - if (!("tool" in part) || part.tool !== "bash") return false - return "state" in part -} - -test("shell mode runs a command in the project directory", async ({ page, project }) => { - test.setTimeout(120_000) - - await project.open() - const cmd = process.platform === "win32" ? "dir" : "command ls" - - await withSession(project.sdk, `e2e shell ${Date.now()}`, async (session) => { - project.trackSession(session.id) - await project.gotoSession(session.id) - const dialog = await openSettings(page) - const toggle = dialog.locator('[data-action="settings-auto-accept-permissions"]').first() - const input = toggle.locator('[data-slot="switch-input"]').first() - await expect(toggle).toBeVisible() - if ((await input.getAttribute("aria-checked")) !== "true") { - await toggle.locator('[data-slot="switch-control"]').click() - await expect(input).toHaveAttribute("aria-checked", "true") - } - await closeDialog(page, dialog) - await project.shell(cmd) - - await expect - .poll( - async () => { - const list = await project.sdk.session - .messages({ sessionID: session.id, limit: 50 }) - .then((x) => x.data ?? []) - const msg = list.findLast( - (item) => item.info.role === "assistant" && "path" in item.info && item.info.path.cwd === project.directory, - ) - if (!msg) return - - const part = msg.parts - .filter(isBash) - .find((item) => item.state.input?.command === cmd && item.state.status === "completed") - - if (!part || part.state.status !== "completed") return - const output = - typeof part.state.metadata?.output === "string" ? part.state.metadata.output : part.state.output - if (!output.includes("README.md")) return - - return { cwd: project.directory, output } - }, - { timeout: 90_000 }, - ) - .toEqual(expect.objectContaining({ cwd: project.directory, output: expect.stringContaining("README.md") })) - }) -}) - -test("shell mode unmounts model and variant controls", async ({ page, project }) => { - await project.open() - - const prompt = page.locator(promptSelector).first() - await expect(page.locator(promptModelSelector)).toHaveCount(1) - await expect(page.locator(promptVariantSelector)).toHaveCount(1) - - await prompt.click() - await page.keyboard.type("!") - - await expect(prompt).toHaveAttribute("aria-label", /enter shell command/i) - await expect(page.locator(promptModelSelector)).toHaveCount(0) - await expect(page.locator(promptVariantSelector)).toHaveCount(0) -}) diff --git a/packages/app/e2e/prompt/prompt-slash-open.spec.ts b/packages/app/e2e/prompt/prompt-slash-open.spec.ts deleted file mode 100644 index b4a93099d..000000000 --- a/packages/app/e2e/prompt/prompt-slash-open.spec.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { test, expect } from "../fixtures" -import { promptSelector } from "../selectors" - -test("smoke /open opens file picker dialog", async ({ page, gotoSession }) => { - await gotoSession() - - await page.locator(promptSelector).click() - await page.keyboard.type("/open") - - const command = page.locator('[data-slash-id="file.open"]') - await expect(command).toBeVisible() - await command.hover() - - await page.keyboard.press("Enter") - - const dialog = page.getByRole("dialog") - await expect(dialog).toBeVisible() - await expect(dialog.getByRole("textbox").first()).toBeVisible() - - await page.keyboard.press("Escape") - await expect(dialog).toHaveCount(0) -}) diff --git a/packages/app/e2e/prompt/prompt-slash-share.spec.ts b/packages/app/e2e/prompt/prompt-slash-share.spec.ts deleted file mode 100644 index f3eeceee5..000000000 --- a/packages/app/e2e/prompt/prompt-slash-share.spec.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { test, expect } from "../fixtures" -import { promptSelector } from "../selectors" -import { withSession } from "../actions" - -const shareDisabled = process.env.OPENCODE_DISABLE_SHARE === "true" || process.env.OPENCODE_DISABLE_SHARE === "1" - -async function seed(sdk: Parameters<typeof withSession>[0], sessionID: string) { - await sdk.session.promptAsync({ - sessionID, - noReply: true, - parts: [{ type: "text", text: "e2e share seed" }], - }) - - await expect - .poll( - async () => { - const messages = await sdk.session.messages({ sessionID, limit: 1 }).then((r) => r.data ?? []) - return messages.length - }, - { timeout: 30_000 }, - ) - .toBeGreaterThan(0) -} - -test("/share and /unshare update session share state", async ({ page, project }) => { - test.skip(shareDisabled, "Share is disabled in this environment (OPENCODE_DISABLE_SHARE).") - - await project.open() - await withSession(project.sdk, `e2e slash share ${Date.now()}`, async (session) => { - project.trackSession(session.id) - const prompt = page.locator(promptSelector) - - await seed(project.sdk, session.id) - await project.gotoSession(session.id) - - await prompt.click() - await page.keyboard.type("/share") - await expect(page.locator('[data-slash-id="session.share"]').first()).toBeVisible() - await page.keyboard.press("Enter") - - await expect - .poll( - async () => { - const data = await project.sdk.session.get({ sessionID: session.id }).then((r) => r.data) - return data?.share?.url || undefined - }, - { timeout: 30_000 }, - ) - .not.toBeUndefined() - - await prompt.click() - await page.keyboard.type("/unshare") - await expect(page.locator('[data-slash-id="session.unshare"]').first()).toBeVisible() - await page.keyboard.press("Enter") - - await expect - .poll( - async () => { - const data = await project.sdk.session.get({ sessionID: session.id }).then((r) => r.data) - return data?.share?.url || undefined - }, - { timeout: 30_000 }, - ) - .toBeUndefined() - }) -}) diff --git a/packages/app/e2e/prompt/prompt-slash-terminal.spec.ts b/packages/app/e2e/prompt/prompt-slash-terminal.spec.ts deleted file mode 100644 index 466b3ba1b..000000000 --- a/packages/app/e2e/prompt/prompt-slash-terminal.spec.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { test, expect } from "../fixtures" -import { runPromptSlash, waitTerminalFocusIdle } from "../actions" -import { promptSelector, terminalSelector } from "../selectors" - -test("/terminal toggles the terminal panel", async ({ page, gotoSession }) => { - await gotoSession() - - const prompt = page.locator(promptSelector) - const terminal = page.locator(terminalSelector) - - await expect(terminal).not.toBeVisible() - - await runPromptSlash(page, { prompt, text: "/terminal", id: "terminal.toggle" }) - await waitTerminalFocusIdle(page, { term: terminal }) - - await runPromptSlash(page, { prompt, text: "/terminal", id: "terminal.toggle" }) - await expect(terminal).not.toBeVisible() -}) diff --git a/packages/app/e2e/prompt/prompt.spec.ts b/packages/app/e2e/prompt/prompt.spec.ts deleted file mode 100644 index b5dc02bad..000000000 --- a/packages/app/e2e/prompt/prompt.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { test, expect } from "../fixtures" -import { assistantText } from "../actions" - -test("can send a prompt and receive a reply", async ({ page, project, assistant }) => { - test.setTimeout(120_000) - - const pageErrors: string[] = [] - const onPageError = (err: Error) => { - pageErrors.push(err.message) - } - page.on("pageerror", onPageError) - - try { - const token = `E2E_OK_${Date.now()}` - await project.open() - await assistant.reply(token) - const sessionID = await project.prompt(`Reply with exactly: ${token}`) - - await expect.poll(() => assistant.calls()).toBeGreaterThanOrEqual(1) - await expect.poll(() => assistantText(project.sdk, sessionID), { timeout: 30_000 }).toContain(token) - } finally { - page.off("pageerror", onPageError) - } - - if (pageErrors.length > 0) { - throw new Error(`Page error(s):\n${pageErrors.join("\n")}`) - } -}) |
