cypress-axe
cypress-axe copied to clipboard
Add severity levels to fail on
I found that the includedImpacts option was very helpful, but got me into a weird state in which I could have failures but not have the assertions logged out.
Here I've put together a rough and ready implementation of failure levels, meaning you can choose which levels of error you think are important enough to fail on per test. The way I've been using it is:
it('Fails only if the accessibility error is of serious or critical level', () => {
const failOn = ['serious', 'critical'];
cy.visit('/home');
cy.injectAxe();
cy.checkA11y(null, null, a11yLogFunction, failOn);
});