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

Feature/rfc 75

Open mwmcode opened this issue 4 years ago • 0 comments

Trying to implement #75 (to the best of my knowledge/understanding).

I made shouldFail return array of violations instead of boolean.

shouldFail?: (violations: axe.Result[]) => axe.Result[];

Users can filter out the violations that they want to skip and only return the ones they want to assert against.

For example, I'm wrapping checkA11y to filter out color-contrast violations

Cypress.Commands.add(
  'customCheckA11y',
  { prevSubject: 'optional' },
  (subject, options, label) => {
    return cy.checkA11y({
      shouldFail: violations => violations.filter(v => v.id !== 'color-contrast')
    });
  }
);

Also

  • updated dependencies
  • upgraded cypress dependency to include v7

mwmcode avatar Apr 24 '21 03:04 mwmcode