test(app): fix windows paths

This commit is contained in:
Adam
2026-01-22 12:19:47 -06:00
parent 5a4eec5b08
commit 93044cc7d1
3 changed files with 25 additions and 5 deletions

View File

@@ -4,15 +4,22 @@ import { modKey } from "./utils"
test("smoke file viewer renders real file content", async ({ page, gotoSession }) => {
await gotoSession()
const sep = process.platform === "win32" ? "\\" : "/"
const file = ["packages", "app", "package.json"].join(sep)
await page.keyboard.press(`${modKey}+P`)
const dialog = page.getByRole("dialog")
await expect(dialog).toBeVisible()
const input = dialog.getByRole("textbox").first()
await input.fill("packages/app/package.json")
await input.fill(file)
const fileItem = dialog.locator('[data-slot="list-item"][data-key="file:packages/app/package.json"]')
const fileItem = dialog
.locator(
'[data-slot="list-item"][data-key^="file:"][data-key*="packages"][data-key*="app"][data-key$="package.json"]',
)
.first()
await expect(fileItem).toBeVisible()
await fileItem.click()

View File

@@ -5,16 +5,21 @@ test("smoke @mention inserts file pill token", async ({ page, gotoSession }) =>
await gotoSession()
await page.locator(promptSelector).click()
await page.keyboard.type("@packages/app/package.json")
const sep = process.platform === "win32" ? "\\" : "/"
const file = ["packages", "app", "package.json"].join(sep)
const filePattern = /packages[\\/]+app[\\/]+\s*package\.json/
const suggestion = page.getByRole("button", { name: /packages\/app\/\s*package\.json/ }).first()
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"][data-path="packages/app/package.json"]`)
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")

View File

@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"noEmit": true,
"types": ["node"]
},
"include": ["./**/*.ts"]
}