test(app): more e2e tests
This commit is contained in:
28
packages/app/e2e/context.spec.ts
Normal file
28
packages/app/e2e/context.spec.ts
Normal 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)
|
||||
}
|
||||
})
|
||||
24
packages/app/e2e/file-open.spec.ts
Normal file
24
packages/app/e2e/file-open.spec.ts
Normal 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()
|
||||
})
|
||||
20
packages/app/e2e/sidebar.spec.ts
Normal file
20
packages/app/e2e/sidebar.spec.ts
Normal 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()
|
||||
})
|
||||
Reference in New Issue
Block a user