-
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
fix: cy.intercept delay works correctly with 204 No Content #17126
Conversation
Thanks for taking the time to open a PR!
|
function wait (fn, ms) { | ||
return new Promise((resolve) => { | ||
setTimeout(() => { | ||
resolve(fn()) | ||
}, ms) | ||
}) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the right place for this utility function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bluebird offers Promise.delay
which may meet your needs. If it's just used in this function/file then this is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the code with Promise.delay
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sainthkh There seems to be a type error with the change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good, nice fix.
function wait (fn, ms) { | ||
return new Promise((resolve) => { | ||
setTimeout(() => { | ||
resolve(fn()) | ||
}, ms) | ||
}) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bluebird offers Promise.delay
which may meet your needs. If it's just used in this function/file then this is fine.
@sainthkh Is this ready for rereview? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check create-build-artifacts, there is a type error
941601d
to
09d78a3
Compare
I rolled back and decided to use |
User facing changelog
delay
now works correctly with thestatusCode: 204
.Additional details
delay
didn't work correctly withstatusCode: 204
.setTimeout
inside thegetBodyStream
. It is called after the delay when response is not an empty body but it isn't when it's not. I fixed this by changinggetBodyStream
asasync
.How has the user experience changed?
N/A
PR Tasks