component-driven / cypress-axe

Test accessibility with axe-core in Cypress
MIT License
622 stars 86 forks source link

cy.checkA11y() is accepting only 2 arguments I need to set skipFailures to 'True' #39

Open Pawanesh1 opened 4 years ago

Pawanesh1 commented 4 years ago

I need to disables assertions based on violations and only logs violations to a report, so was trying to pass 4 arguments to cy.checka11y() as described by @avanslaars , but got an error

0-2 arguments expected, got 4

package.json "devDependencies": { "@type/cypress-axe":"0.4.0" "cypress-axe": "^0.8.1" }

https://github.com/avanslaars/cypress-axe

avanslaars commented 4 years ago

I would need some context to see where the error is coming from and what your actual test code looks like. Currently, cy.checkA11y() accepts 4 arguments, with skipFailures being the last. If you want to provide some code and more information about where you see that error, maybe we can get that sorted out.

https://github.com/avanslaars/cypress-axe/blob/master/src/index.js#L17-L21

Pawanesh1 commented 4 years ago

@avanslaars The problem starts with initial setup I suppose. My cy.injectAxe() and cy.checka11y() commands are not recognized. Here is what I did

  1. I already had cypress in installed - "cypress": "^4.1.0"
  2. I ran the command npm i -D cypress-axe 3 added import 'cypress-axe' to Cypress/support/index.js file
  3. update tests to include cy.injectAxe() in beforeall, after cy.visit() but it gave me error : "Property 'injectAxe' does not exist on type 'cy & EventEmmitter' " Then I ran the command: npm i @types/cypress-axe and the error was resolved, but now cy.checkA11y() accepts only 2 arguments.
vasanthkumar258 commented 4 years ago

@Pawanesh1.. see that @types file is having latest version "@types/cypress-axe": "^0.8.0" and cypress-axe: "^0.8.1"

sapegin commented 4 years ago

Do you still have this problem?