test(app): more e2e tests

This commit is contained in:
Adam
2026-01-19 06:54:47 -06:00
parent b90315bc7e
commit 2b086f0584
3 changed files with 72 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
import { test, expect } from "./fixtures"
import { promptSelector } from "./utils"
test("context panel can be opened from the prompt", async ({ page, sdk, gotoSession }) => {
const title = `e2e smoke context ${Date.now()}`
const created = await sdk.session.create({ title }).then((r) => r.data)
if (!created?.id) throw new Error("Session create did not return an id")
const sessionID = created.id
try {
await gotoSession(sessionID)
const promptForm = page.locator("form").filter({ has: page.locator(promptSelector) }).first()
const contextButton = promptForm
.locator("button")
.filter({ has: promptForm.locator('[data-component="progress-circle"]').first() })
.first()
await expect(contextButton).toBeVisible()
await contextButton.click()
const tabs = page.locator('[data-component="tabs"][data-variant="normal"]')
await expect(tabs.getByRole("tab", { name: "Context" })).toBeVisible()
} finally {
await sdk.session.delete({ sessionID }).catch(() => undefined)
}
})

View File

@@ -0,0 +1,24 @@
import { test, expect } from "./fixtures"
import { modKey } from "./utils"
test("can open a file tab from the search palette", async ({ page, gotoSession }) => {
await gotoSession()
await page.keyboard.press(`${modKey}+P`)
const dialog = page.getByRole("dialog")
await expect(dialog).toBeVisible()
const input = dialog.getByRole("textbox").first()
await input.fill("package.json")
const firstItem = dialog.locator('[data-slot="list-item"]').first()
await expect(firstItem).toBeVisible()
await firstItem.click()
await expect(dialog).toHaveCount(0)
const tabs = page.locator('[data-component="tabs"][data-variant="normal"]')
await expect(tabs).toBeVisible()
await expect(tabs.getByRole("tab").first()).toBeVisible()
})

View File

@@ -0,0 +1,20 @@
import { test, expect } from "./fixtures"
import { modKey } from "./utils"
test("sidebar can be collapsed and expanded", async ({ page, gotoSession }) => {
await gotoSession()
const createButton = page.getByRole("button", { name: /New (session|workspace)/ }).first()
const opened = (await createButton.count()) > 0
if (!opened) {
await page.keyboard.press(`${modKey}+B`)
await expect(createButton).toBeVisible()
}
await page.keyboard.press(`${modKey}+B`)
await expect(createButton).toHaveCount(0)
await page.keyboard.press(`${modKey}+B`)
await expect(createButton).toBeVisible()
})