Skip to content

Commit f96ce06

Browse files
authored
Add storybook 7 support (#454)
* feat: cache all stories before extracting them when using Storybook v7 * fix: change default selector to be compatible with Storybook v7 --------- Co-authored-by: Daniel Puscher <daniel.puscher@aroundhome.de>
1 parent 7ca6aa0 commit f96ce06

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/browser/src/get-stories.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable no-underscore-dangle */
22

3-
const getStories = (window) => {
3+
const getStories = async (window) => {
44
const getStorybook =
55
(window.__STORYBOOK_CLIENT_API__ && window.__STORYBOOK_CLIENT_API__.raw) ||
66
(window.loki && window.loki.getStorybook);
@@ -19,6 +19,13 @@ const getStories = (window) => {
1919
'storySource',
2020
];
2121

22+
if (
23+
window.__STORYBOOK_CLIENT_API__.storyStore &&
24+
window.__STORYBOOK_CLIENT_API__.storyStore.cacheAllCSFFiles
25+
) {
26+
await window.__STORYBOOK_CLIENT_API__.storyStore.cacheAllCSFFiles();
27+
}
28+
2229
const isSerializable = (value) => {
2330
try {
2431
JSON.stringify(value);

packages/runner/src/commands/test/default-options.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"chromeFlags": "--headless --disable-gpu --hide-scrollbars",
99
"chromeLoadTimeout": "60000",
1010
"chromeRetries": "0",
11-
"chromeSelector": "#root > *",
11+
"chromeSelector": "#root > *, #storybook-root > *",
1212
"chromeTolerance": "0",
1313
"host": "localhost",
1414
"output": "./.loki/current",

0 commit comments

Comments
 (0)