cypress-axe icon indicating copy to clipboard operation
cypress-axe copied to clipboard

Add severity levels to fail on

Open roc opened this issue 3 years ago • 0 comments

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);
    });

roc avatar Jul 28 '22 14:07 roc