Testing API request processing state of the application while stubbing the response #14860
Unanswered
gihan9a
asked this question in
Questions and Help
Replies: 0 comments
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'm trying to test a button's disabled state which triggers a
fetch
request. The button should be in the disabled state while the fetch is in progress.I've stubbed the response in my cypress test. Because of that, I'm unable to verify the button disabled state in my test case.
Demo app https://csb-0ov1n-qa15jvl5n.vercel.app/
Source code https://codesandbox.io/s/jovial-frog-0ov1n
Following is a sample cypress test case for testing the above scenario.
I tried using
delayMs
to delay the response. But seems there's a bug withdelayMs
#9436 which is causing arbitrary delays in responseIs there a better way to test this scenario?
Beta Was this translation helpful? Give feedback.
All reactions