file-viewer.spec.ts 842 B

1234567891011121314151617181920212223242526
  1. import { test, expect } from "../fixtures"
  2. import { openPalette, clickListItem } from "../actions"
  3. test("smoke file viewer renders real file content", async ({ page, gotoSession }) => {
  4. await gotoSession()
  5. const sep = process.platform === "win32" ? "\\" : "/"
  6. const file = ["packages", "app", "package.json"].join(sep)
  7. const dialog = await openPalette(page)
  8. const input = dialog.getByRole("textbox").first()
  9. await input.fill(file)
  10. await clickListItem(dialog, { text: /packages.*app.*package.json/ })
  11. await expect(dialog).toHaveCount(0)
  12. const tab = page.getByRole("tab", { name: "package.json" })
  13. await expect(tab).toBeVisible()
  14. await tab.click()
  15. const code = page.locator('[data-component="code"]').first()
  16. await expect(code).toBeVisible()
  17. await expect(code.getByText("@opencode-ai/app")).toBeVisible()
  18. })