import { test, expect } from '@playwright/test'; test.describe('Tree', () => { test.beforeEach(async ({ page }) => { await page.goto('/docs/examples/tree/'); }); test('tree has role="tree" and branches have role="treeitem"', async ({ page }) => { const basicTree = page.getByTestId('basic-tree'); await expect(basicTree).toHaveRole('tree'); // The [branch] span itself gets role="treeitem", not its parent
  • const branchDocuments = page.getByTestId('branch-documents'); await expect(branchDocuments).toHaveRole('treeitem'); }); test('collapsed branch hides subtree content', async ({ page }) => { const branchWork = page.getByTestId('branch-work'); await expect(branchWork).toHaveAttribute('aria-expanded', 'false'); // Subtree is a sibling