पाठ 22 / 26

Automated testing

axe, Lighthouse, pa11y और jest-axe से accessibility issues जल्दी खोजें, और समझें कि automation क्या चूक जाता है।

लोकप्रिय उपकरण

axe DevTools: browser extension। Wave: visual feedback। Lighthouse: Chrome built-in। pa11y: CLI tool। jest-axe: React testing। Accessibility Insights: Microsoft का comprehensive tool।

jest-axe उदाहरण

अपने test suite में accessibility checks को automate करें।

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();
});

Automated testing की limitations

Tools ~30% मुद्दों को find करते हैं। Manual testing और real user testing बाकी को catch करते हैं। Automated tests को पहले pass के रूप में use करें, final verification नहीं।