[Storybook] Add ability to auto capture variations of a Story #163
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.
Description
This PR adds the ability to test additional variations of a story by supplying custom args which will be appended to the initial args state prior to each capture. For example, you could have a single Storybook Story with a
Button
component with controls to toggle thesize
andprimary
props so users could see the story in their playground and still take snapshots of each state.With that example, here we could have a single Story to not clutter the UI, but still take snapshots of numerous states when using Sauce Visual. Below tests numerous size, disabled, and primary states. Each
StoryVariation
allows customizing the name and overriding the args for a story. It will reset the args to the defaultinitialArgs
state prior to each snapshot variation.See the
parameters.sauceVisual.variations
property below.Output of this example in the UI. Though difficult to see in this preview since the thumbnails stretch to fit the cards, each button has a different size depending on the 'size' prop, as well as the values of the primary / disabled props.
Types of Changes