how cy.origin handles operation in a different domain/ third party hosted pages ? #21389
Unanswered
raktim1988
asked this question in
Questions and Help
Replies: 1 comment
-
I have yet to try it outside the context of login, but it should work like this: it("should do a multi-domain thing", () => {
// do something in domain1
// optionally have variables in domain1 x and y that you need in domain 2
// those vars have to be passed in to cy.origin closure
// you might cause a domain switch here
cy.origin('domain2', {args: {x, y} }, ({x, y}) => {
// cy.visit('domain2') // or you might visit domain 2 here
// do things in domain2
// use x and y
});
// more domains if you want
// let's say in this one who don't have any variables needed,
// just skip the 2nd argument, and no args for the callback fn either
cy.origin('domain3', () => {
// do stuff in domain3
})
// come back to original domain
cy.visit('/')
}); If you have a repo you can share, it would be neat to figure it out together. References: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello Team,
I wanted to implement cy.origin to handle multidomains in my test , the situation is : I have third part hosted pages in my e2e test , how I can make use of cy.origin to perform actions on those pages? Also once the control comes back to my original domain , I can perform the actions back there as well right ?
Also if the pages contain iFrame, can I access or interact with them ? Or not yet supprted?
Thnx!
Beta Was this translation helpful? Give feedback.
All reactions