Open TristanWatanabe opened 1 year ago
Getting this error in the console when storyFn
is invoked by the GetStories.js
script and the story uses a react hook. It works on the storybook story itself but when storywright tries to invoke it, it breaks:
Hi @TristanWatanabe, Storywright is not meant to be used on a running Storybook server. To see the benefits of StoryWright:
For all possible configs refer --> https://github.com/microsoft/storywright/blob/main/src/main.ts
@vinodkumarsharma276 - We do use StoryWright in the manner you described above. As mentioned in the original post, the issue is that when a react hook is used in a story, StoryWright silently fails and does not take screenshots for stories that have steps
applied. The screenshot i shared in my previous post was just to show what might be the possible cause of this issue
Issue:
StoryWright
considers theSteps
object as undefined and does not take a screenshot. Only a static screenshot is taken.Expected Behavior:
Steps
executed are taken.Steps to Reproduce:
1) Clone repro branch https://github.com/TristanWatanabe/fluentui/tree/storywright-hooks-bug 2) Run
yarn workspace @fluentui/react-components vr:build
3) Runyarn workspace @fluentui/react-components vr:test
4) Observedist/screenshots
folder and see issue - only a static screenshot is taken (Component.Example With Hook.chromium.png
). Comment out theuseStyles()
invocation in the story in thesrc/stories/Example/Example.stories.tsx
file and re-run steps 2 and 3 to see the expected behavior where BOTH static screenshot and a steps screenshot are taken.