Skip to content

SYSTEM Cited by 1 source

axe-core/playwright

@axe-core/playwright is Deque Systems' official binding from Axe Core into Playwright. It ships as an npm package that exposes an AxeBuilder class: a chainable builder that attaches an Axe audit to a Playwright Page.

Surface

The builder API:

import AxeBuilder from '@axe-core/playwright';

const results = await new AxeBuilder({ page })
  .withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'])
  .exclude('.known-accessibility-issue')
  .exclude('.design-exception')
  .analyze();

// results.violations: Violation[]
// results.passes, results.incomplete, results.inapplicable
  • .withTags([...]) — picks the rule-set by tag (see wcag-2-1-a-aa-scope).
  • .exclude(selector) — omits matched elements from the audit. The primary extension point for two-axis exclusion lists.
  • .include(selector) — restricts audit scope to matched elements (inverse of exclude).
  • .disableRules([...]) / .options({...}) — rule-level and option-level overrides.
  • .analyze() — runs the audit against the current page state; returns the Axe results object.

Integration model

@axe-core/playwright does not bake Axe into Playwright's interaction primitives (clicks, fills, navigations). It is a pull-model audit: the caller invokes .analyze() at a chosen point in the test flow, typically after a view has rendered. This is the load-bearing shape for fixture- extension integrations — the binding gives you a plain function you can wrap in a helper method on a custom Playwright fixture.

Seen in

  • sources/2025-01-07-slack-automated-accessibility-testing-at-slack — Slack's production integration. Wrapped in a runAxeAndSaveViolations() helper on the custom slack fixture's utils.a11y namespace. Builder configured with the WCAG 2.1 A+AA tag set and pre-populated .exclude() calls for Slack's known- issue-plus-out-of-scope selector list. Results filtered to critical impact only at launch.
  • systems/axe-core — the underlying rule engine.
  • systems/playwright — the test framework this binding targets.
  • a11y-checks-via-playwright-fixture-extension — canonical integration pattern using this binding.
  • exclusion-list-for-known-issues-and-out-of-scope-rules — canonical usage pattern for .exclude().
  • wcag-2-1-a-aa-scope — canonical tag-set usage.
Last updated · 766 distilled / 2,225 read