Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "storywright",
"description": "Storybook setup.",
"license": "MIT",
"version": "0.0.27-storybook7.14",
"version": "0.0.27-storybook7.15",
"main": "lib/index.js",
"module": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/StoryWrightProcessor/GetStoriesV2.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function getStoriesWithSteps() {
const errors = [];
for (let story of Object.values(stories)) {
try {
const steps = story.parameters?.storyWright.steps;
const steps = story.parameters?.storyWright?.steps;
if (Array.isArray(steps)) {
story.steps = steps;
}
Expand Down
9 changes: 9 additions & 0 deletions src/StoryWrightProcessor/StoryWrightProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ export class StoryWrightProcessor {
};
const getStoriesScriptPath = scriptKind[options.stepsApi];
const getStoriesScript = readFileSync(getStoriesScriptPath, "utf8");

if (options.stepsApi === "parameters") {
// Wait for Storybook Preview API to be available
// it's used in GetStoriesV2.js to access story parameters
await page.waitForFunction(() => {
return window["__STORYBOOK_PREVIEW__"];
});
}

const { storiesWithSteps, errors } = await page.evaluate<{
storiesWithSteps: Story[];
errors: string[];
Expand Down