Accessibility testing in CI/CD pipelines
Automated accessibility checks in your pipeline stop the easy regressions, such as a missing label, an empty button or a contrast drop, before they reach production. This guide gives working setups for the free tools teams actually use, and is honest about what they cannot see.
Reviewed by Khushwant Parihar, CPACC
Updated
Choosing a tool
| Tool | Latest (Nov 2026) | Best when | Engine |
|---|---|---|---|
@axe-core/playwright | 4.14.0 | You have Playwright tests | axe-core 4.14 |
cypress-axe | 1.7.0 | You have Cypress tests | axe-core (you install it) |
jest-axe | 11.0.0 | Testing components in isolation | axe-core, in jsdom |
pa11y-ci | 5.0.0 | You want to scan a list of URLs | HTML_CodeSniffer and/or axe |
@lhci/cli | 0.16.1 | You also track performance and SEO | A subset of axe rules |
@axe-core/cli | 4.14.0 | Quick scripted scans | axe-core |
Skip @axe-core/react: its README says it does not support React 18 and above. For a deeper comparison of engines see axe vs WAVE and our testing tools benchmark.
axe with Playwright
npm install --save-dev @playwright/test @axe-core/playwright// tests/a11y.spec.ts
import { test, expect } from "@playwright/test"
import AxeBuilder from "@axe-core/playwright"
const pages = ["/", "/pricing", "/contact"]
for (const path of pages) {
test(`no WCAG A/AA violations on ${path}`, async ({ page }) => {
await page.goto(path)
const results = await new AxeBuilder({ page })
.withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa"])
.analyze()
expect(results.violations).toEqual([])
})
}The tags limit the run to WCAG A and AA rules. There is no wcag22a tag because the new Level A criteria in WCAG 2.2 have no automated axe rule. Test interactive states too: open the menu or dialog in the test, then call analyze() again, and scope with .include("#dialog") if needed.
axe with Cypress
npm install --save-dev cypress axe-core cypress-axe// cypress/support/e2e.js
import "cypress-axe"
// cypress/e2e/a11y.cy.js
describe("accessibility", () => {
it("home page has no WCAG A/AA violations", () => {
cy.visit("/")
cy.injectAxe()
cy.checkA11y(null, {
runOnly: { type: "tag", values: ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa"] },
})
})
})Component tests with jest-axe
import { render } from "@testing-library/react"
import { axe, toHaveNoViolations } from "jest-axe"
import { SignupForm } from "./SignupForm"
expect.extend(toHaveNoViolations)
it("SignupForm has no detectable violations", async () => {
const { container } = render(<SignupForm />)
expect(await axe(container)).toHaveNoViolations()
})jest-axe needs the jsdom test environment. Because jsdom does not render, colour contrast checks are off; cover contrast in browser tests or with the contrast checker during design.
Pa11y CI for URL lists
// .pa11yci
{
"defaults": {
"standard": "WCAG2AA",
"runners": ["axe", "htmlcs"],
"timeout": 30000
},
"urls": [
"http://localhost:3000/",
"http://localhost:3000/pricing",
"http://localhost:3000/contact"
]
}npx pa11y-ciRunning both runners catches a few more issues than either alone. Pa11y CI exits with a non-zero code when any URL has errors, which fails the job. Point it at a sitemap with --sitemap for broader coverage.
Lighthouse CI
// lighthouserc.js
module.exports = {
ci: {
collect: { url: ["http://localhost:3000/"], startServerCommand: "npm run start" },
assert: {
assertions: {
"categories:accessibility": ["error", { minScore: 0.95 }],
},
},
upload: { target: "temporary-public-storage" },
},
}Lighthouse runs only a subset of axe rules and turns them into a score. A score of 100 means those rules passed, not that the page is accessible. Use it as a trend line alongside axe, not instead of it.
A GitHub Actions workflow
# .github/workflows/accessibility.yml
name: Accessibility
on: [pull_request]
jobs:
a11y:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm ci
- run: npx playwright install --with-deps chromium
- run: npm run build
- run: npx playwright test tests/a11y.spec.ts
- uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-report
path: playwright-reportConfigure Playwright’s webServer option to start your app, or swap the last steps for npx pa11y-ci or npx @lhci/cli autorun. The same commands work in GitLab CI, Azure Pipelines or Jenkins.
Rolling it out without blocking everyone
- Report only for the first week or two. Publish the violations as an artifact.
- Fix or baseline what exists. axe lets you disable a rule for a known, ticketed issue with
.disableRules([...]); keep that list short and dated. - Fail on new violations in A and AA rules for the pages each change touches.
- Add interaction states: open menus, dialogs, error states and dark mode, because many failures only exist after an interaction.
- Review the gate each quarter as axe adds rules.
What automation will not catch
Deque’s 2021 study found automated axe testing covered 57% of issues by volume across more than 2,000 audits, but those issues sat under only 16 of 50 success criteria. A green pipeline still needs people to check:
- Keyboard operation and focus management in custom widgets.
- Whether alt text, labels and headings are meaningful, not just present.
- Screen reader announcements for dynamic updates.
- Reflow at 400% zoom, captions, and anything in video or PDF.
Our guide to automated vs manual testing shows how to split the work, and the WCAG 2.2 checklist covers the manual criteria.
Frequently Asked Questions
What is the best accessibility testing tool for CI/CD?
For most teams, axe-core run inside the end-to-end tests you already have: @axe-core/playwright for Playwright or cypress-axe for Cypress. It is free, open source, has few false positives and fails a build with a normal test assertion. If you have no browser tests, Pa11y CI scans a list of URLs with one config file, and Lighthouse CI is useful when you also want performance budgets.
How much of WCAG can automated tests catch?
A minority of criteria, but a large share of the issues on a typical page. Deque's 2021 study of over 2,000 audits found axe fully covered 57% of issues by volume, yet those issues fell under only 16 of 50 success criteria. Keyboard operation, focus order, meaningful alt text and most content questions still need people.
Should accessibility failures block a merge?
Yes, for violations of WCAG A and AA rules on the pages a change touches, once you have cleared the existing backlog. A common rollout is to report only for a sprint, fix or baseline the existing issues, then fail the build on any new violation.
Is there an official GitHub Action for axe?
Deque publishes dequelabs/axe-linter-action, which lints changed files in pull requests and needs an axe Linter API key. For page-level tests, run axe through Playwright or Cypress in an ordinary workflow step, or run Pa11y CI or Lighthouse CI as a step. Lighthouse CI documents an official workflow; Pa11y has no official action.
Does jest-axe test color contrast?
No. jest-axe runs in jsdom, which does not render pages, so color contrast checks are turned off. Use it for component markup and run contrast checks in a real browser with Playwright or Cypress.