0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-28 18:26:15 +01:00
posthog/cypress/support/accessibility.js
Paul D'Ambra 36622515f1
fix: home accessibility (#11211)
* feat: test a11y with Cypress

* axe test more pages

* archive a11y violations on success too

* remove date from file path

* don't warn if no accessibility files to upload... they're not on all test jobs

* support switching accessibility tests to failing

* support aria label on lemon buttons

* add story book axe add-on

* Defuckulate the tests

* oops

* can't stop skipping a11y failures for home just yet
2022-08-09 20:01:58 +01:00

18 lines
465 B
JavaScript

export const reportA11y = (options, tag, skipFailures = true) => {
if (typeof tag !== undefined) {
tag += '-'
}
// reports on A11y failures without failing the tests
cy.checkA11y(
null,
options,
(violations) => {
cy.log(`${violations.length} violation(s) detected`)
cy.writeFile(`a11y/${tag}accessibility-violations.json`, JSON.stringify(violations))
},
skipFailures
)
}