UserWay Continuous-Accessibility integrates into your GitHub workflow through a custom CLI docker image. The main purpose of the image is to collect accessibility reports generated during e2e tests execution and to trigger analysis via Continuous-Accessibility API.
1. Add a environment variable
In GitLab Project, go to Settings > CI/CD > Variables and add the following variable
For the Key field, enter USERWAY_TOKEN
For the Value field, paste project token found on your Continuous-Accessibility project settings page.
Make sure that the Protect variable checkbox is unticked
Make sure that the Mask variable checkbox is ticked
2. Install @userway/cicd-cli npm package
Install the @userway/cicd-cli package in the root of your website project. This package is a command line interface tool but it provides Typescript types for your convenience during editing of configuration files. Installing of this package will allow you to trigger a11y analysis from your local dev machine, not only from GitHub pipeline environment.
npm install --save-dev @userway/cicd-cli
For more information about @userway/cicd-cli package refer to the npm package documentation (opens in a new tab)
3. Create file userway.config.ts
Project metadata, including the location of the reports to be analyzed, must be declared in the file userway.config.js (or userway.config.ts) in the the root of your project
import type { Config } from '@userway/cicd-core'
export default {
organization: 'your-organization-slug-name',
project: 'your-project-name',
token: process.env.USERWAY_TOKEN,
reportPaths: ['./uw-a11y-reports'],
} satisfies Config
4. Update you .gitlab-ci.yml
5. Verify configuration
It is always a good idea to validate changes made in the steps above before committing them into repository. In order to verify if your GitHub action configuration is correct - there are are few steps which can be performed on local developer environment:
- Make all necessary changes described above
- Run e2e tests locally (this section)
- Run command in terminal
export USERWAY_TOKEN=YOUR-PROJECT-TOKEN
npx userway
For more information about troubleshooting of your GitHub build configuration refer to the documentation
Prerequisites
- Node.js v18.19.0 or higher is required