-
Notifications
You must be signed in to change notification settings - Fork 3
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
MCR-3080: bring back a11y tests in ci #2715
Conversation
ee5389e
to
1014ee0
Compare
…s-in-ci' into jl-mcr-3080-bring-back-a11y-tests-in-ci # Conflicts: # services/cypress/package.json
…s-in-ci' into jl-mcr-3080-bring-back-a11y-tests-in-ci
@@ -71,6 +71,8 @@ | |||
"devDependencies": { | |||
"c8": "^10.1.2", | |||
"cypress": "^13.13.2", | |||
"axe-core": "^4.10.0", | |||
"cypress-axe": "^1.5.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mojotalantikite I added these two dependencies here too. Correct me if things changed but, I did this because Cypress in CI runs from root and on local is runs from services/cypress
without this here CI could not find the dependencies. A lot has changed since so is there a better, but simple, way to not have to install in both places?
I could do some configuration in each test to point to the location of the install based on deployment, but if installing the deps in both doesn't cost or complicate much would this be ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mojotalantikite @JasonLin0991 imo this is also a good time to consider if cypress should be moved considering the new world we are. Throwing it out there, not trying to suggest moving the entire folder is needed ...just want us to think expansively since we are also doing a lot around modularizing and simplifying our top level architecture right now so maybe we are seeing another opportunity here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is totally fine. I personally think it's clearer to declare the dependencies in each service's package.json
that needs them. Back with Yarn 1 everything got hoisted and when we moved to pnpm it started complaining about missing packages, as it was easy to just ignore the dependency if it was already installed elsewhere with Yarn.
Plus with pnpm everything is symlinked around, so it's not actually going to install it in two places, it's just going to throw in a symlink from the global package store to each service's node_modules
that declares it.
@@ -63,3 +78,6 @@ Together these tools include linting, testing, and auditing loaded web pages for | |||
[axe-core-cli]: https://www.npmjs.com/package/@axe-core/cli | |||
[cypress-audit]: https://github.com/mfrachet/cypress-audit | |||
[lighthouse-ci]: https://github.com/GoogleChrome/lighthouse-ci |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ADRs aren't supposed to be edited in hindsight. They are meant to be a point in time record.
So what you do here - this would be a new ADR to update frontend a11y toolset to use cypress-axe
and then you also edit ADR 005 to say for the pa11y decision - superseded by ADR 00XXX. Theres already an example of this with protobufs where ADR 024 supercedes ADR 009.
@@ -19,7 +19,7 @@ Together these tools include linting, testing, and auditing loaded web pages for | |||
|
|||
[eslint jsx-a11y][eslint-a11y] Provides React-friendly code linting which allows developers to find accessibility issues during local development. | |||
|
|||
[pa11y][pa11y] and [pa11y-ci][pa11y-ci] - Accessibility test runner for end to end testing in the command line or Node.js. End to end testing can catch concerns that are not noticeable in linting or unit tests since tests run on browser. | |||
[cypress-axe][cypress-axe] and [axe-core][axe-copre] - Accessibility test runner for end to end testing in the command line or Node.js. End to end testing can catch concerns that are not noticeable in linting or unit tests since tests run on browser. Our previous choice [pa11y][pa11y] seems to not be maintained anymore and no longer works with our end to end testing. | |||
|
|||
[jest-axe][jest-axe] - This tool provides additional jest matchers, like `.toHaveNoViolations`, to use in unit tests. This may be redundant when end to end accessibility testing is present. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also a request - could you please also clarify that jest-axe
is removed from our tool set? Reason is we aren't using it and it was removed from package.json I think awhile ago so its not in use.
cy.deprecatedNavigateV1Form('CONTINUE') | ||
cy.deprecatedNavigateV1Form('CONTINUE') | ||
cy.fillOutContractActionAndRateCertification() | ||
cy.deprecatedNavigateV1Form('CONTINUE_FROM_START_NEW') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought Pearl merged her work and start, submission and contract details are are all on v2. I think this could be using the v2 helpers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a v2 of fillOutContractActionAndRateCertification
. I do see startNewContractOnlySubmissionWithBaseContractV2
, but the purpose of the code here is to:
- check a11y violations on the empty form with field errors
- fill out the form and continue so that we have a submission to go to each form page.
Using startNewContractOnlySubmissionWithBaseContractV2
would fill this out and continue before we could check for a11y violations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at navigateContractAndRatesForm
and navigateContractForm
- I was looking at the navigate command. We don't want to be use the deprecated commands anymore at all we should be removing them.
That's fine to use fillOUtContractActionAndRateCertification
agree we aren't done with the whole form yet
cy.checkA11y('', { | ||
runOnly: { | ||
type: 'tag', | ||
values: ['wcag22aa'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is working - I added basic accessibility violations (like an image missing alt text, a button with no text content) and there were no errors. When I change this value I start to get errors again. I think it is not working for some version saw a github issue or two as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm seeing best-practice
work lets just use that if you agree that 22aa is broken and so is wcagaa right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make visible our conversation. Rules for each standard are not cumulative. So in order to test all rules, all the standards must be included. If we only include 'wcag22aa'
then only the specific rules added in for that standard will be tested.
The configuration has been updated to include the complete rules
cy.checkA11y('', {
runOnly: {
type: 'tag',
values: ['wcag2a','wcag2aa', 'wcag21a', 'wcag21aa','wcag22aa']
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @JasonLin0991 and @haworku , Even in this above eg:
cy.checkA11y('', {
runOnly: {
type: 'tag',
values: ['wcag2a','wcag2aa', 'wcag21a', 'wcag21aa','wcag22aa']
No violations are getting shown for wcag21a and wcag22aa.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sethims I followed the axe-core
docs under axe.run() to figure out that the tags need to be combined. You can look through the rule of each standard using axe.getRules(). Compare the rules from getRules
with the specific rule violations you are testing for. That should help with debugging. Good luck!
Summary
MCR-3080
pa11y
pluginpa11y
to work again.cypress-axe
andaxe-core
to run our a11y tests.'has no a11y violations on submission form with form input errors'
'has no a11y violations on CMS dashboards'
protobufjs
frompackage.json
inservices/cypress
The a11y logs for violations could be better. Rather than including it into this ticket I have a new one to improve the logs.
https://jiraent.cms.gov/browse/MCR-4416
These are two more tickets that add more a11y testing to other parts of the app that I think could really use it. They are not completely filled out and could use some refinement.
https://jiraent.cms.gov/browse/MCR-4417
https://jiraent.cms.gov/browse/MCR-4418
There are three violations with the accessibility testing. So to not increase the scope of this ticket, I made two tickets to address the violations
https://jiraent.cms.gov/browse/MCR-4420
https://jiraent.cms.gov/browse/MCR-4421
Related issues
Screenshots
Test cases covered
acccessibility.spec.ts
'has no a11y violations on submission form with form input errors'
'has no a11y violations on CMS dashboards'
QA guidance