file-tree.spec.ts 1.3 KB

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