@cosmicdrift/kumiko-testing 0.331.0 → 0.333.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/package.json +4 -4
- package/src/e2e/screenshots.ts +32 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-testing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.333.0",
|
|
4
4
|
"description": "Test template for Kumiko apps: per-flow seedTenant, app test stack, canonical test preloads, bunfig generator and integration runner.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -75,9 +75,9 @@
|
|
|
75
75
|
"kumiko-testing": "./bin/kumiko-testing.ts"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@cosmicdrift/kumiko-bundled-features": "0.
|
|
79
|
-
"@cosmicdrift/kumiko-dev-server": "0.
|
|
80
|
-
"@cosmicdrift/kumiko-framework": "0.
|
|
78
|
+
"@cosmicdrift/kumiko-bundled-features": "0.333.0",
|
|
79
|
+
"@cosmicdrift/kumiko-dev-server": "0.333.0",
|
|
80
|
+
"@cosmicdrift/kumiko-framework": "0.333.0",
|
|
81
81
|
"zod": "^4.4.3"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
package/src/e2e/screenshots.ts
CHANGED
|
@@ -284,12 +284,36 @@ export function runScreenshots(scenarios: readonly Scenario[], opts: FlatOptions
|
|
|
284
284
|
|
|
285
285
|
const VIEWPORT_IDS = ["desktop", "tablet", "mobile"] as const;
|
|
286
286
|
export type ViewportId = (typeof VIEWPORT_IDS)[number];
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
287
|
+
const SCREENSHOT_DESKTOP_WIDTH_ENV = "SCREENSHOT_DESKTOP_WIDTH";
|
|
288
|
+
|
|
289
|
+
// Design reviews at a narrower desktop (e.g. 1440) set SCREENSHOT_DESKTOP_WIDTH;
|
|
290
|
+
// the height stays DESKTOP_VIEWPORT's. Throws on junk instead of silently
|
|
291
|
+
// falling back to 1920 and producing screenshots at the wrong width.
|
|
292
|
+
export function resolveDesktopViewport(rawWidth: string | undefined): {
|
|
293
|
+
readonly width: number;
|
|
294
|
+
readonly height: number;
|
|
295
|
+
} {
|
|
296
|
+
if (rawWidth === undefined || rawWidth.trim() === "") return DESKTOP_VIEWPORT;
|
|
297
|
+
const width = Number(rawWidth);
|
|
298
|
+
if (!Number.isInteger(width) || width <= 0) {
|
|
299
|
+
throw new Error(
|
|
300
|
+
`${SCREENSHOT_DESKTOP_WIDTH_ENV}="${rawWidth}" is not a positive integer pixel width.`,
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
return { width, height: DESKTOP_VIEWPORT.height };
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function resolveViewports(): Record<
|
|
307
|
+
ViewportId,
|
|
308
|
+
{ readonly width: number; readonly height: number }
|
|
309
|
+
> {
|
|
310
|
+
return {
|
|
311
|
+
desktop: resolveDesktopViewport(process.env[SCREENSHOT_DESKTOP_WIDTH_ENV]),
|
|
312
|
+
// Landscape: portrait tablet shots collapsed two-column layouts into the mobile stack.
|
|
313
|
+
tablet: { width: 1112, height: 834 },
|
|
314
|
+
mobile: { width: 390, height: 844 },
|
|
315
|
+
};
|
|
316
|
+
}
|
|
293
317
|
|
|
294
318
|
// Narrow the axis from env (CSV) or take the default. Filters instead of
|
|
295
319
|
// casting: a typo in the env var (e.g. SCREENSHOT_VIEWPORTS=typo) would
|
|
@@ -452,6 +476,7 @@ export function runMatrix<T extends string>(
|
|
|
452
476
|
const themes = axis(process.env["SCREENSHOT_THEMES"], opts.themes);
|
|
453
477
|
const viewports = axis(process.env["SCREENSHOT_VIEWPORTS"], VIEWPORT_IDS);
|
|
454
478
|
const only = process.env["SCREENSHOT_ONLY"];
|
|
479
|
+
const viewportSizes = resolveViewports();
|
|
455
480
|
|
|
456
481
|
for (const locale of locales) {
|
|
457
482
|
test.describe(locale, () => {
|
|
@@ -501,7 +526,7 @@ export function runMatrix<T extends string>(
|
|
|
501
526
|
for (const theme of themes) {
|
|
502
527
|
await opts.applyTheme(page, theme);
|
|
503
528
|
for (const vp of plan.viewports) {
|
|
504
|
-
if (plan.mode === "desktop") await page.setViewportSize(
|
|
529
|
+
if (plan.mode === "desktop") await page.setViewportSize(viewportSizes[vp]);
|
|
505
530
|
await waitForSettledPage(page, inFlightDataRequests);
|
|
506
531
|
if (s.beforeCapture) await s.beforeCapture(page);
|
|
507
532
|
await presentIdentitiesOnPage(page, identities.mappings);
|