2
0

file-open.spec.ts 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. import { test, expect } from "../fixtures"
  2. import { promptSelector } from "../selectors"
  3. test("can open a file tab from the search palette", async ({ page, gotoSession }) => {
  4. await gotoSession()
  5. await page.locator(promptSelector).click()
  6. await page.keyboard.type("/open")
  7. const command = page.locator('[data-slash-id="file.open"]').first()
  8. await expect(command).toBeVisible()
  9. await page.keyboard.press("Enter")
  10. const dialog = page
  11. .getByRole("dialog")
  12. .filter({ has: page.getByPlaceholder(/search files/i) })
  13. .first()
  14. await expect(dialog).toBeVisible()
  15. const input = dialog.getByRole("textbox").first()
  16. await input.fill("package.json")
  17. const item = dialog.locator('[data-slot="list-item"][data-key^="file:"]').first()
  18. await expect(item).toBeVisible({ timeout: 30_000 })
  19. await item.click()
  20. await expect(dialog).toHaveCount(0)
  21. const tabs = page.locator('[data-component="tabs"][data-variant="normal"]')
  22. await expect(tabs.locator('[data-slot="tabs-trigger"]').first()).toBeVisible()
  23. })