storybook: storyshots: Unexpected loaded state. Did you call `load` twice?
Describe the bug I have a setup using storyshots / storyshots-puppeteer and I want to make a screenshot of a story on multiple devices. When I execute the code I receive a warning.
Unexpected loaded state. Did you call
loadtwice?
Expected behavior No warning.
Screenshots

Code snippets
import initStoryshots from '@storybook/addon-storyshots'
import { devices } from 'puppeteer'
function createCustomizePage(pupDevice) {
return page => page.emulate(pupDevice)
}
['iPad', 'iPhone X'].forEach(supportedDevice => {
const pupDevice = devices[supportedDevice]
const customizePage = createCustomizePage(pupDevice)
initStoryshots({
suite: `Image storyshots: ${pupDevice.name}`,
test: imageSnapshot({
customizePage,
}),
})
})
System: System: OS: macOS Mojave 10.14.6 CPU: (4) x64 Intel® Core™ i5-7267U CPU @ 3.10GHz Binaries: Node: 12.16.1 - ~/.nvm/versions/node/v12.16.1/bin/node Yarn: 1.22.4 - npm: 6.13.4 - ~/.nvm/versions/node/v12.16.1/bin/npm Browsers: Chrome: 81.0.4044.138 Firefox: 67.0 Safari: 13.1 npmPackages: @storybook/addon-actions: 5.3.18 => 5.3.18 @storybook/addon-backgrounds: 5.3.18 => 5.3.18 @storybook/addon-centered: 5.3.18 => 5.3.18 @storybook/addon-contexts: 5.3.18 => 5.3.18 @storybook/addon-docs: 5.3.18 => 5.3.18 @storybook/addon-knobs: 5.3.18 => 5.3.18 @storybook/addon-links: 5.3.18 => 5.3.18 @storybook/addon-notes: 5.3.18 => 5.3.18 @storybook/addon-storyshots: 5.3.18 => 5.3.18 @storybook/addon-storyshots-puppeteer: 5.3.18 => 5.3.18 @storybook/addon-viewport: 5.3.18 => 5.3.18 @storybook/addons: 5.3.18 => 5.3.18 @storybook/codemod: 5.3.18 => 5.3.18 @storybook/vue: 5.3.18 => 5.3.18
Additional context The screenshots look correct. There are no errors.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 19
- Comments: 17 (2 by maintainers)
The issue that its not possible to call
initStoryshotstwice within one test run which @svewag and @jaruesink mentioned still persists. We have it too.@shilman it says I cannot use both
mainandconfigfiles. But I figured out my issue. I loaded stories twice - once in config file and second time in main, using glob pattern. Removed manual loading from config and it works like charm! Thanks for pushing towards right direction!Got same issue with following config: