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

Added additional query for single case #628

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

smartcoder-7
Copy link

@smartcoder-7 smartcoder-7 commented Aug 18, 2022

  • What to solve
    It is very common to use storybook's knobs addon for storybook component nowadays. The screenshot results can vary depending on how to set knobs, example: background: blue or red.
    Also, they are set as query strings in browser or puppeteer. Currently, the package doesn't support to set specific knobs.
    This is very similar to this one [Feature proposal] Integrate with the knobs add-on #34
    But in short, I think we need ability to configure storybook component out of box --- from cli

  • Solution
    Additional query param has been added in this commit to cli interface and StorybookPreviewBrowser to go to specific version of story. This works for knobs or args for controls in v6. But need to stick to this when writing the query to pass over to cli param (additionalQuery) . https://storybook.js.org/docs/react/writing-stories/args#setting-args-through-the-url

  • Note
    It has to be used for one specific story. Otherwise, it will be appended to other stories when trying to get all the screenshots.

@Quramy
Copy link
Member

Quramy commented Aug 19, 2022

Also, they are set as query strings in browser or puppeteer. Currently, the package doesn't support to set specific knobs.

It's cool 😄

Thanks for PR. Would you add e2e test cases ?

@smartcoder-7 smartcoder-7 force-pushed the added-single-case-with-query branch from 03eed57 to feba321 Compare August 19, 2022 18:17
@smartcoder-7
Copy link
Author

Also, they are set as query strings in browser or puppeteer. Currently, the package doesn't support to set specific knobs.

It's cool 😄

Thanks for PR. Would you add e2e test cases ?

I've added a e2e test case for v6 when using args for control. because it is using old version of storycap, I can't see the correct result but can you verify that is working fine?

@smartcoder-7
Copy link
Author

i was able to add more e2e test case and sample for storycap.
also, verified it is working as expected using yarn e2e

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.

2 participants