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

@@ -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")