Situation: I am writing test automation for a website. There comes a point where there is a link button on my website. Clicking this I am redirected to an external website. There I have to log in and as soon as I do that I am redirected to my original web-page which contains some 'connections' that I need.
Problem: As soon as cypress clicks on the redirection button it does into a blank page.
Ideal solution: I would want to automate the entire scenario. If not then at-least a work around.
With the experimental cy. origin() command, new in Cypress 9.6. 0, you can easily switch between origins to seamlessly test syndicated authentication, cross-site CMS workflows and much more.
As suggested in the Cypress Docs, you should really be using cy.request()
to log in. You don't control a 3rd party site, and that makes your test very flakey.
For example, a lot of login pages are constantly changing and are A/B tested for the purpose of preventing a bot from logging in, including testing bots. The data:,
url is probably the result of a http redirect.
Thankfully, using cy.request()
you can 'fake' logging in by making a request to the server through code (which doesn't change as much) and you will never have to leave your app to log in
Here's a recipe for Single Sign-On for example.
Hope that makes sense!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With