Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds pa11y-ci #881

Merged
merged 4 commits into from
Jun 3, 2022
Merged

Adds pa11y-ci #881

merged 4 commits into from
Jun 3, 2022

Conversation

coreymcollins
Copy link
Contributor

@coreymcollins coreymcollins commented Jun 3, 2022

DESCRIPTION

This adds pa11y-ci with some scripts to run pa11y on various environments to test for accessibility.

pa11y-ci uses pa11y to run its tests; by default it runs WCAG2AA which is actually WCAG 2.1 AA according to the comment in this pull request.

With this update, we're adding a new set of config variables to our package file:

"config": {
	"local": "https://wdunderscores.test/",
	"staging": "https://wdunderscores.test/",
	"prod": "https://wdunderscores.test/"
},

Obviously, these would be updated for each project but I wanted to have them set in place at the onset so it's an easy path to replacement.

This also includes adding new scripts to utilize those config variables:

"a11y:local": "pa11y-ci --sitemap $npm_package_config_local/sitemap.xml",
"a11y:prod": "pa11y-ci --sitemap $npm_package_config_prod/sitemap.xml",
"a11y:staging": "pa11y-ci --sitemap $npm_package_config_staging/sitemap.xml",

pa11y itself runs a test on a single page. pa11y-ci adds the ability to run a test on a sitemap. As WordPress should be creating a sitemap by default, we can assume that each of the environment URLs will have a sitemap generated. You shouldn't have to change these scripts at all since they pull from the variables, but you may need to add more config variables and more scripts if you have additional environments.

This also includes an update to our sync function to replace the hardcoded URL with a variable so you don't need to worry about replacing URLs in multiple places:

"sync": "browser-sync start --https --proxy $npm_package_config_local --no-open --files 'build/*.*, **/*.html, **/*.php, !node_modules/**/*.html'",

OTHER

  • Is this issue accessible? (Section 508/WCAG 2.0AA)
  • Does this issue pass all the linting? (PHPCS, ESLint, SassLint)
  • Does this pass CBT?

STEPS TO VERIFY

  1. Check out the branch
  2. npm i --legacy-peer-deps
  3. Run npm run a11y:local
  4. Feel free to change the config variables to other live sites if you want to test that out and make sure that the proper URLs are being used for the different scripts.

Right now, the results are just dumping into the command line.

There are additional ways to output results, like as JSON or HTML. We could discuss whether or not we'd want to add that for this now, or see if it's something we'd want to add down the road if it would add value. I haven't been able to really figure out how to get this to work for HTML, but I can dump JSON results to the console. Maybe we could use this as a way to parse JSON and automate the creation of Jira tickets for projects?

DOCUMENTATION

Will this pull request require updating the wd_s wiki?

For sure! If approved, we'll add a new page to the wiki to outline the setup and use of this.

Copy link
Contributor

@oliverharrison oliverharrison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done!

@coreymcollins coreymcollins merged commit 7ab3432 into main Jun 3, 2022
@coreymcollins coreymcollins deleted the feature/pa11y-integration branch June 3, 2022 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants