Testing · Senior · Question 47 of 75
What does toMatchAriaSnapshot check?
await expect(page.getByRole("navigation")).toMatchAriaSnapshot(`
- navigation:
- link "Home"
- link "Docs"
`);- ✓Correct answer: The accessibility tree of a region (roles, names, structure) - more stable than DOM snapshots
- 2A screenshot with ARIA labels drawn on it
- 3That ARIA attributes are valid HTML
Explanation
It ignores classes and wrappers, so it captures what assistive tech sees.