Playwright lab
Visual & a11y testing
Screenshot baselines with masks, ARIA snapshots and a form with real, fixable accessibility defects.
Practice tasks
- Take expect(locator).toHaveScreenshot() of the stable card and commit the baseline with --update-snapshots.
- Screenshot the animated area: fix it with mask, animations: 'disabled' and caret: 'hide'.
- Toggle the cookie banner (layout shift) and show how maxDiffPixels / threshold tolerate or catch it.
- Switch to “Inaccessible” and run @axe-core/playwright: list the violations (image-alt, label, color-contrast, heading-order, button-name, link-name).
- Switch to “Accessible” and assert zero violations; capture toMatchAriaSnapshot() of the landmark region.
- Navigate the form with Tab only and assert focus order with toBeFocused().
- Use page.emulateMedia({ colorScheme: 'dark' }) and add a second baseline.