doc/development/fe_guide/accessibility/storybook_tests.md
We use Storybook test-runner with axe-playwright to automatically test Vue components for accessibility violations.
This approach allows us to test components in isolation and catch accessibility issues early in the development process.
Before running Storybook accessibility tests, ensure you have:
yarn install). This needs to be done inside the storybook directory (cd storybook)playwright with yarn playwright install chromium (or yarn playwright install to install all browser engines)To run automated accessibility tests for Vue components:
First, start the Storybook development server. You have two options:
# Option 1: Start Storybook with fresh fixtures
yarn storybook:start
# Option 2: Start Storybook without updating fixtures (faster for subsequent runs)
yarn storybook:start:skip-fixtures-update
Important: Keep the Storybook server running throughout your testing session. The Storybook needs to be built and accessible for the tests to run properly.
In a separate terminal, from the root directory of the GitLab project, run:
yarn storybook:dev:test
This command will:
The test runner will output:
The complete output of the test run can be found in storybook/tmp/storybook-results.json file.
Consider integrating Storybook accessibility testing into your development process:
These tests will also run in CI, whenever you edit either *.vue or *.stories.js file.
You can find them in storybook-test job, under test-frontend pipeline.
If tests fail to run:
yarn install to ensure all packages are installedaccessibility and accessibility severity label, for example accessibility:critical.
Test output will specify the severity for you.