← All projects

Featured project 13 · Accessibility and visual testing · TypeScript

Accessibility and Visual Regression Testing

Accessibility checks against WCAG 2.2 AA and pixel-exact screenshot comparisons with Playwright and TypeScript, on a small booking app that lives in the repository. A regressed build of the same app carries eight planted defects, and the suite has to catch every one of them.

Live CI status of Accessibility and Visual Regression Testing

View source code View documentation View latest CI runs View test report

Purpose

Functional tests let two kinds of bugs through: a page that keyboard, screen reader or zoom users cannot use, and a page that works but looks wrong. This project checks both automatically and proves the checks work: a suite that has only ever been green has not shown that it can fail.

Technology stack

AreaTools
LanguageTypeScript 6 on Node 24 (the app runs as TypeScript directly, no dependencies)
Accessibility@axe-core/playwright with WCAG 2.0/2.1/2.2 A + AA and best-practice rules; keyboard, focus and layout checks written for this project
VisualPlaywright toHaveScreenshot, baselines rendered only in the official Playwright Linux image, zero pixel tolerance
Tests86 Playwright tests (Chromium, Firefox, visual, planted defects) and 28 node:test unit tests
CIGitHub Actions: checks, accessibility in two browsers, visual and defects inside the Playwright image, scan summary in the job summary

Architecture overview

app/server.ts ── baseline build (port 4310) ──► a11y: axe scans · keyboard · focus · reflow   (must be clean)
      │                                     └─► visual: 21 baselines, 0 px tolerance           (must match)
      └─ --variant regressed (8 defects, port 4311) ──► defects: each defect ──► named check ──► expected finding

Key engineering decisions

Implemented features

Setup and execution

npm ci
npx playwright install chromium firefox
npm test                 :: everything; screenshots skipped outside Linux
npm run docker           :: everything inside the Playwright Linux image
npm run test:defects     :: every planted defect must be caught

Sample test results

Image mismatch reported for the planted card spacing defect
The planted spacing defect caught by the screenshot comparison: changed pixels in red (the lighter button is the planted contrast defect).

CI workflow

On every push: typecheck, lint, format and unit tests; then the accessibility suite in Chromium and Firefox, and the screenshot comparisons plus the planted-defect checks inside the Playwright image. Each job publishes the scan summary and the HTML report.

Known limitations and future improvements

Limitations

Next steps