A continuous integration service using pa11y, a web accessibility tool. It provides a script for generating accessibility statistics for all pages on a site, which is designed to run within a testing environment like Travis CI (though it can run anywhere). It then stores the results of scans in a Postgres database and produces a badge with the result that can be used as an image on any website.
Run continua11y.sh
as part of your Travis CI suite of tests.
-
Copy the script to your repo and add
after_script: ./path/to/continua11y.sh
to your.travis.yml
file. -
Set a few environmental variables:
- RUN_SCRIPT: The command for serving your site. Necessary if the server shuts down after the tests run in
script
. Make sure that the server detaches so that the script continues to run. - KILL_SCRIPT: The command to stop serving. This is optional, and more useful for local development.
- USE_SITEMAP: If your site has a
sitemap.xml
file, set totrue
to use that instead of the spider. - PORT: The port on
localhost
where your served site is found. - STANDARD: The accessibility standard used for testing. Defaults to
WCAG2AAA
, but can also beSection508
,WCAG2A
, orWCAG2AA
. - CONTINUA11Y: The location where
continua11y
is running. The main site iscontinua11y.18f.gov
, but you can change this for testing purposes or whatever.
- RUN_SCRIPT: The command for serving your site. Necessary if the server shuts down after the tests run in
npm install
node app.js # or foreman start
You may run into trouble installing the gh-badges
package. Check that project for more in-depth information.