mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-28 18:26:15 +01:00
20 lines
527 B
TypeScript
20 lines
527 B
TypeScript
import { Options } from 'cypress-axe'
|
|
|
|
export const reportA11y = (options: Options, tag: string, skipFailures = true): void => {
|
|
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
|
|
)
|
|
}
|