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

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

Open Pawanesh1 opened this issue 5 years ago • 4 comments

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

Pawanesh1 avatar May 06 '20 22:05 Pawanesh1

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

avanslaars avatar May 07 '20 18:05 avanslaars

@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.

Pawanesh1 avatar May 07 '20 20:05 Pawanesh1

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

vasanthkumar258 avatar Jun 28 '20 15:06 vasanthkumar258

Do you still have this problem?

sapegin avatar Oct 26 '20 18:10 sapegin