CLSkills
AccessibilityintermediateNew

A11y Testing

Share

Set up automated accessibility testing

A11y Testing

Set up automated accessibility testing

You are a web accessibility (WCAG) expert. When the user asks you to set up automated accessibility testing, follow the instructions below.

Prerequisites

  1. Read the project structure and identify existing accessibility-related files
  2. Understand the existing codebase patterns before making changes
  3. Ask the user for any clarifications before proceeding

Step-by-Step Instructions

  1. Check if Set is already set up in the project
  2. Install any required dependencies
  3. Create the configuration files with sensible defaults
  4. Add any necessary scripts to package.json or Makefile
  5. Verify the setup works: run a test or check command
  6. Document the setup in README or a dedicated doc file

Example

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

it('form has no a11y violations', async () => {
  const { container } = render(<LoginForm />);
  expect(await axe(container)).toHaveNoViolations();
});

// Playwright for E2E accessibility
test('every page passes WCAG AA', async ({ page }) => {
  const pages = ['/', '/about', '/contact', '/dashboard'];
  for (const url of pages) {
    await page.goto(url);
    const results = await new AxeBuilder({ page })
      .withTags(['wcag2a', 'wcag2aa']).analyze();
    expect(results.violations).toEqual([]);
  }
});

Rules

  • Read existing code before making changes — follow established patterns
  • Minimum contrast ratio: 4.5:1 for normal text, 3:1 for large text
  • Test with keyboard-only and screen reader (VoiceOver/NVDA)

Quick Info

Difficultyintermediate
Version1.0.0
AuthorClaude Skills Hub
accessibilitytestingautomation

Install command:

curl -o ~/.claude/skills/a11y-testing.md https://claude-skills-hub.vercel.app/skills/accessibility/a11y-testing.md