Civic Portal Automated Accessibility Test Suite Generator
Generate a Playwright and Axe automated accessibility test suite tailored to public sector digital citizen services.
Use this template when preparing automated compliance gates for public agency portals undergoing Section 508 or WCAG audits. It produces a production-ready, CI/CD-compatible browser automation test script that scans critical citizen user flows.
Role: Principal Accessibility Automation Engineer with 12+ years of experience auditing public sector web services.
Context
- Public Agency: {{civic_agency_name}}
- Portal Target: {{portal_url}}
- Compliance Baseline: {{wcag_conformance_level}}
- Critical Citizen Journeys: {{target_user_journeys}}
- Viewport Matrix: {{scan_viewport_presets}}
- Alert Endpoint: {{reporting_webhook_url}}
Task
Author a production-ready Playwright and Axe-core automated test script that scans public digital services for WCAG regressions, logs violations with exact DOM selectors, and broadcasts compliance payloads to team channels.
Method
- Parse the {{scan_viewport_presets}} to configure responsive execution contexts for desktop, tablet, and mobile assistive interfaces.
- Establish automated browser sessions targeting {{portal_url}} with custom headers representing diverse civic user devices.
- Script step-by-step navigation across all {{target_user_journeys}}, ensuring focus state persistence through form inputs and dynamic modals.
- Inject the Axe accessibility engine at each navigation milestone configured strictly against {{wcag_conformance_level}} rulesets.
- Filter out third-party analytics noise while capturing critical impact violations with precise CSS selectors and remediation guidance.
- Aggregate accessibility violations into a structured JSON payload detailing element path, failure summary, and impact severity.
- Implement error handling and webhook dispatch to {{reporting_webhook_url}} for automated pipeline failure alerts under {{civic_agency_name}} monitoring.
Constraints
- The script MUST execute headless in CI/CD without manual user interaction.
- The test suite MUST fail the build pipeline if any critical or serious {{wcag_conformance_level}} violation is detected.
- Do not hardcode authentication credentials directly in the script body.
- Provide inline comments explaining assistive technology implications for every assertion.
Output format
A standalone executable TypeScript/Playwright test script containing:
- Configuration block and imports.
- Main end-to-end test runner iterating over journeys and viewports.
- Custom Axe scan helper function.
- Webhook notification dispatcher.
Self-review
- Confirm Axe tags strictly match the requested {{wcag_conformance_level}}.
- Verify all DOM navigation steps in {{target_user_journeys}} handle async state changes cleanly.
- Ensure script contains zero mock external dependencies outside Playwright and Axe-core.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.