Skip to content

Commit

Permalink
fix: overlay config's autoScreenshotStorybookGlobals with story's value
Browse files Browse the repository at this point in the history
  • Loading branch information
KuznetsovRoman committed Nov 7, 2024
1 parent 8f86dca commit 6340f85
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ For example, with `autoScreenshotStorybookGlobals` set to:

If you have `ts-node` in your project, you can write your Testplane tests right inside of storybook story files:

> ⚠️ *Storybook story files must have `.js` or `.ts` extension for this to work*
```ts
import type { StoryObj } from "@storybook/react";
import type { WithTestplane } from "@testplane/storybook"
Expand Down Expand Up @@ -125,9 +123,7 @@ const meta: WithTestplane<Meta<typeof Button>> = {
skip: false, // if true, skips all Testplane tests from this story file
autoscreenshotSelector: ".my-selector", // Custom selector to auto-screenshot elements
browserIds: ["chrome"], // Testplane browsers to run tests from this story file
autoScreenshotStorybookGlobals: {
// override default autoScreenshotStorybookGlobals options from plugin config
// tests for default autoScreenshotStorybookGlobals from plugin config won't be generated
autoScreenshotStorybookGlobals: { // add extra storybook global suites to the plugin config
"es locale": { locale: "es" },
"fr locale": { locale: "fr" }
},
Expand Down
7 changes: 4 additions & 3 deletions src/storybook/story-test-runner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ function createTestplaneTests(
{ autoScreenshots, autoScreenshotStorybookGlobals }: TestplaneOpts,
): void {
nestedDescribe(story, () => {
const rawAutoScreenshotGlobalSets = Object.keys(story.autoScreenshotStorybookGlobals).length
? story.autoScreenshotStorybookGlobals
: autoScreenshotStorybookGlobals;
const rawAutoScreenshotGlobalSets = {
...autoScreenshotStorybookGlobals,
...story.autoScreenshotStorybookGlobals,
};

const screenshotGlobalSetNames = Object.keys(rawAutoScreenshotGlobalSets);

Expand Down

0 comments on commit 6340f85

Please sign in to comment.