Skip to main content
QA Training
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

How to use this prompt

  1. 1Copy the prompt template using the Copy button above.
  2. 2Open your preferred AI assistant (ChatGPT, Claude, Gemini, Copilot, etc.).
  3. 3Paste the prompt and replace the {{placeholder}} variables with your project-specific values.
  4. 4Review the output - treat it as a professional first draft, not a final deliverable.
  5. 5Iterate: refine the output by asking follow-up questions or providing more context.

Frequently asked questions

Which AI models work best with this prompt?v

This prompt works with any capable language model including ChatGPT (GPT-4o), Claude (3.5+), Gemini (1.5 Pro+), and GitHub Copilot Chat. More capable models produce more complete and accurate outputs.

How do I adapt the prompt for a different framework?v

Replace the framework placeholder with your target framework and update any framework-specific syntax references in the output. The structure and logic of the generated tests will transfer across frameworks.

Can I use this prompt commercially?v

Yes. All prompts on QATraining.uk are free to use for personal and commercial QA work. Attribution is appreciated but not required.