cy.origin throws Uncaught error & breaks in v10.9.0+
See original GitHub issueCurrent behavior
Our application redirects on load to an Auth0 login page and signs in the user. We updated from v10.7.0 to v10.10.0 and immediately ran into failing origin usage with the below stacktrace:
Uncaught Error: on only accepts instances of Function
at ../driver/node_modules/eventemitter2/lib/eventemitter2.js.EventEmitter._on (xml.js:30:2)
at ../driver/node_modules/eventemitter2/lib/eventemitter2.js.EventEmitter.on (xml.js:30:2)
at attachToWindow (xml.js:30:2)
at SpecBridgeCommunicator.<anonymous> (xml.js:30:2)
at SpecBridgeCommunicator.emit (xml.js:30:2)
at SpecBridgeCommunicator.onMessage (xml.js:30:2)
at xml.js:30:2
This error appears to stop the login from working properly, as it fails to find the password field despite it being readily available on the DOM:
Desired behavior
cy.origin
works successfully.
Test code to reproduce
I’m working on a reproduction, but I’ve discovered that the login works fine whilst running on localhost and only breaks when pointed at our cloud environment. The code being used is very simple & worked on previous versions:
cy.origin(Cypress.env('AUTH0_DOMAIN'), { args }, ({ email, password }) => {
cy.get('#username').type(email);
cy.get('button')
.contains(/^Continue$/)
.click();
cy.get('#password').type(password);
cy.get('button').contains('Continue').click();
});
There’s also another user running this problem here: https://github.com/cypress-io/cypress/issues/21201#issuecomment-1277427102
Cypress Version
10.10.0
Node version
v16.17.0
Operating System
Windows 11 22H2
Debug Logs
No response
Other
No response
Issue Analytics
- State:
- Created a year ago
- Comments:14 (10 by maintainers)
Top GitHub Comments
@mschile I’ve been able to reproduce this against auth0’s lab environment which uses a custom domain. Updating to 10.11.0 fixed the error being thrown (maybe it’s being caught internally?) but the origin is still not working:
https://github.com/Hawxy/auth0-cypress-reproduction
npm i
&npx cypress open
.@Hawxy, thanks a lot for taking the time to create a reproduction! I’m hoping to get some time today to take a look at it.