Replies: 1 comment
-
I've stumbled on a similar problem, so I don't think it's an isolated issue. In my case, we have a landing page where a user might land on, and would quickly expect a redirect to happen. It's still important that we present some information to the user (loading spinner, progress bar, etc. ) and would like to test that. The issue is similar; how do we use the cypress api before the redirect happens. There's a race between cypress finishing and the application redirecting. I've definitely tried using some of the cypress events (like you have) but it doesn't expect you to use |
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
-
I have a form on a landing page that I would like to test. It executes these steps in the following order when the submit button is clicked:
something like
I am currently attempting to test that the cookie does get set before it redirects. Something like
The problem I'm encountering is that when
cy.getCookie()
runs, it does not get the latest state of the cookie. However, if I placecy.getCookie()
aftercy.wait("@endpoint")
, the page has already redirected, and Cypress is callingcy.getCookie
on the redirected page on the other domain, where the cookie obviously does not exist.I've also tried using the
window:before:unload
event and wrappingcy.getCookie
to "wait" for the cookie to set by only checking for the cookie before the page unloadsbut Cypress complains with the following error:
Does anyone have suggestions on how to tackle this problem? Does some sort of "before intercept" hook exist? Is my implementation unusual?
Beta Was this translation helpful? Give feedback.
All reactions