-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
[Bug]: play
function does not work in stories built for Production
#19758
Comments
Edit: never mind, it was fixed by ensuring the version of all storybook packages match. |
@shgtkshruch do you have a reproduction repo you can share? |
@shilman Thanks for response. |
@shgtkshruch glad to hear that solved it! |
@shgtkshruch how did you add NODE_ENV to your code ? |
I run npm command with NODE_ENV like this.
|
I had the exact same problem, and found out it was because I had a story importing something from my export * from '@testing-library/react' This file is where I define a custom render function for my component tests with React Testing Library, and acts as a wrapper for '@testing-library/react'. I guess there is a conflict between '@testing-library/react' and '@storybook/testing-library'. Make sure only '@storybook/testing-library' is pulled in your stories. Note that the issue only happens when using userEvent actions (clicks) in your play functions. No problem if you are just waiting for an element to display. |
Im struggling with this one too... I've made sure all packages are on the same version (6.5.10 for me) and Also Not sure what's going on... Did you guy solve it by building storybook in development mode? |
With the fix I mentioned, play function now also work in production builds. |
I really can't make this work :( I even removed the Also updated all storybook packages to 6.5.15, no luck |
@foxaltus, did you handle the error? |
Unfortunately, no, I gave up with this :( Let me know if you ever find a workaround |
@foxaltus, ok) |
@foxaltus, well, that helped me in resolving an error:
All tests should pass. I think (as mentioned above) there are some problems between |
OK so that confirms that if you want to use interaction testing, you need to build in development mode. I'm not sure how I feel about that 🤔 |
Building in dev mode is a bad idea, your bundle will be much bigger and slower. |
@foxaltus, well, found a desicion. Not need to build in development mode, I have 2 files for testing components with RTL. They are both for providers. One of them for creating function to cover all providers (I took an example from here)
Second file also for provider (custom router):
Commenting them or deleting them made all tests pass in build version. It means that providers (for testing components with RTL) not organized properly and seems that they somehow affect @storybook |
hey @rgdzv do you have any import of |
@foxaltus, yes, in all Before coming to a decision, I deleted node_modules and package-lock.json and reinstalled it. Also I deleted |
Describe the bug
I build storybook with
build-storybook
command.When I open a stories that implements the
play
function in a browser, I get the following error.I build storybook with
NODE_ENV=development
,This is work fine.
To Reproduce
No response
System
Additional context
No response
The text was updated successfully, but these errors were encountered: