Skip to main content
InterviewHubPRO
Section Overview
Q23

Question 23 of 50

Part 2: Core Architecture & Implementation (Mid-Level)

46%
Web Accessibility & WCAG (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)

Automating Accessibility Testing in CI/CD with `axe-core` and Playwright.

senior LevelMost AskedCode ExampleTestingCI/CD & DevOpsSystem Design

In Simple Words: Automating accessibility in CI/CD combines Playwright with @axe-core/playwright to audit live DOM pages against WCAG 2.1 AA rules and fail automated pull requests on violations.

Code Example

typescript
import { test, expect } from '@playwright/test';
import AxeBuilder from '@axe-core/playwright';

test('homepage accessibility audit', async ({ page }) => {
  await page.goto('/');
  const results = await new AxeBuilder({ page })
    .withTags(['wcag2a', 'wcag2aa', 'wcag21aa', 'wcag22aa'])
    .analyze();

  expect(results.violations).toEqual([]);
});