Skip to content
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

[Feature Request] Storybook default tests timeouts must accept overrides #300

Closed
AthulMuralidhar opened this issue Nov 15, 2022 · 11 comments · Fixed by #363
Closed

[Feature Request] Storybook default tests timeouts must accept overrides #300

AthulMuralidhar opened this issue Nov 15, 2022 · 11 comments · Fixed by #363
Labels
question Further information is requested released

Comments

@AthulMuralidhar
Copy link

AthulMuralidhar commented Nov 15, 2022

Is your feature request related to a problem? Please describe

So, i have a long running test and I want to be able to override the global timeout defined in the storybook config

Describe the solution you'd like

the error suggestion says

 thrown: "Exceeded timeout of 5000 ms for a test.
    Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."

I would just like this one to work

FYI: the imports for jest looks like this: import { jest } from "@storybook/jest";

Describe alternatives you've considered

  • tried messing around with Parameters for that particular Story
  • tried adding await sleep

Are you able to assist to bring the feature to reality?

yes, I can

Additional context

Answer is actually maybe? I am not sure if i have enough knowledge to be of help - only been doing storybook for the past 3 months - besides, i'm a golang dev :P

@AthulMuralidhar AthulMuralidhar added the feature request New feature or request label Nov 15, 2022
@AthulMuralidhar AthulMuralidhar changed the title [Feature Request]: [Feature Request] Storybook tests timeouts must accept overrides Dec 29, 2022
@AthulMuralidhar AthulMuralidhar changed the title [Feature Request] Storybook tests timeouts must accept overrides [Feature Request] Storybook default tests timeouts must accept overrides Dec 29, 2022
@sw-tracker
Copy link

Maybe something related, how can I configure jest timeouts for all tests? Our Jenkins is really slow and timesout regularly, so I would like to increase the general timeout.

@shilman shilman transferred this issue from storybookjs/storybook May 3, 2023
@kasperstorgaard
Copy link

I think you can eject and override it from there:
https://storybook.js.org/docs/react/writing-tests/test-runner#cli-options

@staykova-sport-thieme
Copy link

I am experiencing some odd behaviour. I installed test-runner and then ran yarn test-storybook so that the smoke-tests run, all tests failed because of a timeout error. I ran the command a couple of more times one after the other and after every run the number of tests that passed increased untill all tests have passed... which is really odd.
The error:
Screenshot 2023-05-31 at 11 28 52
Results after running test-storybook several times one after the other, I am missing one screenshot for all failed, 0 passed:
Screenshot 2023-05-31 at 11 28 11
Screenshot 2023-05-31 at 11 28 30
Screenshot 2023-05-31 at 11 28 37

@MaxDNG
Copy link

MaxDNG commented Aug 4, 2023

Ran into a similar issue and I found a way to override the jest config globally without ejecting.
If you check the code for test-storybook.ts it loads a custom user value or load this file.

So I created a copy of it in .storybook/test-runner-jest.js with the following content:

const { getJestConfig } = require('@storybook/test-runner');

/**
 * @type {import('@jest/types').Config.InitialOptions}
 */
module.exports = {
  // The default configuration comes from @storybook/test-runner
  ...getJestConfig(),
  /** Add your own overrides below
   * @see https://jestjs.io/docs/configuration
   */
  testTimeout: 30000,
};

Here I'm increasing the timeout, but you can adjust any other param you need.
Hope that helps.

@vchandran8
Copy link

Hello team,

Do we have any ETA for this issue fix on the storybook side? I am also facing the same issue.

Thanks,
Veera

@yannbf
Copy link
Member

yannbf commented Oct 12, 2023

Hey everyone! Thanks for opening this issue. I can definitely understand the confusion, thinking that @storybook/jest should be used for the timeout. That is not the case. @storybook/jest is a helper utility for the browser. Jest configs are overwritten in the test-runner via the test-runner file as perfectly explained by @MaxDNG!

I will update the docs and provide an example for this. Thank you!

@yannbf yannbf added question Further information is requested and removed feature request New feature or request labels Oct 12, 2023
@david-morris
Copy link

@yannbf so there is no way to change the timeout for one test? That sounds like not-planned rather than completed.

@vchandran8
Copy link

We are getting sometime the below error and that is not resolving by Jest Config. Is there any recommendation found for overriding the playwright timeout part of testRunner.

page.goto timeout 30000ms exceeded playwright

Copy link

github-actions bot commented Nov 8, 2023

🚀 Issue was released in v0.14.0 🚀

@IsaiahByDayah
Copy link

We are getting sometime the below error and that is not resolving by Jest Config. Is there any recommendation found for overriding the playwright timeout part of testRunner.

page.goto timeout 30000ms exceeded playwright

Hey @vchandran8 We're running into this too. Wondering if you ever found a solution to your issue?

@KelvinOm
Copy link

I also experienced this on v0.19.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants