Open Harvo09 opened 1 year ago
I'm getting the same error while running my tests too !
I was seeing a similar issue, if I had a simple test it seemed to be working fine but once I started adding a few more steps everything seemed to return this same error.
I managed to fix my issue, hopefully this helps others: according to the documentation they recommended placing the cy.injectAxe();
near the top of the code block, and then in most examples I see the cy.checkA11y();
placed near the end. Well, in a few of my tests I believe I was loading a new view or page in between the two, causing it to blow up.
My fix ended up being moving all of the cy.injectAxe();
down to directly above the cy.checkA11y();
and suddenly all of my "TypeError : Cannot read properties of undefined (reading 'run')" issues disappeared.
Not sure if this is the ultimate fix, but it worked for me.
I am also seeing something similar to this issue
Cannot read properties of undefined (reading 'run') "cypress-axe": "1.5.0", "cypress": "12.17.4", and also on "cypress": "13.13.1",
describe('check a11y', () => { it('running a11y on google', () => { cy.visit(https://www.google.com/); cy.injectAxe(); cy.checkA11y(); }); });
Visiting my homepage and running checkA11y() is working just fine. My next test selects the login button to get us to the Login page. I run checkAlly() there and get the following
The documentation says this should be fine, use Cypress to interact, then call checkA11y()
// Basic usage after interacting with the page it('Has no a11y violations after button click', () => { // Interact with the page, then check for a11y issues cy.get('button').click() cy.checkA11y() })
Any help welcome