Install cypress-axe
masterTo use cypress-axe for accessibility testing in Cypress, follow these steps based on your Cypress version:
For Cypress v10 and above
- Install the latest versions of
axe-core,cypress, andcypress-axe:npm install --save-dev axe-core cypress cypress-axe - Include the commands in
cypress/support/e2e.js:import 'cypress-axe'
For Cypress v9 and below
- Install
cypress-axe0.x.x and your specific Cypress version (e.g., v9.6.0):npm install --save-dev axe-core cypress@9.6.0 cypress-axe@0.14.0 - Include the commands in
cypress/support/index.js:import 'cypress-axe'
Note on Logging
It is recommended to add a Cypress task to log accessibility messages to the terminal during execution.
npm install --save-dev axe-core cypress cypress-axe