test(app): more e2e tests

This commit is contained in:
Adam
2026-01-18 05:36:02 -06:00
parent 19d15ca4df
commit 91a708b12e
3 changed files with 91 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import { test, expect } from "@playwright/test"
import { createOpencodeClient } from "@opencode-ai/sdk/v2/client"
import { base64Encode } from "@opencode-ai/util/encode"
const host = process.env.PLAYWRIGHT_SERVER_HOST ?? "localhost"
const port = process.env.PLAYWRIGHT_SERVER_PORT ?? "4096"
const url = `http://${host}:${port}`
async function getWorktree() {
const sdk = createOpencodeClient({ baseUrl: url, throwOnError: true })
const result = await sdk.path.get()
const data = result.data
if (!data?.worktree) throw new Error(`Failed to resolve a worktree from ${url}/path`)
return data.worktree
}
test("project route redirects to /session", async ({ page }) => {
const directory = await getWorktree()
const slug = base64Encode(directory)
await page.goto(`/${slug}`)
await expect(page).toHaveURL(new RegExp(`/${slug}/session`))
await expect(page.locator('[data-component="prompt-input"]')).toBeVisible()
})