Open chrisbreiding opened 2 years ago
Im trying to use cy.origin() to log in through auth0 (which works) but then I need to nest another cy.origin() to sign in with google in Auth0. Im getting this error
We have a similar use case where we need to go through a couple of origins before redirecting back to the the test domain. We saw the same warning as @davidmastreamline
workaround for nested origins/domains
cy.visit('http://domain1.com/')
cy.get('a').click() // takes you to domain2.com
cy.origin('domain2.com' () => {
cy.get('a').click() // takes you to domain3.com
})
cy.origin('domain3.com', () => {
cy.get('[data-cy="username"]').type('myusername')
cy.get('[data-cy="login"]').click() // takes you back to domain1.com
})
cy.get('h1').invoke('text').should('equal', 'Welcome, myusername!')
@modern-sapien This solution works perfectly and allows multi-domain login flow to be implemented finally! Thank you!
@AleksiUu, don't thank me, I stole this from @mjhenkes.
@modern-sapien I am trying to use the recommended steps above, but for some strange reason when I want to login to office 365 online, after the second domain my page doesn't load and I have a blank screen. If you have any ideas on how to work this out, I would appreciate it 🤩
it.only('microsoft login', () => {
cy.visit('https://www.office.com/')
cy.get('#hero-banner-sign-in-to-office-365-link').click()
cy.origin('https://login.microsoftonline.com', () => {
cy.get('#i0116').type('email')
cy.get('#idSIButton9').click()
})
//after the last click the page is never loaded therefore we cannot continue with the password
cy.origin('https://login.live.com', () => {
cy.get('#i0118').type('password')
cy.get('#idSIButton9').click()
})
})
do you have any update on this issue because I encounter the same issue even after trying the work around?
cy.origin('https://login.abc.com', () => {
cy.visit('https://auth.xyz.ca');
cy.get('#username').type(this.username);
cy.get('#password').type(this.password);
cy.get('#signIn').click();
});
cy.origin('https://auth.xyz.ca', () => {
cy.get('body');
cy.pause();
});
cy.pause();
cy.origin('https://auth.xyz.ca')
because it could not pass the token back to redirect back this url 'https://auth.xyz.ca'
'https://auth.xyz.ca'
'https://login.abc.com'
'https://auth.xyz.ca'
Adding another bump for this issue. We are facing the exact scenario described in the original comment when trying to login via SSO.
@jelena9412
re: office 365 online More than likely there is an issue here with browser busting / automation blocking, but I am unsure. There are some sites that make traversal more difficult.
Especially big corporate websites, I would check their specific documentation for how test automation should be handled for their services if you have built your application to rely on it.
@cupcakepanda89
How are you handling passing the token? How are you handling the redirect? Are you opening another origin? or travelling back to the initial page?
Cypress has a pretty active and huge community in Discord. You may find more assistance there versis GitHub issues.
Another up vote. I have a scenario where SSO happens on one origin but redirects to a second origin for users in a specific group. My application doesn't have direct access to the second authenticator and must be handed off through the first.
Add support for nested multi-domain commands, for cases where you visit multiple domains in a row before ending up back on the test's primary domain.