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

Headless render tests: @storybook/test-runner support or Storyshots alternative? #534

Open
flochtililoch opened this issue Jan 8, 2024 · 3 comments

Comments

@flochtililoch
Copy link

flochtililoch commented Jan 8, 2024

I wonder what the plan is with regards to headless rendering tests for @storybook/react-native.

I've used Storyshots for the longest time, but it's now deprecated, and the recommended replacement seem to be @storybook/test-runner, which is not directly compatible with React Native. Supposedly it can work if react-native-web is configured (but undocumented for now, does not work out of the box), but this seems a regression over the simplicity of Storyshots (at least, from a "user" perspective, I can't speak about the internals of Storyshots).

Does anyone have perspective on what the road map looks like in that regard?

@dannyhw
Copy link
Member

dannyhw commented Jan 9, 2024

Test runner should work out of the box for react native web, it's no different than running for reactjs which is why there isn't specific documentation on that. If that doesn't work for you please let me know what issue you run into.

In terms of plans for testing I want to get unit testing working with composeStory and testing library. I've seen it work with some small hacks, i believe all that's needed is to take composeStory out of storybook/react and put a version of it in storybook/react-native.

Test runner on native is not really possible In the same way as far as i know. That's because we can't use testing library API's at runtime, they run in a sort of fake dom not a real rn app. The best we can do is a detox integration for example

automatic visual testing similar to chromatic is something that I've already prototyped and want to do but its a lot of work ahead.

once v7 is out i will put testing top of the list

@flochtililoch
Copy link
Author

test-runner is only compatible with Storybook 6.X until version 0.9.4, and installing 0.9.4 cause this issue locally for me:

 Validation Error:

  Module @storybook/test-runner/playwright/transform in the transform option was not found.
         <rootDir> is: /Users/f/project

  Configuration Documentation:
  https://jestjs.io/docs/configuration

Installing 0.16.0, or 0.12.0 as suggested here yields the same error.

Trying to remove this line to try skip the issue will then cause other errors pertaining to resolving modules internal to test-runner. Feels like I'm running into a dependency hell.

@dannyhw
Copy link
Member

dannyhw commented Jan 10, 2024

@flochtililoch oh right I see what you mean, I guess thats a problem with being on 6.5 for compatibility with react native storybook. On v7 react native web works well with the test-runner but I haven't recently tried configuring things with 6.5, I'm working on getting v7 for ondevice so hopefully I could solve this by getting us to v7 😅.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants