@testver/testver 1.2.2 → 1.2.4

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.
@@ -65,8 +65,29 @@ def _prefix_key(key):
65
65
  return "appium:" + key
66
66
 
67
67
 
68
+ def _vendor_from_testver():
69
+ """The vendor block Testver built for this run (each vendor's own field
70
+ names, the tunnel, the picked device) — TESTVER_VENDOR_OPTIONS."""
71
+ raw = os.environ.get("TESTVER_VENDOR_OPTIONS")
72
+ if not raw:
73
+ return None
74
+ try:
75
+ block = json.loads(raw)
76
+ return block if isinstance(block, dict) and block.get("key") else None
77
+ except Exception:
78
+ return None
79
+
80
+
68
81
  def _provider_options_block(existing):
69
82
  """Build the provider-specific options block (bstack:/sauce:/LT:)."""
83
+ vendor = _vendor_from_testver()
84
+ if vendor:
85
+ # names / tunnel: the project's own values win; the device picked in
86
+ # the Runner wins over the project's
87
+ merged = dict(vendor.get("options") or {})
88
+ merged.update(existing or {})
89
+ merged.update(vendor.get("overrides") or {})
90
+ return merged
70
91
  provider = os.environ.get("TESTVER_PROVIDER")
71
92
  device = os.environ.get("TESTVER_DEVICE_NAME")
72
93
  os_ver = os.environ.get("TESTVER_PLATFORM_VERSION")
@@ -106,13 +127,39 @@ def _provider_options_block(existing):
106
127
 
107
128
 
108
129
  def _provider_options_key():
130
+ vendor = _vendor_from_testver()
131
+ if vendor:
132
+ return vendor.get("key")
109
133
  return {
110
134
  "browserstack": "bstack:options",
111
135
  "saucelabs": "sauce:options",
112
- "lambdatest": "LT:Options",
136
+ "lambdatest": "lt:options",
113
137
  }.get(os.environ.get("TESTVER_PROVIDER"))
114
138
 
115
139
 
140
+ def _env_json(name):
141
+ try:
142
+ value = json.loads(os.environ.get(name) or "{}")
143
+ return value if isinstance(value, dict) else {}
144
+ except ValueError:
145
+ return {}
146
+
147
+
148
+ def _apply_local_caps(caps):
149
+ """Local Devices (Settings → Local Devices): capabilities the project
150
+ doesn't set itself (TESTVER_LOCAL_CAPS_DEFAULTS — WebDriverAgent port and
151
+ signing), then Testver's own over the project's (TESTVER_LOCAL_CAPS —
152
+ app launch mode)."""
153
+ for k, v in _env_json("TESTVER_LOCAL_CAPS_DEFAULTS").items():
154
+ bare = k[len("appium:"):] if k.startswith("appium:") else k
155
+ if k not in caps and bare not in caps:
156
+ caps[k] = v
157
+ for k, v in _env_json("TESTVER_LOCAL_CAPS").items():
158
+ bare = k[len("appium:"):] if k.startswith("appium:") else k
159
+ caps.pop(bare, None)
160
+ caps[k] = v
161
+
162
+
116
163
  def _apply_caps_to_dict(caps):
117
164
  """Mutate a flat capabilities dict in place with Testver overrides."""
118
165
  # Normalise any legacy unprefixed Appium keys.
@@ -132,7 +179,23 @@ def _apply_caps_to_dict(caps):
132
179
  caps["appium:deviceName"] = device
133
180
  if os_ver:
134
181
  caps["appium:platformVersion"] = os_ver
182
+ # The device: a local one by its serial / udid (Appium picks the device
183
+ # by appium:udid, never by deviceName); on a vendor's cloud a local
184
+ # udid / AVD means nothing.
185
+ udid = os.environ.get("TESTVER_DEVICE_UDID")
186
+ if os.environ.get("TESTVER_PROVIDER") == "local-appium":
187
+ if udid:
188
+ caps["appium:udid"] = udid
189
+ caps.pop("appium:avd", None)
190
+ _apply_local_caps(caps)
191
+ else:
192
+ caps.pop("appium:udid", None)
193
+ caps.pop("appium:avd", None)
135
194
  if app:
195
+ # the project's own package / bundle id, for the reset on a reused
196
+ # session (it is dropped from the caps just below)
197
+ _project_app_id["value"] = (caps.get("appium:appPackage") or caps.get("appium:bundleId")
198
+ or _project_app_id["value"])
136
199
  caps["appium:app"] = app
137
200
  # Drop app-identifier caps that may belong to a different build —
138
201
  # cloud providers auto-detect these from the uploaded binary.
@@ -149,6 +212,9 @@ def _apply_caps_to_dict(caps):
149
212
 
150
213
  pkey = _provider_options_key()
151
214
  if pkey:
215
+ # the project's own spelling of the block (`LT:Options` / `lt:options`)
216
+ if pkey not in caps:
217
+ pkey = next((k for k in caps if isinstance(k, str) and k.lower() == pkey.lower()), pkey)
152
218
  caps[pkey] = _provider_options_block(caps.get(pkey))
153
219
  return caps
154
220
 
@@ -170,7 +236,9 @@ def _inject_into_options(options):
170
236
  # Caps that _apply_caps_to_dict deliberately removed (the stale
171
237
  # app-identifier caps when an app URL is supplied) must be deleted
172
238
  # from the options object too — set_capability only adds/overwrites.
173
- dropped = set(existing.keys()) - set(merged.keys())
239
+ # (by the namespaced name: a legacy `automationName` the client lists
240
+ # unprefixed lives on as `appium:automationName` — it isn't dropped)
241
+ dropped = {k for k in existing.keys() if _prefix_key(k) not in merged}
174
242
  for k in dropped:
175
243
  removed = False
176
244
  internal = getattr(options, "_caps", None)
@@ -237,6 +305,8 @@ def _report_external_session(driver):
237
305
  "deviceName": os.environ.get("TESTVER_DEVICE_NAME"),
238
306
  "platformName": os.environ.get("TESTVER_PLATFORM_NAME"),
239
307
  "providerId": os.environ.get("TESTVER_PROVIDER"),
308
+ # the run that opened it (several runs of one tab side by side)
309
+ "runId": os.environ.get("TESTVER_RUN_ID"),
240
310
  })
241
311
  _log("Reported session " + str(sid)[:12] + "... for live preview")
242
312
 
@@ -258,12 +328,16 @@ def _unreport_external_session():
258
328
 
259
329
  # ── App reset on attach ──────────────────────────────────────────────────────
260
330
 
331
+ _project_app_id = {"value": None}
332
+
333
+
261
334
  def _reset_app_on_attach(driver, caps):
262
335
  if os.environ.get("TESTVER_SKIP_APP_RESET") == "1":
263
336
  return
264
337
  app_id = (
265
338
  (caps or {}).get("appium:appPackage")
266
339
  or (caps or {}).get("appium:bundleId")
340
+ or _project_app_id["value"]
267
341
  or os.environ.get("TESTVER_APP_PACKAGE")
268
342
  or os.environ.get("TESTVER_APP_BUNDLE_ID")
269
343
  )
@@ -311,6 +385,19 @@ def _patch_remote(remote_cls):
311
385
  args = (hub,) + tuple(args[1:])
312
386
  else:
313
387
  kwargs["command_executor"] = hub
388
+ # Appium-Python-Client 5+ (and AppiumLibrary 3+) pass a
389
+ # client_config whose server address wins over command_executor.
390
+ cc = kwargs.get("client_config")
391
+ if cc is not None and hasattr(cc, "remote_server_addr"):
392
+ try:
393
+ cc.remote_server_addr = hub
394
+ user = os.environ.get("APPIUM_HUB_USER") or ""
395
+ key = os.environ.get("APPIUM_HUB_KEY") or ""
396
+ if user and hasattr(cc, "username"):
397
+ cc.username = user
398
+ cc.password = key
399
+ except Exception as exc: # pragma: no cover
400
+ _log("could not redirect client_config: %s" % exc)
314
401
  # 2. Inject capabilities (AppiumOptions or desired_capabilities dict).
315
402
  opts = kwargs.get("options")
316
403
  if opts is None:
@@ -0,0 +1,110 @@
1
+ """
2
+ Testver listener for Robot Framework.
3
+
4
+ Loaded automatically by Testver — nothing to add to a suite:
5
+ PYTHONPATH += <this dir>
6
+ ROBOT_OPTIONS += --listener testver_robot
7
+
8
+ What it does, only when Testver asks for it through the environment:
9
+
10
+ * Web cloud / Testver Grid runs (TESTVER_ROBOT_REMOTE=1): SeleniumLibrary's
11
+ ``Open Browser`` opens the browser on the hub in SELENIUM_REMOTE_URL
12
+ instead of on this machine. A ``remote_url`` the suite passes itself
13
+ is kept.
14
+ * Mobile runs (TESTVER_PROVIDER / APPIUM_HUB_HOST set): loads the
15
+ ``testver_appium`` agent, which points the Appium Python client that
16
+ AppiumLibrary uses at the chosen device / hub and adds the device and
17
+ app capabilities.
18
+
19
+ In any other run it does nothing.
20
+ """
21
+
22
+ import os
23
+ import sys
24
+
25
+ ROBOT_LISTENER_API_VERSION = 3
26
+
27
+ _state = {"selenium": False}
28
+
29
+
30
+ def _log(msg):
31
+ try:
32
+ sys.stderr.write("[testver-robot] " + str(msg) + "\n")
33
+ sys.stderr.flush()
34
+ except Exception:
35
+ pass
36
+
37
+
38
+ def _remote_url():
39
+ if os.environ.get("TESTVER_ROBOT_REMOTE") != "1":
40
+ return None
41
+ return os.environ.get("SELENIUM_REMOTE_URL") or None
42
+
43
+
44
+ def _no_remote(value):
45
+ # Open Browser's default is remote_url=False (a bool); "False"/"None"
46
+ # strings come from suites passing ${FALSE}-style values as text.
47
+ if not value:
48
+ return True
49
+ return isinstance(value, str) and value.strip().upper() in ("FALSE", "NONE")
50
+
51
+
52
+ def _patch_selenium_library():
53
+ """Make WebDriverCreator.create_driver use the hub when no remote_url is given."""
54
+ if _state["selenium"] or _remote_url() is None:
55
+ return
56
+ try:
57
+ from SeleniumLibrary.keywords import webdrivertools # type: ignore
58
+ except Exception:
59
+ return
60
+ creator = getattr(webdrivertools, "WebDriverCreator", None)
61
+ original = getattr(creator, "create_driver", None) if creator else None
62
+ if original is None or getattr(original, "_testver", False):
63
+ _state["selenium"] = True
64
+ return
65
+
66
+ def create_driver(self, *args, **kwargs):
67
+ hub = _remote_url()
68
+ if hub:
69
+ # create_driver(browser, desired_capabilities, remote_url, ...)
70
+ if "remote_url" in kwargs:
71
+ if _no_remote(kwargs.get("remote_url")):
72
+ kwargs["remote_url"] = hub
73
+ elif len(args) >= 3:
74
+ if _no_remote(args[2]):
75
+ args = args[:2] + (hub,) + args[3:]
76
+ else:
77
+ kwargs["remote_url"] = hub
78
+ return original(self, *args, **kwargs)
79
+
80
+ create_driver._testver = True # type: ignore[attr-defined]
81
+ creator.create_driver = create_driver
82
+ _state["selenium"] = True
83
+ _log("SeleniumLibrary browsers open on the Testver-selected hub")
84
+
85
+
86
+ def _load_appium_agent():
87
+ if os.environ.get("TESTVER_PROVIDER") or os.environ.get("APPIUM_HUB_HOST"):
88
+ try:
89
+ import testver_appium # noqa: F401 (installs itself on import)
90
+ except Exception as exc: # pragma: no cover
91
+ _log("Appium agent not loaded: %s" % exc)
92
+
93
+
94
+ _load_appium_agent()
95
+ _patch_selenium_library()
96
+
97
+
98
+ # ── listener hooks: libraries are imported as suites start ───────────────────
99
+
100
+ def start_suite(data, result):
101
+ _patch_selenium_library()
102
+
103
+
104
+ def start_test(data, result):
105
+ _patch_selenium_library()
106
+
107
+
108
+ def start_keyword(data, result):
109
+ if not _state["selenium"] and _remote_url() is not None:
110
+ _patch_selenium_library()
@@ -80,6 +80,8 @@ async function reportSession(browser) {
80
80
  deviceName: caps['appium:deviceName'] || process.env.TESTVER_DEVICE_NAME,
81
81
  platformName: caps.platformName || process.env.TESTVER_PLATFORM_NAME,
82
82
  providerId: process.env.TESTVER_PROVIDER,
83
+ // the run that opened it (several runs of one tab side by side)
84
+ runId: process.env.TESTVER_RUN_ID,
83
85
  });
84
86
  try {
85
87
  await fetch(reportUrl.replace(/\/$/, '') + '/api/mobile/session/register-external', {
@@ -129,14 +131,29 @@ class TestverAttachService {
129
131
 
130
132
  /**
131
133
  * `beforeSession` runs once per worker, BEFORE WDIO creates a session.
132
- * We pre-create `global.browser` via webdriverio.attach() — when WDIO
133
- * sees a browser already on globalThis, it skips its own POST /session.
134
- *
135
- * Returns a promise so WDIO awaits the attach before running tests.
134
+ * WDIO's runner (v7–v9) ATTACHES instead of opening a session when the
135
+ * worker's config carries a `sessionId` — so the reused session and the
136
+ * hub it lives on go onto that config. (A browser left on globalThis was
137
+ * never read: WDIO opened a fresh session on the same device, restarting
138
+ * UiAutomator2 under the AI Assistant's live session.)
136
139
  */
137
- async beforeSession(_config, _capabilities) {
140
+ async beforeSession(config, _capabilities) {
138
141
  const sid = process.env.TESTVER_REUSE_SESSION_ID;
139
142
  if (!sid) return; // No reuse — let WDIO open a fresh session.
143
+ if (config && typeof config === 'object') {
144
+ Object.assign(config, {
145
+ sessionId: sid,
146
+ hostname: process.env.APPIUM_HUB_HOST || config.hostname,
147
+ port: Number(process.env.APPIUM_HUB_PORT || config.port || 443),
148
+ protocol: process.env.APPIUM_HUB_PROTOCOL || config.protocol || 'https',
149
+ path: process.env.APPIUM_HUB_PATH || config.path || '/wd/hub',
150
+ user: process.env.APPIUM_HUB_USER || config.user,
151
+ key: process.env.APPIUM_HUB_KEY || config.key,
152
+ });
153
+ // eslint-disable-next-line no-console
154
+ console.log(`[testver-attach] Attaching to session ${sid.slice(0, 12)}…`);
155
+ return;
156
+ }
140
157
 
141
158
  const wdio = loadWebdriverio();
142
159
  const attachOpts = {
@@ -180,6 +197,11 @@ class TestverAttachService {
180
197
  */
181
198
  async before(_capabilities, _specs, browser) {
182
199
  const b = browser || globalThis.browser;
200
+ // A reused session belongs to the AI Assistant: WDIO's end-of-run
201
+ // deleteSession (and the test's own) must leave it open.
202
+ if (process.env.TESTVER_REUSE_SESSION_ID && b && typeof b.overwriteCommand === 'function') {
203
+ try { b.overwriteCommand('deleteSession', async () => undefined); } catch { /* best-effort */ }
204
+ }
183
205
  try { await reportSession(b); } catch { /* best-effort */ }
184
206
  }
185
207
 
@@ -99,6 +99,36 @@ function flattenCaps(caps) {
99
99
  return caps;
100
100
  }
101
101
 
102
+ /**
103
+ * Local Devices (Settings → Local Devices): capabilities the project doesn't
104
+ * set itself (TESTVER_LOCAL_CAPS_DEFAULTS — WebDriverAgent port and signing),
105
+ * then Testver's own over the project's (TESTVER_LOCAL_CAPS — app launch mode).
106
+ */
107
+ function applyLocalCaps(caps) {
108
+ let defaults = {};
109
+ let overrides = {};
110
+ try { defaults = process.env.TESTVER_LOCAL_CAPS_DEFAULTS ? JSON.parse(process.env.TESTVER_LOCAL_CAPS_DEFAULTS) : {}; } catch (e) { defaults = {}; }
111
+ try { overrides = process.env.TESTVER_LOCAL_CAPS ? JSON.parse(process.env.TESTVER_LOCAL_CAPS) : {}; } catch (e) { overrides = {}; }
112
+ for (const k of Object.keys(defaults)) {
113
+ if (caps[k] === undefined && caps[k.replace(/^appium:/, '')] === undefined) caps[k] = defaults[k];
114
+ }
115
+ for (const k of Object.keys(overrides)) {
116
+ delete caps[k.replace(/^appium:/, '')];
117
+ caps[k] = overrides[k];
118
+ }
119
+ }
120
+
121
+ /**
122
+ * The key the capabilities already use for a vendor block, matched without
123
+ * regard to case (`LT:Options` / `lt:options`), else `key` — Testver merges
124
+ * into the project's own block rather than adding a second one.
125
+ */
126
+ function vendorKeyIn(caps, key) {
127
+ if (!key || !caps || typeof caps !== 'object' || Object.prototype.hasOwnProperty.call(caps, key)) return key;
128
+ const lower = key.toLowerCase();
129
+ return Object.keys(caps).find((k) => k.toLowerCase() === lower) || key;
130
+ }
131
+
102
132
  /** Apply Testver cloud overrides to a wdio `remote()` options object. */
103
133
  function applyTestverOverrides(opts) {
104
134
  opts = opts || {};
@@ -137,6 +167,19 @@ function applyTestverOverrides(opts) {
137
167
  if (process.env.TESTVER_PLATFORM_NAME) caps.platformName = process.env.TESTVER_PLATFORM_NAME;
138
168
  if (process.env.TESTVER_DEVICE_NAME) caps['appium:deviceName'] = process.env.TESTVER_DEVICE_NAME;
139
169
  if (process.env.TESTVER_PLATFORM_VERSION) caps['appium:platformVersion'] = process.env.TESTVER_PLATFORM_VERSION;
170
+ // The device: a local one by its serial / udid (Appium picks the device by
171
+ // appium:udid, never by deviceName); on a vendor's cloud a local udid / AVD
172
+ // means nothing.
173
+ if (process.env.TESTVER_PROVIDER === 'local-appium') {
174
+ if (process.env.TESTVER_DEVICE_UDID) {
175
+ caps['appium:udid'] = process.env.TESTVER_DEVICE_UDID;
176
+ delete caps['appium:avd'];
177
+ }
178
+ applyLocalCaps(caps);
179
+ } else {
180
+ delete caps['appium:udid'];
181
+ delete caps['appium:avd'];
182
+ }
140
183
  if (process.env.TESTVER_APP_URL) {
141
184
  caps['appium:app'] = process.env.TESTVER_APP_URL;
142
185
  // The user's test code may hard-code app-identifier caps that
@@ -147,6 +190,9 @@ function applyTestverOverrides(opts) {
147
190
  // makes the run robust against mismatches like:
148
191
  // [BROWSERSTACK_INVALID_APP_ACTIVITY] Activity name "..." used
149
192
  // to start the app doesn't exist. Supported values: "c".
193
+ // (the project's package / bundle id is kept aside for the app reset
194
+ // on a reused session)
195
+ projectAppId = caps['appium:appPackage'] || caps['appium:bundleId'] || projectAppId;
150
196
  delete caps['appium:appPackage'];
151
197
  delete caps['appium:appActivity'];
152
198
  delete caps['appium:appWaitActivity'];
@@ -181,37 +227,24 @@ function applyTestverOverrides(opts) {
181
227
  // 1. Testver env var (explicit selection by UI / Runner)
182
228
  // 2. User-provided `appium:deviceName` from their caps
183
229
  // 3. Anything the user already put in `bstack:options.deviceName`
184
- const provider = process.env.TESTVER_PROVIDER;
185
- const deviceFromEnv = process.env.TESTVER_DEVICE_NAME;
186
- const osVerFromEnv = process.env.TESTVER_PLATFORM_VERSION;
187
- const deviceFromUser = caps['appium:deviceName'];
188
- const osVerFromUser = caps['appium:platformVersion'];
189
- const providerOpts = {
190
- projectName: 'Testver',
191
- buildName: process.env.TESTVER_BUILD_NAME || 'testver-cloud-run',
192
- sessionName: process.env.TESTVER_SESSION_NAME || 'mobile-test',
193
- };
194
- const resolvedDevice = deviceFromEnv || deviceFromUser;
195
- const resolvedOsVer = osVerFromEnv || osVerFromUser;
196
-
197
- if (provider === 'browserstack') {
198
- const existing = caps['bstack:options'] || {};
199
- caps['bstack:options'] = Object.assign({}, existing, providerOpts);
200
- // BrowserStack uses `deviceName` + `osVersion` keys.
201
- if (resolvedDevice && !existing.deviceName) caps['bstack:options'].deviceName = resolvedDevice;
202
- if (resolvedOsVer && !existing.osVersion) caps['bstack:options'].osVersion = resolvedOsVer;
203
- } else if (provider === 'saucelabs') {
204
- const existing = caps['sauce:options'] || {};
205
- caps['sauce:options'] = Object.assign({}, existing, providerOpts);
206
- // Sauce Labs uses `deviceName` (or `appium:deviceName` at top level — both honoured).
207
- if (resolvedDevice && !existing.deviceName) caps['sauce:options'].deviceName = resolvedDevice;
208
- if (resolvedOsVer && !existing.platformVersion) caps['sauce:options'].platformVersion = resolvedOsVer;
209
- } else if (provider === 'lambdatest') {
210
- const existing = caps['LT:Options'] || {};
211
- caps['LT:Options'] = Object.assign({}, existing, providerOpts);
212
- // LambdaTest uses `deviceName` + `platformVersion`.
213
- if (resolvedDevice && !existing.deviceName) caps['LT:Options'].deviceName = resolvedDevice;
214
- if (resolvedOsVer && !existing.platformVersion) caps['LT:Options'].platformVersion = resolvedOsVer;
230
+ // The vendor block Testver built for this run (TESTVER_VENDOR_OPTIONS):
231
+ // each vendor's own field names, the tunnel, the picked device. Names and
232
+ // tunnel: the project's own values win; the picked device wins over the
233
+ // project's. Without it (an older run plan) the device and OS version are
234
+ // still mirrored into the vendor's block.
235
+ let vendor = null;
236
+ try { vendor = process.env.TESTVER_VENDOR_OPTIONS ? JSON.parse(process.env.TESTVER_VENDOR_OPTIONS) : null; } catch (e) { vendor = null; }
237
+ if (vendor && vendor.key) {
238
+ // the project's own spelling of the block (`LT:Options` / `lt:options`)
239
+ const key = vendorKeyIn(caps, vendor.key);
240
+ caps[key] = Object.assign({}, vendor.options || {}, caps[key] || {}, vendor.overrides || {});
241
+ } else {
242
+ const key = vendorKeyIn(caps, { browserstack: 'bstack:options', saucelabs: 'sauce:options', lambdatest: 'lt:options' }[process.env.TESTVER_PROVIDER || ''] || '');
243
+ const device = process.env.TESTVER_DEVICE_NAME || caps['appium:deviceName'];
244
+ if (key && device) {
245
+ const existing = caps[key] || {};
246
+ caps[key] = Object.assign({}, existing, existing.deviceName ? {} : { deviceName: device });
247
+ }
215
248
  }
216
249
  return opts;
217
250
  }
@@ -267,6 +300,9 @@ function applyTestverOverrides(opts) {
267
300
  *
268
301
  * Disable: set TESTVER_SKIP_APP_RESET=1 in the run env.
269
302
  */
303
+ /** The project's own app package / bundle id, before an uploaded app replaced it in the caps. */
304
+ let projectAppId;
305
+
270
306
  async function resetAppOnAttach(browser, caps) {
271
307
  // Idempotency guard — if the browser already went through a reset
272
308
  // (e.g. wdio.remote() delegated to wdio.attach() which is also
@@ -281,6 +317,7 @@ async function resetAppOnAttach(browser, caps) {
281
317
  return;
282
318
  }
283
319
  const appId = (caps && (caps['appium:appPackage'] || caps['appium:bundleId']))
320
+ || projectAppId
284
321
  || process.env.TESTVER_APP_PACKAGE
285
322
  || process.env.TESTVER_APP_BUNDLE_ID;
286
323
  if (!appId) {
@@ -445,6 +482,8 @@ function reportExternalSession(browser, patched) {
445
482
  deviceName: patched.capabilities && patched.capabilities['appium:deviceName'],
446
483
  platformName: patched.capabilities && patched.capabilities.platformName,
447
484
  providerId: process.env.TESTVER_PROVIDER,
485
+ // the run that opened it (several runs of one tab side by side)
486
+ runId: process.env.TESTVER_RUN_ID,
448
487
  });
449
488
  const endpoint = reportUrl.replace(/\/$/, '') + '/api/mobile/session/register-external';
450
489
  // Node 18+ has global fetch — we target Node 20 in the parent app.