@specific.dev/spectest 0.24.0 → 0.26.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/browser.ts +13 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@specific.dev/spectest",
3
- "version": "0.24.0",
3
+ "version": "0.26.0",
4
4
  "description": "Spectest SDK for defining test environments in TypeScript.",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
package/src/browser.ts CHANGED
@@ -403,6 +403,12 @@ function deviceContextOptions(d: DevicePreset) {
403
403
  isMobile: d.isMobile,
404
404
  hasTouch: d.hasTouch,
405
405
  userAgent: d.userAgent,
406
+ // Emulate `prefers-reduced-motion: reduce` for replay fidelity — an app
407
+ // that honors it skips entrance animations/transitions, so rrweb's
408
+ // per-op FullSnapshot captures the settled DOM instead of a mid-fade
409
+ // (opacity 0) frame that a paused seek would freeze on. Applied at every
410
+ // newContext site below so all sessions record the same way.
411
+ reducedMotion: "reduce" as const,
406
412
  };
407
413
  }
408
414
 
@@ -411,6 +417,8 @@ async function ensureDesktopContext(): Promise<BrowserContext> {
411
417
  if (DESKTOP_CTX) return DESKTOP_CTX;
412
418
  DESKTOP_CTX = await browser.newContext({
413
419
  viewport: { width: 1280, height: 720 },
420
+ // Reduced-motion for replay fidelity — see deviceContextOptions.
421
+ reducedMotion: "reduce",
414
422
  });
415
423
  DESKTOP_CTX.setDefaultTimeout(DEFAULT_ACTION_TIMEOUT_MS);
416
424
  DESKTOP_CTX.setDefaultNavigationTimeout(NAVIGATION_TIMEOUT_MS);
@@ -1031,7 +1039,11 @@ async function contextFor(
1031
1039
  return { context: await ensureDesktopContext(), ownsContext: false };
1032
1040
  }
1033
1041
  const browser = await ensurePlaywrightBrowser();
1034
- const context = await browser.newContext({ viewport: { width, height } });
1042
+ const context = await browser.newContext({
1043
+ viewport: { width, height },
1044
+ // Reduced-motion for replay fidelity — see deviceContextOptions.
1045
+ reducedMotion: "reduce",
1046
+ });
1035
1047
  context.setDefaultTimeout(DEFAULT_ACTION_TIMEOUT_MS);
1036
1048
  context.setDefaultNavigationTimeout(NAVIGATION_TIMEOUT_MS);
1037
1049
  return { context, ownsContext: true };