loki: Failing to fetch stories with Storybook 7.0
Issue
After upgrading to Storybook to v7.0.0-rc.3, when running loki with docker locally on macos, we are currently getting Failed fetching stories error.
Screenshots / Logs
yarn loki test
loki test v0.31.1
FAIL chrome.docker
Fetching stories
8 requests failed to load; file:///var/loki/sb-common-assets/nunito-sans-regular.woff2,
file:///var/loki/sb-common-assets/nunito-sans-italic.woff2,
file:///var/loki/sb-common-assets/nunito-sans-bold.woff2,
file:///var/loki/sb-common-assets/nunito-sans-bold-italic.woff2,
file:///var/loki/sb-preview/runtime.mjs,
file:///var/loki/runtime~main.bddd1b2d.iframe.bundle.js,
file:///var/loki/4380.801d5d24.iframe.bundle.js, file:///var/loki/main.4b0708d2.iframe.bundle.js
Some visual tests failed to run
It appears static assets in index.html from the Storybook build are now being loaded with a ./ in their path ie.
Storybook v7
<script src="./runtime~main.bddd1b2d.iframe.bundle.js"></script>
Storybook v6
<script src="runtime~main.bddd1b2d.iframe.bundle.js"></script>
Environment
macOSVentura v13.2.1nodev16.15.0npmv8.5.5lokiv0.31.1storybookv7.0.0-rc.3
Additional context
Any suggestions/ideas appreciatedย โ thanks! ๐
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 16
- Comments: 24 (2 by maintainers)
storybook 7.1 , loki 0.32.0 on CI it always fires this Error ( , are u sure it fixed ?
FWIW, we migrated from Loki to Storycap + reg-cli for Storybook 7 support. Storycap seems to also be much faster as a bonus.
Iโve seen many times on the forums that loki doesnโt work with storybook > 7 in production build and in CI. None of the solutions helped. Any opinions on how to fix this ?
Fixed in 0.32.0
Yes, that was the next bug in CI with successfully completed screenshot tests ๐
We need to add the
-sor--successparameter to command the Storybook server to stop with code 0 instead of 1, when the Loki tests successfully completed with code 0.Like this:
"concurrently -s first -k \"npm run storybook\" \"npm run test:ui\""And everything works great in CI! ๐
I solved the problem with running Loki + Storybook 7 screenshot tests in CI! ๐
Instructions:
Install concurrently
npm i concurrently, to run processes in parallelConfigure a command to start Storybook server and Loki screenshot tests:
"test_ui_ci": "concurrently --kill-others \"storybook dev -p 6006\" \"npx loki test\"Example from my package.json:
Problems remain when testing in CI with the latest version of Loki 0.31.2 and Storybook v7
Any idea how to fix this? Or maybe there is a workaround for testing in CI with Loki and Storybook 7?
Iโm in the middle of the upgrade to SB 7 and hitting this roadblock as well
I have trouble, locally all tests pass, but from GitHub actions - 80% of tests fail
Is there really no way to run loki on the build output of a storybook 7 build? running both in parallel in CI only looks like a workaround and not like a solution
I could not find an example with
test-cra-init.shin #451How can I run the Storybook server in parallel with the tests in CI so that the Storybook server completes the process after the screenshot tests in CI are done?
Good, one more solution: (
npm i concurrently,npm i deelay)"test:ui:ci": "concurrently --kill-others --raw --success first \"npm run storybook\" \"npm run test:ui\" \"deelay\"",Every screenshot is different with thisโฆ
May I see your GitHub project, please?
Looks like this could be something to do with a cors issue on docker/chrome. When I open the docker logs while running loki I see the following:
Same issue, a fix would help. ๐