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
Storybook tests fail only in chromatic #591
Comments
Hi @tuzmusic have you tried accessing the hosted version of your SB and checking if the test passes in your browser? If you write into Chromatic support we can take a closer look at your specific SB and see what the issue might be. |
The test does pass in the browser. I'll write to support. Thanks. |
Posting in case this helps anyone: I found that Chromatic was running Storybook in a different way from my
That copies all files from my |
@aldrichdev Thank you for posting this and saved me a lot of time. I am running into the same issue as well. I am using |
hi @stuthib! I'd love to help with the http://localhost:6006/?path=/story/example-button--primary could you tell me a little more about your environment? |
Thank you for the quick response. We are using Please let me know if I can help provide more information. |
@chantastic maybe it is not an issue with having the icons. Because I tried to remove it and run, it still fails. It works okay when I run using localhost, but fails using |
@stuthib thank you for the additional information! would it be possible to see the code for that interaction? I'd like to reproduce it as thoroughly as possible. |
Yes for sure. This is the TextInput component and styles use tailwind css.
In my story, I am using the above component as below -
// Interaction test
|
I have a similar issue (sb 7.0.4), the tests run correctly on local (i.e. |
@ignaciolarranaga chances are there's a timing issue here. Your play function needs to wait for something to appear (using Because often components aren't truly "ready" until after SB think they are rendered (this can be for various reasons), it's often a good idea to put a |
I'm having an issue exactly like errors shown in these images. Some notes:
|
I've managed to get my react-vite storybook with interactions/ tests working. I'm nx monorepos which only installed "@storybook/jest": "~0.1.0" when initialising the library. I manually upgraded to "@storybook/jest": "0.2.2" which fixed the issue. Reference issue that helped me solve this. Hope this helps someone else |
When I run my storybook locally, all of my interaction tests pass. When I run chromatic, the storybook builds, but on the "test your stories" step it fails with Error code 2, and I can see the failing test in the chromatic logs.
Here is my story, with some relevant helper functions. The next-to-last assertion,
await expectRowCount(2)
is the one that is failing in Chromatic (both when I run chromatic locally, and when it's run as part of my Bitbucket pipeline); and FWIW the actual last assertion also fails if I comment that above-mentioned one.The
expectRowCount
helper is used all over the stories file with no other problems. And, again, the tests pass when I run storybook locally.The text was updated successfully, but these errors were encountered: