-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Portable stories: Fix playwright CT to allow functions to be passed as props #31335
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
Portable stories: Fix playwright CT to allow functions to be passed as props #31335
Conversation
2e2cf27 to
baf2ddd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
|
Hi @valentinpalkovic , @yannbf . Sorry for the annoying ping. Would it be possible to take a look at this? I'm back in this area now and it would be great to get rid of my horrible patches :). We've been running this fix for a little while now with quite a substantial number of tests on top of it with no problems thus far. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
… functions to be passed as props from the test.
baf2ddd to
6e3b59e
Compare
Package BenchmarksCommit: No significant changes detected, all good. 👏 |
|
Thank you so much for your contribution! |
|
View your CI Pipeline Execution ↗ for commit a824e72.
☁️ Nx Cloud last updated this comment at |
…ht-portable-stories Portable stories: Fix playwright CT to allow functions to be passed as props (cherry picked from commit d1eab95)
Closes #31150
What I did
#31150 details the proposed fix. Essentially, we do not need to pass the props to the page to perform the storybook load/play steps, which are wrapped in
page.evaluate(). They are extraneous. Passing them here is a problem since they have to be serialisable to go throughpage.evalaute()and functions are not, which prevents useful playwright CT native functionality that allows functions to be passed from tests.So by omitting them from being passed to the
page.evaluate()calls in the first place, but retaining them when calling the real "mount" function, we get the desired native functionality without disrupting storybook.Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
None needed as this would be exactly the same as doing what I have added to the
"renders story with props"portable stories kitchen sink test. Essentially, just pass a function from a playwright test to a portable story, and check that it actually works.Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsMake sure this PR contains one of the labels below:
Available labels
bug: Internal changes that fixes incorrect behavior.maintenance: User-facing maintenance tasks.dependencies: Upgrading (sometimes downgrading) dependencies.build: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup: Minor cleanup style change. Will not show up in release changelog.documentation: Documentation only changes. Will not show up in release changelog.feature request: Introducing a new feature.BREAKING CHANGE: Changes that break compatibility in some way with current major version.other: Changes that don't fit in the above categories.🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/coreteam here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>Greptile Summary
Fixed Playwright component testing to properly handle function props in portable stories by modifying the serialization process.
page.evaluate()calls to avoid function serialization issuescreatePlaywrightTestto maintain full props for Playwright's mount function while excluding them from browser evaluationtest-storybooks/portable-stories-kitchen-sink/react/stories/Button.playwright.tsxto verify function prop handling💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!