storybook-addon-playwright 5.8.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -33
- package/dist/api/server/routes.js +8 -8
- package/dist/api/server/routes.js.map +1 -1
- package/dist/api/server/routes.mjs +8 -8
- package/dist/api/server/routes.mjs.map +1 -1
- package/dist/get-screenshots.js +2 -2
- package/dist/get-screenshots.js.map +1 -1
- package/dist/get-screenshots.mjs +2 -2
- package/dist/get-screenshots.mjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/dist/run-image-diff.js +2 -2
- package/dist/run-image-diff.js.map +1 -1
- package/dist/run-image-diff.mjs +2 -2
- package/dist/run-image-diff.mjs.map +1 -1
- package/dist/to-match-screenshots.js +3 -3
- package/dist/to-match-screenshots.js.map +1 -1
- package/dist/to-match-screenshots.mjs +3 -3
- package/dist/to-match-screenshots.mjs.map +1 -1
- package/dist/trpc/router.d.mts +11 -0
- package/dist/trpc/router.d.ts +11 -0
- package/dist/trpc/router.js +8 -8
- package/dist/trpc/router.js.map +1 -1
- package/dist/trpc/router.mjs +8 -8
- package/dist/trpc/router.mjs.map +1 -1
- package/package.json +2 -9
- package/decorator.d.ts +0 -1
- package/decorator.js +0 -1
- package/dist/decorator/index.d.mts +0 -15
- package/dist/decorator/index.d.ts +0 -15
- package/dist/decorator/index.js +0 -2
- package/dist/decorator/index.js.map +0 -1
- package/dist/decorator/index.mjs +0 -2
- package/dist/decorator/index.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -83,43 +83,30 @@ module.exports = function (router) {
|
|
|
83
83
|
|
|
84
84
|
### Story Readiness Before Screenshot
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
By default, the addon waits for Storybook to settle by checking `#storybook-root` before taking screenshots. This behavior is enabled by default because `waitForStoryRender` is `true`. Set `waitForStoryRender: false` to disable it.
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
If your story needs an extra selector wait, do it explicitly in `beforeScreenshot`:
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
export default preview;
|
|
90
|
+
```js
|
|
91
|
+
setConfig({
|
|
92
|
+
storybookEndpoint: 'http://localhost:6006/',
|
|
93
|
+
getPage: async (browserType, options) => {
|
|
94
|
+
await ready;
|
|
95
|
+
return await browsers[browserType].newPage(options);
|
|
96
|
+
},
|
|
97
|
+
beforeScreenshot: async (page, data) => {
|
|
98
|
+
await page
|
|
99
|
+
.frameLocator('iframe')
|
|
100
|
+
.locator('.my-selector')
|
|
101
|
+
.waitFor({ state: 'visible', timeout: 10000 });
|
|
102
|
+
},
|
|
103
|
+
afterScreenshot: async (page) => {
|
|
104
|
+
await page.close();
|
|
105
|
+
},
|
|
106
|
+
});
|
|
109
107
|
```
|
|
110
108
|
|
|
111
|
-
This
|
|
112
|
-
|
|
113
|
-
What the React decorator does:
|
|
114
|
-
|
|
115
|
-
- Sets `data-playwright-mounted="pending"` immediately so marker mode is enabled.
|
|
116
|
-
- Updates the value to `"true"` after React mounts.
|
|
117
|
-
- Removes the attribute on unmount.
|
|
118
|
-
|
|
119
|
-
For non-React frameworks (Vue, Svelte, Angular, etc.), create a small framework-specific decorator/composable that follows the same marker contract:
|
|
120
|
-
|
|
121
|
-
- Set `data-playwright-mounted="pending"` before mount.
|
|
122
|
-
- Set `data-playwright-mounted="true"` when mounted.
|
|
109
|
+
This keeps the readiness logic in your config instead of relying on framework-specific mounting code.
|
|
123
110
|
|
|
124
111
|
## setConfig Options
|
|
125
112
|
|
|
@@ -346,6 +333,7 @@ beforeAll(async () => {
|
|
|
346
333
|
|
|
347
334
|
setConfig({
|
|
348
335
|
storybookEndpoint: 'http://localhost:6006/', // or './storybook-static'
|
|
336
|
+
storyRenderTimeout: 30000,
|
|
349
337
|
getPage: async (browserType, options) => {
|
|
350
338
|
return await browsers[browserType].newPage(options);
|
|
351
339
|
},
|
|
@@ -389,6 +377,7 @@ beforeAll(async () => {
|
|
|
389
377
|
};
|
|
390
378
|
setConfig({
|
|
391
379
|
storybookEndpoint: 'http://localhost:6006/', // or './storybook-static'
|
|
380
|
+
storyRenderTimeout: 30000,
|
|
392
381
|
getPage: async (browserType, options) => {
|
|
393
382
|
return await browsers[browserType].newPage(options);
|
|
394
383
|
},
|