-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delay for intercepted HTTP routes only works for the first call on that route #14446
Comments
@djungowski I can recreate this issue as described. This is likely an oversight and not the intended behavior. |
The code for this is done in cypress-io/cypress#14708, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior
When using
.intercept()
for a HTTP route and stubbing it with a static response with a defined delay, that delay is only used on the first ever occurrence of this call.Desired behavior
Every call of this route is delayed
Test code to reproduce
Given the following HTML:
the following Cypress test should work:
However the first assertion goes through just fine and the second one fails with
expected 0.009 to be close to 5 +/- 0.5
Versions
6.2.1
Additional info
From what I can see, this is because in https://github.com/cypress-io/cypress/blob/f43f1c1f26290fc8387697c8122f0f50b6c7cb55/packages/driver/src/cy/net-stubbing/events/response-received.ts the delay is defined as follows and probably is only called on the first occurrence:
The text was updated successfully, but these errors were encountered: