cypress-axe: Weird error after initial setup
cy.readFile() must be passed a non-empty string as its 1st argument. You passed: 146.Learn more
This happens after finishing setup and trying to run a sample test.
This is in my command that I use to login:
.then((url) => {
cy.intercept('api/users/user/profile/').as('login');
cy.visit(url);
cy.wait('@login');
cy.injectAxe();
}),
Error happens on the cy.injectAxe()
line.
Thanks!
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (3 by maintainers)
I was able to work around this by creating my own
injectAxe
method in my tests.Then instead of calling
cy.injectAxe()
, I call my own method to inject the script.Yes, this issue still exists with the latest version, we tried calling our own method to inject the script.
const injectAxe = () => {
cy.readFile(‘…/…/node_modules/axe-core/axe.min.js’).then((source) => { return cy.window({ log: false }).then((window) => { window.eval(source); }); }); };
This issue is not resolved when using cypress-axe 0.13.0 and axe-core 4.3.5
When I’m seeing this I’m even wondering if this is still being maintained?
@craig-dae Did you fix the issue? I have the same problem and any workarounds don’t work for me.