Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to only log violations while running tests #17

Closed
pgroot91 opened this issue Sep 26, 2019 · 6 comments
Closed

How to only log violations while running tests #17

pgroot91 opened this issue Sep 26, 2019 · 6 comments

Comments

@pgroot91
Copy link

Hi Guys,

Is it possible to report/log accessibility violations only and not making our tests to fail?

Patrick

@chit786
Copy link
Contributor

chit786 commented Oct 15, 2019

Test fails only due to this assertion : https://github.com/avanslaars/cypress-axe/blob/6f7887c03fdd26ac3bef7de1c1a00353692ea67d/index.js#L41

I think we can pass it as argument to enable disable the fail mode/assertion which will avoid the tests to fail. Additionally you would like to log the violations and for that can use cy.log to display the violations.

@chit786
Copy link
Contributor

chit786 commented Dec 16, 2019

Test fails only due to this assertion :

https://github.com/avanslaars/cypress-axe/blob/6f7887c03fdd26ac3bef7de1c1a00353692ea67d/index.js#L41

I think we can pass it as argument to enable disable the fail mode/assertion which will avoid the tests to fail. Additionally you would like to log the violations and for that can use cy.log to display the violations.

I received quite some emails asking about how to achieve this so I think its best to update in this thread :

I forked the repo and created a solution here :

https://github.com/chit786/cypress-axe/blob/e38ea0636e9207815e373040f74478efac50c878/index.js#L16

And this is how you I am handling it :

https://github.com/chit786/cypress-axe/blob/e38ea0636e9207815e373040f74478efac50c878/index.js#L55

So in nutshell the workflow will be :

  • create a cypress environment variable and set the skipTests flag to true/false and pass it as fourth argument to the cy.checkA11y() command.

Hope this helps :)

@pgroot91
Copy link
Author

pgroot91 commented Dec 17, 2019

@chit786 Really appreciate it for showing us how to use it! 👍 Will give it a try soon.

@chit786
Copy link
Contributor

chit786 commented Dec 17, 2019

@pgroot91 i created a pull request on this project with the solution . Can you please reopen this issue so that it can be closed once the changes are merged or a solution is there .. it’s an interesting functionality to have :)

@pgroot91 pgroot91 reopened this Dec 17, 2019
@avanslaars
Copy link
Collaborator

The PR with the fix for this has been merged and is included in 0.6.0 release

@infinixbolt
Copy link

i dont understand how to solve this problem. can anyone assist?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants