-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Enterprise Search] Set up cypress-axe tests #108465
Conversation
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.
Misc comments. Excited to get this set up so we can add more axe checks to our app and potentially close out #79359!
|
||
import { ReporterVersion } from 'axe-core'; | ||
|
||
export const AXE_CONFIG = { |
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.
@myasonik Let me know if you're cool with this setup (constants.ts
file and all capitalized CONSTANTS vars)! If not I can definitely rename to anything that you prefer!
...earch/public/applications/enterprise_search/components/product_selector/product_selector.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/enterprise_search/public/applications/enterprise_search/index.scss
Outdated
Show resolved
Hide resolved
}, | ||
], | ||
}); | ||
window.axe.configure(config); |
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.
NB: the new AXE_CONFIG
const has to get passed as a new config
arg instead of being imported in-file, because of the way analyzeWithAxe
gets called during browser runtime by Kibana's FTR tests. Otherwise you just get a bunch of undefined errors
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.
Awesome to see! 🚀
Can we document this somewhere in the codebase? Maybe a |
Hey constance, could you make a branch for me with an axe error? I'm having trouble generating one, I tried messing around with bad |
@byronhulcher Interesting, it's possible that the new axe config settings we imported from the Kibana a11y tests are ignoring those failures. I'll play around with it and see if we need to override anything. Also as a heads up, #108309 was reverted due to causing Typescript build issues in master with our Cypress config, so I'm moving this PR back into draft until then. I'll be speaking to Spencer/the KibanaOps team to figure out our TS issues! Thanks Michail for the approval on this before your last day; with your review I feel confident about letting this PR sit for a bit and then merging later once Typescript is no longer causing issues. |
Sorry, just saw your 1st comment also Byron (wish GitHub would let us thread non-code comments):
It's documented in our Kibana plugin README. Documentation was added in the previous Cypress setup PR: |
@byronhulcher OK, I dug into validating heading levels and it turns out the settings we were inheriting from the base Kibana setup did indeed have those violations turned off (they're tagged under With the extra config above, I added an extra branch with an example error - feel free to check it out! |
+ fix string union type error + remove unnecessary tsconfig exclude
- Mostly just re-exporting the shared command and checking for failures, I only ran this after the shared axe config settings and found no failures
- notably heading level issues (thanks Byron for catching this!) - however I now also need to set an ignore on a duplicate landmark violation caused by the global header (not sure why it's showing up - shouldn't it be out of context? bah) - remove option to pass args into checkA11y - I figure it's not super likely we'll need to override axe settings per-page (vs not running it), but we can pass it custom configs or args later if needed
OK, with #108560 merged in this should now be ready to review! @byronhulcher, I know it's ON week, but this should hopefully be a relatively small PR and I was hoping to get your eyes on it (since your comments have already helped me improve our axe config settings!) Similarly WS folks, would super appreciate a review whenever you have time so I can wrap up my last Enterprise Search PR! |
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.
LGTM. Thanks!
@elasticmachine merge upstream |
@byronhulcher @JasonStoltz 👋 Would super appreciate a quick review on this PR from either of y'all this week! |
@constancecchen I will take a look |
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
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.
Great work Constance!
Thanks y'all!! Enjoy! 🎉 |
* Set up cypress-axe @see https://github.com/component-driven/cypress-axe * DRY out Kibana axe rules into constants that Cypress can use * Create shared & configured checkA11y command + fix string union type error + remove unnecessary tsconfig exclude * Add Overview plugin a11y tests * Add AS & WS placeholder a11y checks - Mostly just re-exporting the shared command and checking for failures, I only ran this after the shared axe config settings and found no failures * Configure our axe settings further to catch best practices - notably heading level issues (thanks Byron for catching this!) - however I now also need to set an ignore on a duplicate landmark violation caused by the global header (not sure why it's showing up - shouldn't it be out of context? bah) - remove option to pass args into checkA11y - I figure it's not super likely we'll need to override axe settings per-page (vs not running it), but we can pass it custom configs or args later if needed Co-authored-by: Kibana Machine <[email protected]>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
* Set up cypress-axe @see https://github.com/component-driven/cypress-axe * DRY out Kibana axe rules into constants that Cypress can use * Create shared & configured checkA11y command + fix string union type error + remove unnecessary tsconfig exclude * Add Overview plugin a11y tests * Add AS & WS placeholder a11y checks - Mostly just re-exporting the shared command and checking for failures, I only ran this after the shared axe config settings and found no failures * Configure our axe settings further to catch best practices - notably heading level issues (thanks Byron for catching this!) - however I now also need to set an ignore on a duplicate landmark violation caused by the global header (not sure why it's showing up - shouldn't it be out of context? bah) - remove option to pass args into checkA11y - I figure it's not super likely we'll need to override axe settings per-page (vs not running it), but we can pass it custom configs or args later if needed Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Constance <[email protected]>
Summary
Follow up to #108309
What this PR does:
checkA11y()
that runs axe against our current placeholder/hello-world E2E testsWhat this PR does NOT do:
checkA11y()
tests for each product's views/routes(hoping to do this in a follow-up PR)checkA11y()
helper for future tests.As always, I recommend following along by commit.
Screencaps
In
open
mode, you should be able to inspect and see that 0 accessibility violations were detected:Screencap showing how to debug cypress-axe accessibility failures:
QA
kibana.dev.yml
, setcsp.strict: false
andcsp.warnLegacyBrowsers: false
--no-base-path
and on localhost:5601x-pack/plugins/enterprise_search/
sh cypress.sh run overview
passessh cypress.sh run as
passessh cypress.sh run ws
passesChecklist