Lesson 21 / 25

Automated testing

Use tools to find accessibility issues early in development.

Popular tools

axe DevTools: browser extension. Wave: visual feedback. Lighthouse: Chrome built-in. pa11y: CLI tool. jest-axe: React testing. Accessibility Insights: Microsoft's comprehensive tool.

jest-axe example

Automate accessibility checks in your test suite.

import { axe, toHaveNoViolations } from 'jest-axe';
expect.extend(toHaveNoViolations);

test('Button is accessible', async () => {
  const { container } = render(
    <button aria-label="Submit">Submit</button>
  );
  const results = await axe(container);
  expect(results).toHaveNoViolations();
});

Limitations of automated testing

Tools find ~30% of issues. Manual testing and real user testing catch the rest. Use automated tests as a first pass, not final verification.