Preventing a JavaScript redirect to a 3rd-party site using intercept #9400
Unanswered
Undistraction
asked this question in
Questions and Help
Replies: 1 comment 1 reply
-
See the redirect spec in this recipe cypress-io/cypress-example-recipes#598 (note that this is a PR to fix spying on the redirect call, it should be released in 6.1.0. Stubbing the redirect should work already in 6.0.1) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I need to test an auth flow that involves a redirect to a third-party site. I have successfully used the following code to test the behaviour:
However on our CI we are bumping into this issue: #4220. Given that I only need to test that the redirect happens, and I don't actually need the page to redirect, I could avoid this issue if there was a way to cancel the redirect behaviour.
Is there a way to cancel the redirect using
intercept
?[Update] It seems that even this solution is unreliable, as it is possible for the redirect to happen in between
cy.visit
andcy.wait
, meaning the test is left waiting for something that already happened.Beta Was this translation helpful? Give feedback.
All reactions