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

TypeError : Cannot read properties of undefined (reading 'run') #162

Open
Harvo09 opened this issue Jul 13, 2023 · 3 comments
Open

TypeError : Cannot read properties of undefined (reading 'run') #162

Harvo09 opened this issue Jul 13, 2023 · 3 comments

Comments

@Harvo09
Copy link

Harvo09 commented Jul 13, 2023

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

image
image

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

@Radhey2040
Copy link

I'm getting the same error while running my tests too !

@cqc-dave
Copy link

cqc-dave commented Sep 8, 2023

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.

@artipsingh
Copy link

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();
});
});

Screenshot 2023-10-18 at 2 20 31 PM

Screenshot 2023-10-18 at 2 21 26 PM

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