@specific.dev/spectest 0.17.0 → 0.17.1

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/daemon.ts +17 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@specific.dev/spectest",
3
- "version": "0.17.0",
3
+ "version": "0.17.1",
4
4
  "description": "Spectest SDK for defining test environments in TypeScript.",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
package/src/daemon.ts CHANGED
@@ -2967,6 +2967,13 @@ interface BrowserSessionRecord {
2967
2967
  * (phone bezel). Drives the dashboard's chrome; the rrweb events are
2968
2968
  * identical either way. */
2969
2969
  frame?: "browser" | "mobile";
2970
+ /** Safe-area insets that were CDP-emulated during capture (mobile
2971
+ * sessions on a Chromium that supports the override). The dashboard
2972
+ * substitutes these for `env(safe-area-inset-*)` in the replayed CSS —
2973
+ * the replay iframe evaluates env() to 0, which would collapse the
2974
+ * app's own status-bar/home-indicator padding and shift every recorded
2975
+ * touch coordinate. Absent on desktop sessions and legacy captures. */
2976
+ safeAreaInsets?: { top: number; right: number; bottom: number; left: number };
2970
2977
  steps: BrowserSessionStep[];
2971
2978
  }
2972
2979
 
@@ -3810,6 +3817,9 @@ async function runOne(testCase: TestCase<unknown>): Promise<RunResult> {
3810
3817
  ...(opts ?? {}),
3811
3818
  recorder: session.recorder,
3812
3819
  });
3820
+ if (browser.safeAreaInsets) {
3821
+ session.record.safeAreaInsets = browser.safeAreaInsets;
3822
+ }
3813
3823
  // An attached session starts mid-page (no navigate event will fire) —
3814
3824
  // stamp the inherited URL so the dashboard can still label the replay.
3815
3825
  if (attached && session.record.initialUrl === undefined) {
@@ -3837,10 +3847,11 @@ async function runOne(testCase: TestCase<unknown>): Promise<RunResult> {
3837
3847
  if (existing) return existing;
3838
3848
  const session = newBrowserSession(start, testCase.id, "mobile");
3839
3849
  sessions.push(session);
3840
- const { mobile, attached, detach } = await openPersistentMobile({
3850
+ const { mobile, attached, detach, safeAreaInsets } = await openPersistentMobile({
3841
3851
  url: app.url,
3842
3852
  recorder: session.recorder,
3843
3853
  });
3854
+ if (safeAreaInsets) session.record.safeAreaInsets = safeAreaInsets;
3844
3855
  if (attached && session.record.initialUrl === undefined) {
3845
3856
  session.record.initialUrl = mobile.url;
3846
3857
  }
@@ -4124,6 +4135,9 @@ async function evalCode(
4124
4135
  ...(opts ?? {}),
4125
4136
  recorder: session.recorder,
4126
4137
  });
4138
+ if (browser.safeAreaInsets) {
4139
+ session.record.safeAreaInsets = browser.safeAreaInsets;
4140
+ }
4127
4141
  if (attached && session.record.initialUrl === undefined) {
4128
4142
  session.record.initialUrl = browser.url;
4129
4143
  }
@@ -4149,10 +4163,11 @@ async function evalCode(
4149
4163
  if (existing) return existing;
4150
4164
  const session = newBrowserSession(start, "eval", "mobile");
4151
4165
  sessions.push(session);
4152
- const { mobile, attached, detach } = await openPersistentMobile({
4166
+ const { mobile, attached, detach, safeAreaInsets } = await openPersistentMobile({
4153
4167
  url: app.url,
4154
4168
  recorder: session.recorder,
4155
4169
  });
4170
+ if (safeAreaInsets) session.record.safeAreaInsets = safeAreaInsets;
4156
4171
  if (attached && session.record.initialUrl === undefined) {
4157
4172
  session.record.initialUrl = mobile.url;
4158
4173
  }