-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Add a way to disable delay in runtime for all mocked requests #145
Comments
@isqua, you can set up the delay time from the addon panel. However, it won't fix your problem as we are using setTimeout even though the delay time is 0. I have to raise a PR to fix this issue. Any PR from your end will also welcome :) |
@nutboltu, thank you for the response! Is it a way to change the value programmatically? |
There are no global types for that, as this is a special case. I would recommend using a separate mock data list for the load tests and using delay 0 in that mock data. |
Yes, I am going to use something like this: const meta: Meta<IMyComponentStoryArgs> = {
title: 'components/MyComponent',
decorators: [withMock],
parameters: {
mockData: adjustTimers([
{
url: '/api/mydata/success',
method: 'PATCH',
status: 201,
delay: 500,
response: {},
},
{
url: '/api/mydata/error',
method: 'PATCH',
status: 502,
delay: 500,
response: {},
},
]),
},
};
export default meta; and the |
Very useful plugin, thank you! I use it in many components to show loading and saving processes.
I also write screenshot tests on my Storybook components. I have to synchronize mock delay time and pause in my tests, which causes the tests to take a bit longer to run.
Usually, I would like to have no delays in my tests. So I would like to be able to turn off all delays in mocked request. For example, through global types or another way that can be controlled through the URL. Something like this:
Do you think this is possible? What's the best way to implement it?
The text was updated successfully, but these errors were encountered: