@argos-ci/storybook 6.0.15 → 6.0.17
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/dist/vitest-plugin.mjs +16 -1
- package/package.json +3 -3
package/dist/vitest-plugin.mjs
CHANGED
|
@@ -270,6 +270,21 @@ const createArgosScreenshotCommand = (pluginOptions) => {
|
|
|
270
270
|
const frame = await ctx.frame();
|
|
271
271
|
const fitToContent = getFitToContentFromParameters(testContext.story.parameters);
|
|
272
272
|
const after = await before(ctx);
|
|
273
|
+
const options = applyFitToContent(screenshotOptions, fitToContent);
|
|
274
|
+
const userBeforeScreenshot = options?.beforeScreenshot;
|
|
275
|
+
const optionsWithFit = {
|
|
276
|
+
...options,
|
|
277
|
+
beforeScreenshot: async (api) => {
|
|
278
|
+
await userBeforeScreenshot?.(api);
|
|
279
|
+
await ctx.page.evaluate(() => {
|
|
280
|
+
const iframe = document.querySelector("iframe[data-vitest=\"true\"]");
|
|
281
|
+
if (!(iframe instanceof HTMLIFrameElement) || !iframe.contentDocument) return;
|
|
282
|
+
const { body, documentElement } = iframe.contentDocument;
|
|
283
|
+
const contentHeight = Math.max(body.scrollHeight, body.offsetHeight, documentElement.scrollHeight);
|
|
284
|
+
if (contentHeight > iframe.clientHeight) iframe.style.height = `${contentHeight}px`;
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
};
|
|
273
288
|
const attachments = await storybookArgosScreenshot(frame, {
|
|
274
289
|
...testContext,
|
|
275
290
|
playwrightLibraries: ["@storybook/addon-vitest"],
|
|
@@ -304,7 +319,7 @@ const createArgosScreenshotCommand = (pluginOptions) => {
|
|
|
304
319
|
fullPage: screenshotOptions.fullPage ?? !fitToContent
|
|
305
320
|
});
|
|
306
321
|
}
|
|
307
|
-
},
|
|
322
|
+
}, optionsWithFit);
|
|
308
323
|
await after();
|
|
309
324
|
return attachments;
|
|
310
325
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argos-ci/storybook",
|
|
3
3
|
"description": "Visual testing for Storybook test runner.",
|
|
4
|
-
"version": "6.0.
|
|
4
|
+
"version": "6.0.17",
|
|
5
5
|
"author": "Smooth Code",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@argos-ci/core": "6.4.0",
|
|
53
|
-
"@argos-ci/playwright": "7.
|
|
53
|
+
"@argos-ci/playwright": "7.3.0",
|
|
54
54
|
"@argos-ci/util": "4.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
@@ -98,5 +98,5 @@
|
|
|
98
98
|
"check-format": "prettier --check --ignore-unknown --ignore-path=./.gitignore --ignore-path=../../.gitignore --ignore-path=../../.prettierignore .",
|
|
99
99
|
"lint": "eslint ."
|
|
100
100
|
},
|
|
101
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "3502fe8f348376405f56703b351037150d2c9136"
|
|
102
102
|
}
|