Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 28 additions & 16 deletions packages/app/e2e/prompt/prompt-mention.spec.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@
import fs from "node:fs/promises"
import path from "node:path"
import { test, expect } from "../fixtures"
import { promptSelector } from "../selectors"

test("smoke @mention inserts file pill token", async ({ page, gotoSession }) => {
await gotoSession()
test("smoke @mention inserts file pill token", async ({ page, withProject }) => {
await withProject(async ({ directory, gotoSession }) => {
// Scaffold nested file to test slashes and subdirectories
await fs.mkdir(path.join(directory, "packages", "app"), { recursive: true })
await fs.writeFile(path.join(directory, "packages", "app", "package.json"), "{}")

await page.locator(promptSelector).click()
const sep = process.platform === "win32" ? "\\" : "/"
const file = ["packages", "app", "package.json"].join(sep)
const filePattern = /packages[\\/]+app[\\/]+\s*package\.json/
await gotoSession()

await page.keyboard.type(`@${file}`)
const file = "packages/app/package.json"
const filePattern = /packages[\\/]+app[\\/]+\s*package\.json/

const suggestion = page.getByRole("button", { name: filePattern }).first()
await expect(suggestion).toBeVisible()
await suggestion.hover()
const suggestion = page.getByRole("button", { name: filePattern }).first()

await page.keyboard.press("Tab")
await expect(async () => {
await page.locator(promptSelector).click()
await page.keyboard.press("Control+A")
await page.keyboard.press("Backspace")
Comment on lines +20 to +22
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

page.keyboard.press("Control+A") is not cross-platform and deviates from the existing E2E convention of using modKey for shortcuts (see packages/app/e2e/utils.ts:10 and e.g. ${modKey}+A in packages/app/e2e/session/session-undo-redo.spec.ts). Please switch this to ${modKey}+A (or Playwright’s ControlOrMeta+A) and import modKey to keep the test runnable on macOS as well.

Copilot uses AI. Check for mistakes.
await page.keyboard.type(`@${file}`)
await expect(suggestion).toBeVisible({ timeout: 500 })
}).toPass({ timeout: 10_000 })

const pill = page.locator(`${promptSelector} [data-type="file"]`).first()
await expect(pill).toBeVisible()
await expect(pill).toHaveAttribute("data-path", filePattern)
await suggestion.hover()

await page.keyboard.type(" ok")
await expect(page.locator(promptSelector)).toContainText("ok")
await page.keyboard.press("Tab")

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")
})
})
Loading