Closed Pomax closed 4 years ago
I encountered this same problem recently. I found that the cy.checka11y
can take a violations callback and that Cyrpress will output any thrown
exception.
cy.checka11y(null, null, violations => {
// format violations
// manually throw violations
})
Yup, you'll want to use the callback here. Defining those tasks registers them with Cypress, but using them requires that you call them with cy.task
in the callback.
There is an example that was recently added to the readme here: https://github.com/avanslaars/cypress-axe#in-your-spec-file
Seems like this is resolved with @austinezell's comment. I'm going to close this issue.
I'd strongly encourage you to reopen this, and only close it after adding a bit to the README that explains how to do this, because this is going to trip up a lot of folks who aren't in the habit of filing issues, and they won't find this information in a closed issue, because of SEO on the part of Google and friends.
Docs are the first port of call =)
There are instructions for this in the readme, right here: Using The Violation Callback
If you feel they could be improved, feel free to submit a PR
fair enough
I'm using cypress-axe to do some accessibility testing, but the errors I'm getting are not clear enough for me to act on... Is there a way to get more detailed information here?
The test code is just a
checka11y()
call:And I updated cypress'
/plugins/index.js
to include the task logging:But I don't see anything in the console that lets me figure out what is actually failing and how to fix it =S