Replies: 33 comments 71 replies
-
Thanks for this feature, I have been following it for a while. Maybe our issue is slightly different but I thought it was worth mentioning that we still have the following problem
When running outside of Cypress, everytime the user will be logged in and see the success page When running within Cypress, the user is logged out after visting the hook.stripe page. It is like, when the user submits a payment and goes to the 3rd party URL, all session data is lost. In our example, we don't take any action on the 3rd party URL, I mean, we wouldn't need to wrap an At the moment it might be quite tricky to reproduce a public facing example of the issue, but if someone wants to look closer at the issue then I am happy to chat further about it over private message. |
Beta Was this translation helpful? Give feedback.
-
@Kailash1980, opening a new thread for you. I've taken the example that you posed and updated it to how I would expect it to work. Hopefully that helps! describe("Two Domain urls in different Test case", function () {
it("Open the Url", () => {
cy.visit("https://www.cypress.io/");
});
it("Visit the url and Login to new origin", () => {
cy.visit("https://www.saucedemo.com/");
cy.wait(3000);
cy.get('[id="user-name"]').clear().type("standard_user");
cy.get('[id="password"]').clear().type("secret_sauce");
cy.get('[name="login-button"]').click();
cy.contains("Products").should("be.visible");
});
});
describe("Two Domain urls under Same different Test case", function () {
it("Open the Url", () => {
cy.visit("https://tealfeed.com/");
cy.contains("Home");
cy.origin("https://www.saucedemo.com/", () => {
+ // cy.origin does not automatically visit the origin. It sets up a cypress instance under that origin
+. // so we can communicate with pages in that origin.
+ cy.visit("https://www.saucedemo.com/")
cy.wait(2000);
cy.get('[id="user-name"]').clear().type("standard_user");
cy.get('[id="password"]').clear().type("secret_sauce");
cy.get('[name="login-button"]').click();
- cy.contains("Products").should("be.visible");
});
+ // Since this command is validating content on the 'tealfeed.com' origin,
+ // it should be placed outside of the cy.origin block for saucedemo.com
+ cy.contains("Products").should("be.visible");
});
}); |
Beta Was this translation helpful? Give feedback.
-
congrats on the release! this works correctly with the setting turned off. any thoughts on what could be causing it? |
Beta Was this translation helpful? Give feedback.
-
Experiencing an issue when redirecting to Microsoft Authentication. The test visits the baseurl which takes the user to the login page. Clicking the Login button from the login page redirects the user to Microsoft Authentication, However, the Microsoft Authentication page is displaying outside of the cypress playground and cannot be interacted with
|
Beta Was this translation helpful? Give feedback.
-
Been experimenting with this feature over the last couple days, thanks for building it! One sub-feature however for our use-case that would be vital for broader adoption is #19974. Without this we're limited to Also as a nice-to-have #20718 would be good for more complex cases accessing multiple domains. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Is there a reason why cy.session and cy.orgin were bundled together? We don't have the need to use cy.session in our suite, but we do have the need to use cy.orgin. In order to use cy.orgin we would have to implement cy.session throughout our suite. |
Beta Was this translation helpful? Give feedback.
-
I am kind of stuck in situation. I have a live chat portal in which I have different login for different users ; for agent & end user Login , there is different credentials. so asper scenarios I cannot login two different users in same browser at same time. so to fulfill my requirement I need to switch to 2 different browsers at same time with different users ; agent & end user at same time. browser 1: agent we don't need to logout the any of the users in b/w. |
Beta Was this translation helpful? Give feedback.
-
Hi All, First of all, thank you for this new feature! I'm trying to test error scenarios in Auth0. E.g User typed in incorrect user creds or the user is blocked in an Auth0 popup. I have been using "https://cypress.io/blog/2022/04/25/cypress-9-6-0-easily-test-multi-domain-workflows-with-cy-origin/" which is great for success scenarios but I am not able to test failure cases. Is this not supported? It seems to me "cy.origin" expects the button click events always redirect the user to a new page but in error cases, the user doesn't get redirected. I want to be able to confirm the error banner is present once the user clicks the button. How would I go about this? FYI: I'm using the frontend to login and not the Auth0 api. |
Beta Was this translation helpful? Give feedback.
-
Hi. The multi origin/session login is working until I try to use the baseURL. I'm finding that when using baseURL within cy.origin, the test runner just hangs. It doesn't fail or anything, it literally just sits there and looks for the element without timing out. Below example works great Cypress.Commands.add("signIn", (username, password) => {
cy.session([username, password], () => {
cy.origin('https://loginokta.domain1.com', { args: { username, password } }, ({ username, password }) => {
cy.visit('https://www.my.company.mil/group/oidc?utm_source=xxx%20public')
cy.get('#okta-signin-username').should('be.visible').type(username);
cy.get('#okta-signin-password').type(password);
cy.get('#okta-signin-submit').click();
cy.contains('Send Push').should('be.visible').click();
})
cy.origin('https://www.my.company.mil', { args: { username, password } }, ({ username, password }) => {
cy.get('.btn-primary').contains('I Agree').should('be.visible').click()
cy.contains('Welcome to MyNavy Portal').should('be.visible');
});
})
})
beforeEach(() => {
cy.signIn('username', 'password');
cy.visit('https://www.my.company.mil');
}) But the below example using baseURL hangs at the "get .btn-primary" call in the 2nd origin block Cypress.Commands.add("signIn", (username, password) => {
var url = Cypress.config('baseUrl');
cy.session([username, password], () => {
cy.origin('https://loginokta.domain1.com', { args: { username, password } }, ({ username, password }) => {
cy.visit('https://www.my.company.mil/group/oidc?utm_source=xxx%20public')
cy.get('#okta-signin-username').should('be.visible').type(username);
cy.get('#okta-signin-password').type(password);
cy.get('#okta-signin-submit').click();
cy.contains('Send Push').should('be.visible').click();
})
cy.origin(url, { args: { username, password } }, ({ username, password }) => {
//hangs trying to get this element
cy.get('.btn-primary').contains('I Agree').should('be.visible').click()
cy.contains('Welcome to MyNavy Portal').should('be.visible');
});
})
})
beforeEach(() => {
cy.signFree('username', 'password');
cy.visit('/');
}) |
Beta Was this translation helpful? Give feedback.
-
Hi. 2 questions.
Cypress.Commands.add("signIn", (username, password) => {
var url = Cypress.config('baseUrl');
cy.session([username, password], () => {
cy.origin('https://loginokta.domain1.com', { args: { username, password } }, ({ username, password }) => {
cy.visit('https://www.my.company.mil/group/oidc?utm_source=xxx%20public')
cy.get('#okta-signin-username').should('be.visible').type(username);
cy.get('#okta-signin-password').type(password);
cy.get('#okta-signin-submit').click();
cy.contains('Send Push').should('be.visible').click();
})
cy.get('.btn-primary').contains('I Agree').should('be.visible').click()
cy.contains('Welcome to MyNavy Portal').should('be.visible');
})
})
beforeEach(() => {
cy.signIn('username', 'password');
cy.visit('/');
}) Any feedback on these issues would be great. |
Beta Was this translation helpful? Give feedback.
-
Hi,
What happens with Cypress: it('login test', () => {
cy.visit('domain 1')
cy.wait(2000)
cy.get('[id^=username]').should('be.visible').type('username'))
cy.get('[id^=btn-text]').should('be.visible').click()
cy.origin('domain 2', () => {
cy.wait(2000)
cy.get('[id^=pass]').should('be.visible')
cy.get('[id^=pass]').type('password')
cy.get('[id^=signIn]').click()
})
//validate something in the original domain 1
}) Any ideas what might be wrong? Thanks, |
Beta Was this translation helpful? Give feedback.
-
Could you provide a test project that reproduces the issue? |
Beta Was this translation helpful? Give feedback.
-
Doesn't work for me :( For us the checkout will go to a Stripe test payment page on stripe.com after clicking the submit button. cy.get(checkout.locators.checkoutSubmit).click()
cy.origin('https://stripe.com', () => {
cy.contains('Authorize Test Payment').click()
}) |
Beta Was this translation helpful? Give feedback.
-
I'm trying this feature with Paypal and fails on the second page, at the first page where you type your username and password doesn't give problems. It's when you click the submit button, Paypal sends you an error message. It's a sandbox environment by the way. Also, I've tried with Sofort payment and the new feature works fine. maybe it's some kind of security in the Paypal website |
Beta Was this translation helpful? Give feedback.
-
Hello, thanks for adding this feature. In previous posts, it seems that others have a front page and expect to click a login button to initiate the cross origin auth/etc. In my use case, upon navigating to my company's site, it automatically redirects to the SSO landing page. Because of this I'm unable to figure out how to set this up correctly using origin. Is there any way to provide an example where a redirect is taking place? What I'd like to do:
|
Beta Was this translation helpful? Give feedback.
-
In this example, we are logging into office online. The app breaks free of Cypress. git clone https://github.com/muratkeremozcan/cypress-azure-ad.git
cd cypress-azure-ad
npm i
npm test Check out the gif in the readme https://github.com/muratkeremozcan/cypress-azure-ad. |
Beta Was this translation helpful? Give feedback.
-
Hello @mjhenkes, The error logs in my terminal:
|
Beta Was this translation helpful? Give feedback.
-
Using this feature is really painful and I hope it gets better through the time.
This limits us, therefore we need to stay on the old approach - using one base URL per single file. |
Beta Was this translation helpful? Give feedback.
-
I've been trying to use cy.origin() to access a new origin in the same test, and I'm being able to! However once inside I'm getting this error. Also I do have the Cypress.on('uncaught:exception') under support > commands.js
|
Beta Was this translation helpful? Give feedback.
-
I just tried the feature with our implementation of Auth0. Seems to work, but only when the domain change is initiated from a button click. Example: In this example, it fails to retrieve the #email (even if we can see it in the Cypress test console)
But this one works well:
|
Beta Was this translation helpful? Give feedback.
-
Hello, this is my code: it('should click login', () => {
cy.visit('/');
cy.contains('Login').click();
cy.origin(Cypress.env('auth0_domain'), () => {
cy.get('#username').type(Cypress.env('auth0_username'));
cy.get('#password').type(Cypress.env('auth0_password'));
cy.contains("Continue").click();
})
}); I also added the experimentalSessionAndOrigin to true. my cypress version is 10.2.0 Any idea of what can cause this issue? |
Beta Was this translation helpful? Give feedback.
-
Today when trying to use cy.origin() against SSO app it just closes the test runner window the moment cypress clicks on 'login' button in the application. Can someone let me know how to handle such situation? |
Beta Was this translation helpful? Give feedback.
-
This feature was suggested to me as a possible solution to a problem I'm having but I'm doubtful and wonder if anyone has any thoughts. let myEmail=""; describe('my test', () => {
}) |
Beta Was this translation helpful? Give feedback.
-
My issue is slightly different.
Cypress version: 10.6.0 Once I start to use cy.origin(), cypress thinks we are using the same domain as the previous base URL.
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I am trying to test my website from cypress.io, but i am constantly getting above error. I am facing issue will Signing in with google. I am using the cy.origin() method. `it.only('Login should happen', ()=>{ //then we click on Sign in with google //on clicking we are transferred to accounts.google.com page haven't got any reply! |
Beta Was this translation helpful? Give feedback.
-
这是来自QQ邮箱的假期自动回复邮件。
您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。
|
Beta Was this translation helpful? Give feedback.
-
Understandable, thank you for your response!
…On Tue, 4 Oct, 2022, 5:11 am Matt Schile, ***@***.***> wrote:
@YPD-HG <https://github.com/YPD-HG>, there are some known issues logging
into Google that we are targeting to be resolved in Cypress 10.10.0.
#22987 (comment)
<#22987 (comment)>
—
Reply to this email directly, view it on GitHub
<#21186 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMOHBKRQFZUB5HOLTZDIMETWBNVL7ANCNFSM5UIXRV3Q>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Can you please suggest me any other way to test "Sign in with Google"?
…On Tue, 4 Oct, 2022, 5:11 am Matt Schile, ***@***.***> wrote:
@YPD-HG <https://github.com/YPD-HG>, there are some known issues logging
into Google that we are targeting to be resolved in Cypress 10.10.0.
#22987 (comment)
<#22987 (comment)>
—
Reply to this email directly, view it on GitHub
<#21186 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMOHBKRQFZUB5HOLTZDIMETWBNVL7ANCNFSM5UIXRV3Q>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Today, we will release 9.6.0, and we’re excited for you to test the new Experimental command, cy.origin(). This is our first public iteration of a new command designed to help you navigate multiple domains of different origins in a single end-to-end test.
We invite and appreciate any feedback that you provide. Please use this thread to provide feedback, request features, or just comment on cy.origin() in general.
We are especially interested in if you were able to achieve previously impossible test cases via cy.origin(), or if you found limitations with the command that we should consider before making it generally available in a future release.
If you have a larger bug to report, please file a dedicated issue.
Beta Was this translation helpful? Give feedback.
All reactions