Automated Accessibility Testing

Last modified by Vincent Massol on 2026/11/14 22:49

Axe Core validates the pages against the WCAG 2.2 AA rules. It finds about half of the accessibility issues. The other half needs manual testing.

How It Works

The validation reuses the Docker-based functional tests. When it's enabled, the constructor of each BasePage page object validates the page once it's loaded.

This covers the static interface. To also validate a dynamic state, such as an open menu or a modal, call validateWCAG() on the page object in your test once the state is displayed.

To run the validation locally, set the wcag option of @UITest, or pass -Dxwiki.test.ui.wcag=true to Maven. See the Docker test options.

Failing and Warning Rules

A violation doesn't fail the test that found it. It fails the test suite at the end, depending on the rule type:

  • Failing rule: the test suite fails, and thus the build.
  • Warning rule: the test suite passes, and a warning is logged.

The rule types are defined in WCAGContext. Once all the violations of a warning rule are fixed, make it a failing rule, so that no new violation can be added without breaking the build.

Reports

The reports are written in target/wcag-reports/, one set of files per test class:

  • wcagOverview-<TestClass>.txt: statistics about the checks. Always written.
  • wcagFails-<TestClass>.txt: violations of failing rules.
  • wcagWarnings-<TestClass>.txt: violations of warning rules.
  • wcagIncompletes-<TestClass>.txt: checks that Axe Core couldn't decide, to verify manually.

See Reading Test Reports to analyze them.

On the CI

The validation is too slow to run at each commit. It runs once a day, in the docker-latest run of the XWiki Environment Tests job, on the first configuration only: the results barely depend on the configuration. The reports are archived as build artifacts.

Vue Components

Vue components are validated with Axe Core in their unit tests. See Test the accessibility of a Vue component.

Get Connected