chore: cleanup
This commit is contained in:
@@ -9,12 +9,29 @@ test("context panel can be opened from the prompt", async ({ page, sdk, gotoSess
|
|||||||
const sessionID = created.id
|
const sessionID = created.id
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
await sdk.session.promptAsync({
|
||||||
|
sessionID,
|
||||||
|
noReply: true,
|
||||||
|
parts: [
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
text: "seed context",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
|
await expect
|
||||||
|
.poll(async () => {
|
||||||
|
const messages = await sdk.session.messages({ sessionID, limit: 1 }).then((r) => r.data ?? [])
|
||||||
|
return messages.length
|
||||||
|
})
|
||||||
|
.toBeGreaterThan(0)
|
||||||
|
|
||||||
await gotoSession(sessionID)
|
await gotoSession(sessionID)
|
||||||
|
|
||||||
const promptForm = page.locator("form").filter({ has: page.locator(promptSelector) }).first()
|
const contextButton = page
|
||||||
const contextButton = promptForm
|
.locator('[data-component="button"]')
|
||||||
.locator("button")
|
.filter({ has: page.locator('[data-component="progress-circle"]').first() })
|
||||||
.filter({ has: promptForm.locator('[data-component="progress-circle"]').first() })
|
|
||||||
.first()
|
.first()
|
||||||
|
|
||||||
await expect(contextButton).toBeVisible()
|
await expect(contextButton).toBeVisible()
|
||||||
|
|||||||
@@ -12,13 +12,12 @@ test("can open a file tab from the search palette", async ({ page, gotoSession }
|
|||||||
const input = dialog.getByRole("textbox").first()
|
const input = dialog.getByRole("textbox").first()
|
||||||
await input.fill("package.json")
|
await input.fill("package.json")
|
||||||
|
|
||||||
const firstItem = dialog.locator('[data-slot="list-item"]').first()
|
const fileItem = dialog.locator('[data-slot="list-item"][data-key^="file:"]').first()
|
||||||
await expect(firstItem).toBeVisible()
|
await expect(fileItem).toBeVisible()
|
||||||
await firstItem.click()
|
await fileItem.click()
|
||||||
|
|
||||||
await expect(dialog).toHaveCount(0)
|
await expect(dialog).toHaveCount(0)
|
||||||
|
|
||||||
const tabs = page.locator('[data-component="tabs"][data-variant="normal"]')
|
const tabs = page.locator('[data-component="tabs"][data-variant="normal"]')
|
||||||
await expect(tabs).toBeVisible()
|
await expect(tabs.locator('[data-slot="tabs-trigger"]').first()).toBeVisible()
|
||||||
await expect(tabs.getByRole("tab").first()).toBeVisible()
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,17 +4,18 @@ import { modKey } from "./utils"
|
|||||||
test("sidebar can be collapsed and expanded", async ({ page, gotoSession }) => {
|
test("sidebar can be collapsed and expanded", async ({ page, gotoSession }) => {
|
||||||
await gotoSession()
|
await gotoSession()
|
||||||
|
|
||||||
const createButton = page.getByRole("button", { name: /New (session|workspace)/ }).first()
|
const main = page.locator("main")
|
||||||
const opened = (await createButton.count()) > 0
|
const closedClass = /xl:border-l/
|
||||||
|
const isClosed = await main.evaluate((node) => node.className.includes("xl:border-l"))
|
||||||
|
|
||||||
if (!opened) {
|
if (isClosed) {
|
||||||
await page.keyboard.press(`${modKey}+B`)
|
await page.keyboard.press(`${modKey}+B`)
|
||||||
await expect(createButton).toBeVisible()
|
await expect(main).not.toHaveClass(closedClass)
|
||||||
}
|
}
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+B`)
|
await page.keyboard.press(`${modKey}+B`)
|
||||||
await expect(createButton).toHaveCount(0)
|
await expect(main).toHaveClass(closedClass)
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+B`)
|
await page.keyboard.press(`${modKey}+B`)
|
||||||
await expect(createButton).toBeVisible()
|
await expect(main).not.toHaveClass(closedClass)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user