Check accessibility

Command value: assertAccessibility

Scans the current page with axe-core and fails on WCAG violations at or above the chosen level.

Fields

FieldJSON propertyDescription
Accessibility Levelvaluecritical: fails on critical issues; serious_critical: fails on serious or critical issues; moderate_serious_critical: fails on moderate, serious or critical issues; all: fails on any violation.

Usage

  • Add it after each meaningful page state, for example after a dialog opens.
  • Start with critical and tighten the level as issues are fixed. If no level is set, any violation fails the step.
  • Failing violations are listed in the run console logs.

Example step (JSON)

{
  "command": "assertAccessibility",
  "value": "serious_critical"
}

Playwright equivalent

const results = await new AxeBuilder({ page }).analyze();
const failing = results.violations.filter((v) => ['critical', 'serious'].includes(v.impact ?? ''));
expect(failing).toEqual([]);

Common options

  • Make this step optional (Continue on failure): when checked, a failure in this step is recorded and the test continues with the next step.
  • Execute step when JavaScript returns true: runs the step only when the JavaScript condition returns true. Otherwise the step is skipped.

See conditional steps and variables for details.