feat: properly resolve async rendered DOM when taking element screenshot and add storybook 8 support - #70
Merged
sunilsurana merged 4 commits intoFeb 11, 2025
Conversation
Hotell
force-pushed
the
fix-support-story-store-v7
branch
from
February 11, 2025 12:29
97b64a8 to
4e4c42a
Compare
Hotell
commented
Feb 11, 2025
| "peerDependencies": { | ||
| "react": "^18.0.0 || ^17.0.0 || ^16.0.0" | ||
| "react": "^18.0.0 || ^17.0.0 || ^16.0.0", | ||
| "@storybook/preview-api": ">=7.0.0 <9.0.0" |
Author
There was a problem hiding this comment.
explicit API contract against SB version
Author
There was a problem hiding this comment.
💡 v8 is the official end of life for this package it seems.
In v9, the apis to programatically invoke storyFn() will no longer exist
only exposed APIs to obtain stories starting v9:
https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#storystore-and-methods-deprecated
const stories = await window.__STORYBOOK_PREVIEW__.extract();which returns Object of parsed CSF.
- there is no
storyFn() - there is
render(), which cannot be used as that's referring the component implementation which needs passing props and refs if used
possible implementation to support v9
- change the APIs to be defined via
parameterswhich would need to be serializable in order to properly reflect these Steps values within the created CSF story object
Hotell
commented
Feb 11, 2025
| /** | ||
| * Stories are loaded via native ESM (async), we need to wait for the JS to be loaded and applied on DOM | ||
| */ | ||
| const element = await this.page.waitForSelector(selector); |
Author
There was a problem hiding this comment.
handles async code as expected ( when storyStoreV7 is enabled)
Hotell
marked this pull request as ready for review
February 11, 2025 15:13
Hotell
commented
Feb 11, 2025
| // storyStoreV7: | ||
| // - is configurable only in SB v7 | ||
| // - is `true` by default SB v7 | ||
| // - doesn't exist in SB v7 (enabled by default) |
Author
There was a problem hiding this comment.
Suggested change
| // - doesn't exist in SB v7 (enabled by default) | |
| // - doesn't exist in SB v8 (enabled by default) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows #69