Skip to content

Conversation

@dmytrokirpa
Copy link

@dmytrokirpa dmytrokirpa commented Oct 22, 2025

Added a check to wait for window["__STORYBOOK_PREVIEW__"] to be available when options.stepsApi is set to "parameters", ensuring that dependent scripts execute only after the Storybook Preview API is ready.

This change unblocks the Storybook v8 migration for FluentUI microsoft/fluentui#35279

The problem we encounter atm:

$ storywright --browsers chromium --url dist/storybook --destpath dist/screenshots --waitTimeScreenshot 500 --concurrency 4 --headless true --stepsApi parameters
================ StoryWright params =================
Storybook url = dist/storybook
Screenshot destination path = dist/screenshots
Browsers = chromium
Headless = true
Concurrency = 4
Cores available on system  = 16
SkipSteps = false
WaitTimeScreenshot = 500
ExcludePatterns = chromium,firefox
================ Starting story right execution =================
StoryWright processor started @  2025-10-22T15:57:09.921Z
Starting browser test for chromium
stories.json not found at /fluentui/apps/vr-tests-web-components/dist/storybook/stories.json
** ERROR ** Error: page.evaluate: SB_PREVIEW_API_0005 (CalledPreviewMethodBeforeInitializationError): Called `Preview.extract()` before initialization.

The preview needs to load the story index before most methods can be called. If you want
to call `extract`, try `await preview.initializationPromise;` first.

If you didn't call the above code, then likely it was called by an addon that needs to
do the above.
    at ns.extract (https://stories/sb-preview/runtime.js:6865:13)
    at getPageStories (eval at evaluate (:234:30), <anonymous>:37:44)
    at getStoriesWithSteps (eval at evaluate (:234:30), <anonymous>:4:12)
    at eval (eval at evaluate (:234:30), <anonymous>:2:1)
    at eval (<anonymous>)
    at UtilityScript.evaluate (<anonymous>:234:30)
    at UtilityScript.<anonymous> (<anonymous>:1:44)
Closing process !!
StoryWright took  1 secs to complete.
StoryWright processor completed @  2025-10-22T15:57:10.511Z

Related to #74

@dmytrokirpa dmytrokirpa changed the base branch from storybook7 to storybook8 October 22, 2025 16:14
@Hotell
Copy link

Hotell commented Oct 23, 2025

I think we need to PR against https://github.com/microsoft/storywright/tree/storybook7

that's the only one branch we contributed to which contains modern SB support.

also the version bump will be that pre-release manual bump -> please bump those files as well in this PR https://github.com/microsoft/storywright/pull/74/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519

@dmytrokirpa dmytrokirpa changed the base branch from storybook8 to storybook7 October 23, 2025 21:10
@sunilsurana
Copy link
Member

sunilsurana commented Oct 29, 2025

@Hotell is it ok we keep the version as 0.0.27-storybook7.15 but move the code into storybook8 branch spawned from storybook7 branch? so that it will not create confusion for development and for consumers it can be backword compatible

@dmytrokirpa
Copy link
Author

@Hotell is it ok we keep the version as 0.0.27-storybook7.15 but move the code into storybook8 branch spawned from storybook7 branch? so that it will not create confusion for development and for consumers it can be backword compatible

the change isn't "breaking", so it's might not make sense to have it in a separate branch or release under storybook8-* tag. It's related to what @Hotell did in #74

@Hotell
Copy link

Hotell commented Oct 29, 2025

From semver and feature POV it doesn't make sense to create v8 branch as the changes we contributed are compatible across major version of SB (v7 to v9).

If we wanna branch and change releases I'd suggest:

  • propagate v7 branch to main and go from there
  • create next branch which will embrace standard versioning schema starting with 0.1.0 or something

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

Successfully merging this pull request may close these issues.

3 participants