Allow customization of storyshots.disable parameter name
See original GitHub issueThe (undocumented?) ability to set parameters: {storyshots: {disabled: true}}
on a story is useful, but can be restrictive if doing storyshots testing alongside screenshot testing, a11y testing etc.
Currently excluding stories from storyshots applies to all storyshots and storyshots-puppeteer tests and it runs at the same time as storyKind as the initial list of stories is collected so there is no access via callbacks/config etc .
A config option called storyDisableParameter
would be really convenient:
// snapshot tests
initStoryShots({});
// screenshot tests
initStoryshots({
storyDisableParameter: 'screenshots.disable' // (default: storyshots.disable)
test: imageSnapshot({
storybookUrl,
beforeScreenshot,
getScreenshotOptions,
getMatchOptions,
customizePage: page => page.emulate(device)
})
});
// a11y tests
initStoryshots({
storyDisableParameter: 'axeTest.disable' // (default: storyshots.disable)
});
This way I could specify that a test is to be ignored by screenshot testing, but not snapshot testing. Or I could add config for other suites, like if I’m using storyshots-puppeteer
to do a11y testing. The current setting removes the story from all tests that use storyshots.
// i want snapshots but not screenshots or axe tests
story.add( 'story', {}, {screenshots: {disable: true}, axeTest: {disable: true}})
// i don't want snapshots or screenshots, but do want axe tests
story.add( 'story', {}, {snapshots: {disable: true}, screenshots: {disable: true}})
I thought it would make sense to follow storyKindRegex
and storyNameRegex
naming pattern, but I’m not sure if it should be dot syntax to allow sub objects. I think that option is a little more obvious how to use it from seeing the config, but also computationally more odd.
I would be able to have a go at adding this if it’s likely to be accepted, from looking at the source I don’t think it would affect anything when using the current existing settings.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top GitHub Comments
The
disabled
parameter is now documented: https://github.com/storybookjs/storybook/blob/next/addons/storyshots/storyshots-core/README.mdThis issue is about customizing the storyshots.disable parameter name, which I still don’t believe is possible. This would still be useful for distinguishing between stories you want to disable for storyshots, storyshots-puppeteer, etc. This issue should be reopened.