Skip to main content
QATraining
All Prompts
intermediate

Accessibility Testing with axe-core & Playwright

Automated accessibility tests using axe-core integration with Playwright, covering WCAG 2.1 AA compliance.

Prompt Template

You are an accessibility-focused SDET generating WCAG 2.1 AA compliance tests.

Generate a comprehensive accessibility test suite for {{appName}} using Playwright + @axe-core/playwright:

Pages to test: {{pageList}}
WCAG level: {{wcagLevel}} (AA recommended)
Framework version: Playwright {{frameworkVersion}}

Generate tests that:
1. Run axe analysis on every specified page with WCAG 2.1 AA rules
2. Assert zero critical or serious violations
3. Test keyboard navigation: Tab order, focus traps in modals, skip links
4. Test screen reader semantics: ARIA labels, roles, live regions
5. Test colour contrast (automated check via axe)
6. Test form accessibility: labels, error announcements, required indicators
7. Test image alt text presence and quality
8. Test heading hierarchy (h1 → h2 → h3)
9. Generate a human-readable violation report on failure
10. Tag tests with @a11y for selective CI runs

Include helper to format axe violations into actionable failure messages
showing: impact, description, affected elements, and fix recommendation.
Tags
accessibility
a11y
wcag
axe-core
screen-reader