percy / percy-storybook

Percy's Storybook SDK.
https://docs.percy.io/docs/storybook
MIT License
150 stars 45 forks source link

Add the ability to include only specific stories #147

Closed Robdel12 closed 3 years ago

Robdel12 commented 5 years ago

What is this?

If you have a large component library and you don't want to snapshot all of the stories, it can be annoying to have to skip each story. It would be better to have the ability to include only specific stories you wanted snapshotted.

BPScott commented 5 years ago

You can add a a global parameter to skip all stories by default by doing

addParameters({
  percy: {
    skip: true,
  },
});

(e.g. https://github.com/Shopify/polaris-react/blob/master/.storybook/config.js#L33-L36) and then set skip:false on all stories you wish to include.

codylindley commented 4 years ago

For large complex storybooks that want to use multiple Percy projects from a mono-repo this feature is mission-critical. Especially, if Percy is run on every code commit to a merge request to a mono-repo in a continuous deployment environment. Otherwise, Percy could cost an exorbitant amount of money to run for a large mono-repo (i.e. you have 1000+ stories). The other un-ideal option would be to create separate storybooks. Is this not a trivial addition to the CLI? If my storybook is divided into product-specific areas, why would I run Percy for every product when I only need it to run on a subset of stories for one product, when a file changes in that product directory. Any chance we might see this feature soon?

I suppose, another option would be to duplicate the storybook directory and delete stuff before building... what a pain.

Robdel12 commented 3 years ago

I believe this has been taken care of with the SDKs rewrite in #301 (include & exclude: https://github.com/percy/percy-storybook#configuration)