@argos-ci/storybook 5.0.5 → 5.0.7-alpha.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/dist/test-runner.js +3 -2
- package/dist/vitest-plugin.d.ts +1 -1
- package/dist/vitest-plugin.js +20 -12
- package/dist/vitest.d.ts +1 -1
- package/package.json +6 -6
package/dist/test-runner.js
CHANGED
|
@@ -111,7 +111,7 @@ async function storybookArgosScreenshot(handler, context, options) {
|
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
113
|
allAttachments.push(...attachments);
|
|
114
|
-
await context.setViewportSize("
|
|
114
|
+
await context.setViewportSize("initial");
|
|
115
115
|
await handler.evaluate(() => {
|
|
116
116
|
delete globalThis.__ARGOS_CURRENT_MODE;
|
|
117
117
|
});
|
|
@@ -124,6 +124,7 @@ async function storybookArgosScreenshot(handler, context, options) {
|
|
|
124
124
|
options: argosOptions,
|
|
125
125
|
globals: context.story.globals ?? {}
|
|
126
126
|
});
|
|
127
|
+
await context.setViewportSize("initial");
|
|
127
128
|
allAttachments.push(...attachments);
|
|
128
129
|
}
|
|
129
130
|
} else if (context.mode === "manual") {
|
|
@@ -241,7 +242,7 @@ async function argosScreenshot(page, context, options) {
|
|
|
241
242
|
},
|
|
242
243
|
setViewportSize: async (size) => {
|
|
243
244
|
const actualSize = await page.viewportSize();
|
|
244
|
-
const absoluteSize = size === "default" ? DEFAULT_PLAYWRIGHT_VIEWPORT_SIZE : size;
|
|
245
|
+
const absoluteSize = size === "default" || size === "initial" ? DEFAULT_PLAYWRIGHT_VIEWPORT_SIZE : size;
|
|
245
246
|
if (!actualSize || actualSize.height !== absoluteSize.height || actualSize.width !== absoluteSize.width) {
|
|
246
247
|
await page.setViewportSize(absoluteSize);
|
|
247
248
|
await page.waitForFunction(
|
package/dist/vitest-plugin.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ type StorybookScreenshotContext<Handler extends Page | Frame> = {
|
|
|
15
15
|
name: string;
|
|
16
16
|
playwrightLibraries: string[];
|
|
17
17
|
test?: MetadataConfig["test"];
|
|
18
|
-
setViewportSize: (size: ViewportSize | "default") => Promise<void>;
|
|
18
|
+
setViewportSize: (size: ViewportSize | "default" | "initial") => Promise<void>;
|
|
19
19
|
beforeScreenshot?: (input: {
|
|
20
20
|
handler: Handler;
|
|
21
21
|
globals: StorybookGlobals;
|
package/dist/vitest-plugin.js
CHANGED
|
@@ -108,7 +108,7 @@ async function storybookArgosScreenshot(handler, context, options) {
|
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
110
|
allAttachments.push(...attachments);
|
|
111
|
-
await context.setViewportSize("
|
|
111
|
+
await context.setViewportSize("initial");
|
|
112
112
|
await handler.evaluate(() => {
|
|
113
113
|
delete globalThis.__ARGOS_CURRENT_MODE;
|
|
114
114
|
});
|
|
@@ -121,6 +121,7 @@ async function storybookArgosScreenshot(handler, context, options) {
|
|
|
121
121
|
options: argosOptions,
|
|
122
122
|
globals: context.story.globals ?? {}
|
|
123
123
|
});
|
|
124
|
+
await context.setViewportSize("initial");
|
|
124
125
|
allAttachments.push(...attachments);
|
|
125
126
|
}
|
|
126
127
|
} else if (context.mode === "manual") {
|
|
@@ -263,19 +264,26 @@ var createArgosScreenshotCommand = (pluginOptions) => {
|
|
|
263
264
|
if (!iframe.contentDocument) {
|
|
264
265
|
throw new Error("Vitest iframe contentDocument not found");
|
|
265
266
|
}
|
|
266
|
-
if (size2 === "
|
|
267
|
-
if (iframe.dataset.
|
|
268
|
-
iframe.style.width = iframe.dataset.
|
|
269
|
-
iframe.style.height = iframe.dataset.
|
|
267
|
+
if (size2 === "initial") {
|
|
268
|
+
if (iframe.dataset.initialWidth && iframe.dataset.initialHeight) {
|
|
269
|
+
iframe.style.width = iframe.dataset.initialWidth;
|
|
270
|
+
iframe.style.height = iframe.dataset.initialHeight;
|
|
270
271
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (!iframe.dataset.initialWidth && !iframe.dataset.initialHeight) {
|
|
275
|
+
iframe.dataset.initialWidth = iframe.style.width;
|
|
276
|
+
iframe.dataset.initialHeight = iframe.style.height;
|
|
277
|
+
}
|
|
278
|
+
if (size2 !== "default") {
|
|
277
279
|
iframe.style.width = `${size2.width}px`;
|
|
278
|
-
|
|
280
|
+
}
|
|
281
|
+
if (fullPage) {
|
|
282
|
+
iframe.style.height = "auto";
|
|
283
|
+
iframe.style.height = `${iframe.contentDocument.body.offsetHeight}px`;
|
|
284
|
+
} else if (size2 !== "default") {
|
|
285
|
+
iframe.style.height = "auto";
|
|
286
|
+
iframe.style.height = `${size2.height}px`;
|
|
279
287
|
}
|
|
280
288
|
},
|
|
281
289
|
{ size, fullPage: screenshotOptions.fullPage ?? !fitToContent }
|
package/dist/vitest.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ type StorybookScreenshotContext<Handler extends Page | Frame> = {
|
|
|
13
13
|
name: string;
|
|
14
14
|
playwrightLibraries: string[];
|
|
15
15
|
test?: MetadataConfig["test"];
|
|
16
|
-
setViewportSize: (size: ViewportSize | "default") => Promise<void>;
|
|
16
|
+
setViewportSize: (size: ViewportSize | "default" | "initial") => Promise<void>;
|
|
17
17
|
beforeScreenshot?: (input: {
|
|
18
18
|
handler: Handler;
|
|
19
19
|
globals: StorybookGlobals;
|
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": "5.0.
|
|
4
|
+
"version": "5.0.7-alpha.0+d1894ac",
|
|
5
5
|
"author": "Smooth Code",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
"node": ">=20.0.0"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@argos-ci/playwright": "6.1.
|
|
54
|
-
"@argos-ci/util": "3.1.
|
|
53
|
+
"@argos-ci/playwright": "6.1.9-alpha.4+d1894ac",
|
|
54
|
+
"@argos-ci/util": "3.1.2-alpha.4+d1894ac"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@argos-ci/cli": "3.1.
|
|
58
|
-
"@argos-ci/core": "4.2.
|
|
57
|
+
"@argos-ci/cli": "3.1.1-alpha.4+d1894ac",
|
|
58
|
+
"@argos-ci/core": "4.2.1-alpha.4+d1894ac",
|
|
59
59
|
"@argos-ci/util": "workspace:*",
|
|
60
60
|
"@storybook/addon-docs": "^9.1.10",
|
|
61
61
|
"@storybook/addon-links": "^9.1.10",
|
|
@@ -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": "d1894acc62fb886d4673c88cc7e8cc95e81db78b"
|
|
102
102
|
}
|