file-tree.spec.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { test, expect } from "./fixtures"
  2. test("file tree can expand folders and open a file", async ({ page, gotoSession }) => {
  3. await gotoSession()
  4. await page.getByRole("button", { name: "Toggle file tree" }).click()
  5. const treeTabs = page.locator('[data-component="tabs"][data-variant="pill"][data-scope="filetree"]')
  6. await expect(treeTabs).toBeVisible()
  7. await treeTabs.locator('[data-slot="tabs-trigger"]').nth(1).click()
  8. const node = (name: string) => treeTabs.getByRole("button", { name, exact: true })
  9. await expect(node("packages")).toBeVisible()
  10. await node("packages").click()
  11. await expect(node("app")).toBeVisible()
  12. await node("app").click()
  13. await expect(node("src")).toBeVisible()
  14. await node("src").click()
  15. await expect(node("components")).toBeVisible()
  16. await node("components").click()
  17. await expect(node("file-tree.tsx")).toBeVisible()
  18. await node("file-tree.tsx").click()
  19. const tab = page.getByRole("tab", { name: "file-tree.tsx" })
  20. await expect(tab).toBeVisible()
  21. await tab.click()
  22. const code = page.locator('[data-component="code"]').first()
  23. await expect(code.getByText("export default function FileTree")).toBeVisible()
  24. })