@argos-ci/storybook 6.0.16 → 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.
@@ -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
- }, applyFitToContent(screenshotOptions, fitToContent));
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.16",
4
+ "version": "6.0.17",
5
5
  "author": "Smooth Code",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -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": "7db853496fdaad253d005fb30c4b47269972b7b0"
101
+ "gitHead": "3502fe8f348376405f56703b351037150d2c9136"
102
102
  }