spana-test 0.12.0 → 0.13.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 (161) hide show
  1. package/README.md +1 -1
  2. package/dist/agent/index.js +28 -10
  3. package/dist/agent/index.js.map +1 -1
  4. package/dist/api/app.d.ts +40 -0
  5. package/dist/api/app.d.ts.map +1 -1
  6. package/dist/api/expect.d.ts +13 -0
  7. package/dist/api/expect.d.ts.map +1 -1
  8. package/dist/app-W6PRRBMD.js +13 -0
  9. package/dist/appium-CC77BJNK.js +935 -0
  10. package/dist/appium-CC77BJNK.js.map +1 -0
  11. package/dist/bridge-server-S3DHK7XE.js +12 -0
  12. package/dist/channels/cdp-client.d.ts +13 -0
  13. package/dist/channels/cdp-client.d.ts.map +1 -1
  14. package/dist/channels/dom-channel.d.ts +1 -1
  15. package/dist/channels/dom-channel.d.ts.map +1 -1
  16. package/dist/chunk-27H6NDA5.js +845 -0
  17. package/dist/chunk-27H6NDA5.js.map +1 -0
  18. package/dist/chunk-4LJ3KYCX.js +94 -0
  19. package/dist/chunk-4LJ3KYCX.js.map +1 -0
  20. package/dist/chunk-5SDVP53E.js +1046 -0
  21. package/dist/chunk-5SDVP53E.js.map +1 -0
  22. package/dist/{chunk-OQRGR542.js → chunk-5T7LSBDM.js} +7 -7
  23. package/dist/chunk-5T7LSBDM.js.map +1 -0
  24. package/dist/{screenshot-compare-V4JQG73R.js → chunk-6C2EILMC.js} +185 -6
  25. package/dist/chunk-6C2EILMC.js.map +1 -0
  26. package/dist/{chunk-BWEQ4XT2.js → chunk-7IUD55GY.js} +455 -1178
  27. package/dist/chunk-7IUD55GY.js.map +1 -0
  28. package/dist/chunk-A7Z52TDQ.js +97 -0
  29. package/dist/chunk-A7Z52TDQ.js.map +1 -0
  30. package/dist/{chunk-AMBU26PB.js → chunk-BUNMIMGA.js} +2 -2
  31. package/dist/chunk-DMF2BPPA.js +547 -0
  32. package/dist/chunk-DMF2BPPA.js.map +1 -0
  33. package/dist/chunk-FUXFXFBM.js +1962 -0
  34. package/dist/chunk-FUXFXFBM.js.map +1 -0
  35. package/dist/{chunk-F2YUBD4E.js → chunk-FV7ONGQ7.js} +3 -3
  36. package/dist/{chunk-QOL44BNJ.js → chunk-GDVHJBR2.js} +4 -4
  37. package/dist/chunk-GLNTGHR6.js +330 -0
  38. package/dist/chunk-GLNTGHR6.js.map +1 -0
  39. package/dist/chunk-HJY5YN4N.js +272 -0
  40. package/dist/chunk-HJY5YN4N.js.map +1 -0
  41. package/dist/chunk-HNQLWFHL.js +40 -0
  42. package/dist/chunk-HNQLWFHL.js.map +1 -0
  43. package/dist/chunk-HUYC4OAL.js +72 -0
  44. package/dist/chunk-HUYC4OAL.js.map +1 -0
  45. package/dist/chunk-HWS3XUEF.js +109 -0
  46. package/dist/chunk-HWS3XUEF.js.map +1 -0
  47. package/dist/{chunk-F3AFZ6UX.js → chunk-IDIHDVGC.js} +3 -1
  48. package/dist/chunk-IDIHDVGC.js.map +1 -0
  49. package/dist/{chunk-53TGNQTM.js → chunk-IUK3RJ6W.js} +32 -18
  50. package/dist/{chunk-53TGNQTM.js.map → chunk-IUK3RJ6W.js.map} +1 -1
  51. package/dist/chunk-K4K2ACT2.js +179 -0
  52. package/dist/chunk-K4K2ACT2.js.map +1 -0
  53. package/dist/chunk-LKGF75QJ.js +654 -0
  54. package/dist/chunk-LKGF75QJ.js.map +1 -0
  55. package/dist/chunk-MAKZK7GY.js +935 -0
  56. package/dist/chunk-MAKZK7GY.js.map +1 -0
  57. package/dist/chunk-MPJCUL2B.js +154 -0
  58. package/dist/chunk-MPJCUL2B.js.map +1 -0
  59. package/dist/chunk-MUMIMDRJ.js +24 -0
  60. package/dist/chunk-MUMIMDRJ.js.map +1 -0
  61. package/dist/{chunk-XQRXQBDQ.js → chunk-NWGA3R2E.js} +2 -19
  62. package/dist/chunk-NWGA3R2E.js.map +1 -0
  63. package/dist/chunk-PPRNCRTS.js +1104 -0
  64. package/dist/chunk-PPRNCRTS.js.map +1 -0
  65. package/dist/{chunk-LQQNE2OE.js → chunk-RHQJSPOS.js} +371 -40
  66. package/dist/chunk-RHQJSPOS.js.map +1 -0
  67. package/dist/{chunk-GAWJL6Q3.js → chunk-VWJNINPX.js} +490 -89
  68. package/dist/chunk-VWJNINPX.js.map +1 -0
  69. package/dist/chunk-WFC4DCFF.js +529 -0
  70. package/dist/chunk-WFC4DCFF.js.map +1 -0
  71. package/dist/chunk-X5FRYDZ3.js +91 -0
  72. package/dist/chunk-X5FRYDZ3.js.map +1 -0
  73. package/dist/chunk-YFTHJRDO.js +37 -0
  74. package/dist/chunk-YFTHJRDO.js.map +1 -0
  75. package/dist/cli/test-command.d.ts.map +1 -1
  76. package/dist/cli.js +18 -18
  77. package/dist/config-loader-7W7OEWRG.js +10 -0
  78. package/dist/core/engine.d.ts.map +1 -1
  79. package/dist/{discover-43C3BE7I.js → discover-6ULCTB5T.js} +3 -3
  80. package/dist/{doctor-command-CLKEEOAX.js → doctor-command-4CQQLB7M.js} +16 -9
  81. package/dist/{doctor-command-CLKEEOAX.js.map → doctor-command-4CQQLB7M.js.map} +1 -1
  82. package/dist/driver-3MEIFYST.js +19 -0
  83. package/dist/driver-QTIAADUZ.js +19 -0
  84. package/dist/drivers/cdp-browser.d.ts +27 -0
  85. package/dist/drivers/cdp-browser.d.ts.map +1 -1
  86. package/dist/drivers/electron.d.ts +1 -1
  87. package/dist/drivers/electron.d.ts.map +1 -1
  88. package/dist/drivers/playwright.d.ts +1 -5
  89. package/dist/drivers/playwright.d.ts.map +1 -1
  90. package/dist/drivers/raw-driver.d.ts +4 -0
  91. package/dist/drivers/raw-driver.d.ts.map +1 -1
  92. package/dist/drivers/wasm-utils.d.ts +100 -0
  93. package/dist/drivers/wasm-utils.d.ts.map +1 -0
  94. package/dist/drivers/wasm.d.ts +57 -0
  95. package/dist/drivers/wasm.d.ts.map +1 -0
  96. package/dist/electrobun-MPAHMSI2.js +15 -0
  97. package/dist/electrobun-MPAHMSI2.js.map +1 -0
  98. package/dist/electron-SQACDON3.js +9 -0
  99. package/dist/electron-SQACDON3.js.map +1 -0
  100. package/dist/index.d.ts +3 -0
  101. package/dist/index.d.ts.map +1 -1
  102. package/dist/index.js +400 -53
  103. package/dist/index.js.map +1 -1
  104. package/dist/installer-KL2NCILK.js +17 -0
  105. package/dist/installer-KL2NCILK.js.map +1 -0
  106. package/dist/{local-RH5EFGYF.js → local-SWHWINSA.js} +8 -9
  107. package/dist/local-SWHWINSA.js.map +1 -0
  108. package/dist/pagesource-KIQ5T5MA.js +9 -0
  109. package/dist/pagesource-KIQ5T5MA.js.map +1 -0
  110. package/dist/pagesource-KKG7WMFJ.js +9 -0
  111. package/dist/pagesource-KKG7WMFJ.js.map +1 -0
  112. package/dist/playwright-42QYIZEE.js +28 -0
  113. package/dist/playwright-42QYIZEE.js.map +1 -0
  114. package/dist/runtime/local.d.ts.map +1 -1
  115. package/dist/schemas/config.d.ts +32 -0
  116. package/dist/schemas/config.d.ts.map +1 -1
  117. package/dist/schemas/device.d.ts +1 -1
  118. package/dist/schemas/device.d.ts.map +1 -1
  119. package/dist/screenshot-compare-BJRJHKNQ.js +12 -0
  120. package/dist/screenshot-compare-BJRJHKNQ.js.map +1 -0
  121. package/dist/{server-D45AO34E.js → server-2Y46CDVB.js} +30 -12
  122. package/dist/{server-D45AO34E.js.map → server-2Y46CDVB.js.map} +1 -1
  123. package/dist/{server-KLZBJOMQ.js → server-ZCBZ4UYF.js} +2 -2
  124. package/dist/server-ZCBZ4UYF.js.map +1 -0
  125. package/dist/session-5XW6TKF4.js +39 -0
  126. package/dist/session-5XW6TKF4.js.map +1 -0
  127. package/dist/smart/coordinator.d.ts.map +1 -1
  128. package/dist/{studio-command-TNSJGTFA.js → studio-command-BNBOL424.js} +2 -2
  129. package/dist/{test-command-EXPYFDTF.js → test-command-T4PLAZXU.js} +58 -1036
  130. package/dist/test-command-T4PLAZXU.js.map +1 -0
  131. package/dist/watch-mode-NR5MHNNL.js +10 -0
  132. package/dist/watch-mode-NR5MHNNL.js.map +1 -0
  133. package/native/win32-x64/spana_native.dll +0 -0
  134. package/package.json +2 -2
  135. package/dist/app-CBHH5GMB.js +0 -10
  136. package/dist/chunk-BWEQ4XT2.js.map +0 -1
  137. package/dist/chunk-F3AFZ6UX.js.map +0 -1
  138. package/dist/chunk-GAWJL6Q3.js.map +0 -1
  139. package/dist/chunk-GDDCZ2PL.js +0 -2619
  140. package/dist/chunk-GDDCZ2PL.js.map +0 -1
  141. package/dist/chunk-LQQNE2OE.js.map +0 -1
  142. package/dist/chunk-OQRGR542.js.map +0 -1
  143. package/dist/chunk-PPAPRKQU.js +0 -4739
  144. package/dist/chunk-PPAPRKQU.js.map +0 -1
  145. package/dist/chunk-VOYJQDSI.js +0 -188
  146. package/dist/chunk-VOYJQDSI.js.map +0 -1
  147. package/dist/chunk-XQRXQBDQ.js.map +0 -1
  148. package/dist/config-loader-V26XXHPH.js +0 -10
  149. package/dist/screenshot-compare-V4JQG73R.js.map +0 -1
  150. package/dist/session-N6DEYVPM.js +0 -21
  151. package/dist/test-command-EXPYFDTF.js.map +0 -1
  152. /package/dist/{app-CBHH5GMB.js.map → app-W6PRRBMD.js.map} +0 -0
  153. /package/dist/{config-loader-V26XXHPH.js.map → bridge-server-S3DHK7XE.js.map} +0 -0
  154. /package/dist/{chunk-AMBU26PB.js.map → chunk-BUNMIMGA.js.map} +0 -0
  155. /package/dist/{chunk-F2YUBD4E.js.map → chunk-FV7ONGQ7.js.map} +0 -0
  156. /package/dist/{chunk-QOL44BNJ.js.map → chunk-GDVHJBR2.js.map} +0 -0
  157. /package/dist/{discover-43C3BE7I.js.map → config-loader-7W7OEWRG.js.map} +0 -0
  158. /package/dist/{local-RH5EFGYF.js.map → discover-6ULCTB5T.js.map} +0 -0
  159. /package/dist/{server-KLZBJOMQ.js.map → driver-3MEIFYST.js.map} +0 -0
  160. /package/dist/{session-N6DEYVPM.js.map → driver-QTIAADUZ.js.map} +0 -0
  161. /package/dist/{studio-command-TNSJGTFA.js.map → studio-command-BNBOL424.js.map} +0 -0
@@ -0,0 +1,935 @@
1
+ import {
2
+ detectProvider
3
+ } from "./chunk-7WHQIQPM.js";
4
+ import {
5
+ parseIOSHierarchy
6
+ } from "./chunk-4LJ3KYCX.js";
7
+ import {
8
+ parseAndroidHierarchy
9
+ } from "./chunk-X5FRYDZ3.js";
10
+ import "./chunk-MPJCUL2B.js";
11
+ import {
12
+ deviceEffect
13
+ } from "./chunk-HWS3XUEF.js";
14
+ import {
15
+ resolveNetworkConditions
16
+ } from "./chunk-HNQLWFHL.js";
17
+ import "./chunk-XVL4FHXA.js";
18
+ import {
19
+ splitGraphemes
20
+ } from "./chunk-MUMIMDRJ.js";
21
+ import {
22
+ buildIOSLaunchConfiguration,
23
+ hasLaunchDeviceState
24
+ } from "./chunk-NWGA3R2E.js";
25
+ import {
26
+ DriverError
27
+ } from "./chunk-A7Z52TDQ.js";
28
+ import {
29
+ init_esm_shims
30
+ } from "./chunk-FTXUQMGH.js";
31
+
32
+ // src/runtime/appium.ts
33
+ init_esm_shims();
34
+ import { Effect as Effect3 } from "effect";
35
+
36
+ // src/drivers/appium/client.ts
37
+ init_esm_shims();
38
+ var AppiumClient = class {
39
+ baseUrl;
40
+ authHeader = null;
41
+ sessionId = null;
42
+ sessionCaps = {};
43
+ constructor(serverUrl) {
44
+ const parsed = new URL(serverUrl);
45
+ if (parsed.username || parsed.password) {
46
+ const username = decodeURIComponent(parsed.username);
47
+ const password = decodeURIComponent(parsed.password);
48
+ this.authHeader = `Basic ${Buffer.from(`${username}:${password}`).toString("base64")}`;
49
+ parsed.username = "";
50
+ parsed.password = "";
51
+ }
52
+ this.baseUrl = parsed.toString().replace(/\/+$/, "");
53
+ }
54
+ createHeaders() {
55
+ return {
56
+ "Content-Type": "application/json",
57
+ ...this.authHeader ? { Authorization: this.authHeader } : {}
58
+ };
59
+ }
60
+ // ---------------------------------------------------------------------------
61
+ // HTTP helpers
62
+ // ---------------------------------------------------------------------------
63
+ async request(method, path, body) {
64
+ const url = `${this.baseUrl}${path}`;
65
+ const init = {
66
+ method,
67
+ headers: this.createHeaders()
68
+ };
69
+ if (body !== void 0) {
70
+ init.body = JSON.stringify(body);
71
+ }
72
+ const res = await fetch(url, init);
73
+ const text = await res.text();
74
+ let parsed;
75
+ try {
76
+ parsed = JSON.parse(text);
77
+ } catch {
78
+ throw new Error(`Appium: failed to parse response: ${text}`);
79
+ }
80
+ if (!res.ok) {
81
+ const val = parsed.value;
82
+ const msg = val?.message ?? val?.error ?? text;
83
+ throw new Error(`Appium ${method} ${path} -> ${res.status}: ${msg}`);
84
+ }
85
+ if (parsed.value !== null && typeof parsed.value === "object" && "error" in parsed.value) {
86
+ const val = parsed.value;
87
+ throw new Error(`Appium error: ${val.message ?? val.error}`);
88
+ }
89
+ return parsed.value;
90
+ }
91
+ sessionPath(suffix) {
92
+ if (this.sessionId === null) {
93
+ throw new Error("Appium: no active session");
94
+ }
95
+ return `/session/${this.sessionId}${suffix}`;
96
+ }
97
+ // ---------------------------------------------------------------------------
98
+ // Session management
99
+ // ---------------------------------------------------------------------------
100
+ async createSession(capabilities) {
101
+ const body = {
102
+ capabilities: {
103
+ alwaysMatch: capabilities
104
+ }
105
+ };
106
+ const res = await fetch(`${this.baseUrl}/session`, {
107
+ method: "POST",
108
+ headers: this.createHeaders(),
109
+ body: JSON.stringify(body)
110
+ });
111
+ const text = await res.text();
112
+ let parsed;
113
+ try {
114
+ parsed = JSON.parse(text);
115
+ } catch {
116
+ throw new Error(`Appium: failed to parse session response: ${text}`);
117
+ }
118
+ if (!res.ok) {
119
+ const val = parsed["value"];
120
+ throw new Error(`Appium: failed to create session: ${val?.message ?? text}`);
121
+ }
122
+ const value = parsed["value"];
123
+ const sessionId = value?.["sessionId"] ?? parsed["sessionId"];
124
+ if (!sessionId) {
125
+ throw new Error(`Appium: no sessionId in session response: ${text}`);
126
+ }
127
+ this.sessionId = sessionId;
128
+ this.sessionCaps = value?.["capabilities"] ?? {};
129
+ return sessionId;
130
+ }
131
+ async deleteSession() {
132
+ if (this.sessionId === null) return;
133
+ const path = `/session/${this.sessionId}`;
134
+ this.sessionId = null;
135
+ this.sessionCaps = {};
136
+ await fetch(`${this.baseUrl}${path}`, { method: "DELETE", headers: this.createHeaders() });
137
+ }
138
+ getSessionId() {
139
+ return this.sessionId;
140
+ }
141
+ getSessionCaps() {
142
+ return this.sessionCaps;
143
+ }
144
+ // ---------------------------------------------------------------------------
145
+ // WebView / hybrid context switching
146
+ // ---------------------------------------------------------------------------
147
+ async getContexts() {
148
+ return this.request("GET", this.sessionPath("/contexts"));
149
+ }
150
+ async getCurrentContext() {
151
+ return this.request("GET", this.sessionPath("/context"));
152
+ }
153
+ async setContext(contextId) {
154
+ await this.request("POST", this.sessionPath("/context"), { name: contextId });
155
+ }
156
+ // ---------------------------------------------------------------------------
157
+ // Scripting (execute in current context — works in WebView contexts)
158
+ // ---------------------------------------------------------------------------
159
+ async executeScript(script, args = []) {
160
+ return this.request("POST", this.sessionPath("/execute/sync"), { script, args });
161
+ }
162
+ };
163
+
164
+ // src/drivers/appium/android.ts
165
+ init_esm_shims();
166
+ import { Effect } from "effect";
167
+
168
+ // src/drivers/appium/window-size.ts
169
+ init_esm_shims();
170
+ async function getAppiumWindowSize(client) {
171
+ try {
172
+ return await client.request("GET", client.sessionPath("/window/size"));
173
+ } catch (error) {
174
+ const message = error instanceof Error ? error.message : String(error);
175
+ if (!message.includes("/window/size") || !message.includes("-> 404:")) {
176
+ throw error;
177
+ }
178
+ const rect = await client.request("GET", client.sessionPath("/window/rect"));
179
+ return { width: rect.width, height: rect.height };
180
+ }
181
+ }
182
+
183
+ // src/drivers/appium/android.ts
184
+ function createAppiumAndroidDriver(client, defaultBundleId) {
185
+ const mobile = async (command, params) => {
186
+ await client.request("POST", client.sessionPath("/execute/sync"), {
187
+ script: `mobile: ${command}`,
188
+ args: [params]
189
+ });
190
+ };
191
+ const service = {
192
+ setGeolocation: (point) => deviceEffect("setGeolocation", () => mobile("setGeolocation", { ...point })),
193
+ setPermission: (appPackage, permission, state) => deviceEffect(
194
+ "setPermission",
195
+ () => mobile("changePermissions", {
196
+ appPackage,
197
+ permissions: [permission],
198
+ action: state === "grant" ? "grant" : "revoke",
199
+ target: "pm"
200
+ })
201
+ ),
202
+ simulateBiometric: (options) => deviceEffect("simulateBiometric", () => {
203
+ if (options.type !== "fingerprint")
204
+ throw new Error("Only fingerprint simulation is supported on Android");
205
+ return mobile("fingerprint", { fingerprintId: options.fingerId });
206
+ }),
207
+ setOrientation: (orientation) => deviceEffect("setOrientation", async () => {
208
+ await client.request("POST", client.sessionPath("/orientation"), {
209
+ orientation: orientation.toUpperCase()
210
+ });
211
+ }),
212
+ // -----------------------------------------------------------------------
213
+ // Hierarchy
214
+ // -----------------------------------------------------------------------
215
+ dumpHierarchy: () => Effect.tryPromise({
216
+ try: () => client.request("GET", client.sessionPath("/source")),
217
+ catch: (e) => new DriverError({ message: `Failed to get page source: ${e}` })
218
+ }),
219
+ // -----------------------------------------------------------------------
220
+ // Coordinate-level actions
221
+ // -----------------------------------------------------------------------
222
+ tapAtCoordinate: (x, y) => Effect.tryPromise({
223
+ try: () => client.request("POST", client.sessionPath("/actions"), {
224
+ actions: [
225
+ {
226
+ type: "pointer",
227
+ id: "finger1",
228
+ parameters: { pointerType: "touch" },
229
+ actions: [
230
+ { type: "pointerMove", duration: 0, x, y },
231
+ { type: "pointerDown", button: 0 },
232
+ { type: "pointerUp", button: 0 }
233
+ ]
234
+ }
235
+ ]
236
+ }),
237
+ catch: (e) => new DriverError({ message: `Tap failed: ${e}` })
238
+ }),
239
+ doubleTapAtCoordinate: (x, y) => Effect.tryPromise({
240
+ try: async () => {
241
+ const tapSequence = [
242
+ {
243
+ type: "pointer",
244
+ id: "finger1",
245
+ parameters: { pointerType: "touch" },
246
+ actions: [
247
+ { type: "pointerMove", duration: 0, x, y },
248
+ { type: "pointerDown", button: 0 },
249
+ { type: "pointerUp", button: 0 }
250
+ ]
251
+ }
252
+ ];
253
+ await client.request("POST", client.sessionPath("/actions"), { actions: tapSequence });
254
+ await new Promise((resolve) => setTimeout(resolve, 100));
255
+ await client.request("POST", client.sessionPath("/actions"), { actions: tapSequence });
256
+ },
257
+ catch: (e) => new DriverError({ message: `Double tap failed: ${e}` })
258
+ }),
259
+ longPressAtCoordinate: (x, y, duration) => Effect.tryPromise({
260
+ try: () => client.request("POST", client.sessionPath("/actions"), {
261
+ actions: [
262
+ {
263
+ type: "pointer",
264
+ id: "finger1",
265
+ parameters: { pointerType: "touch" },
266
+ actions: [
267
+ { type: "pointerMove", duration: 0, x, y },
268
+ { type: "pointerDown", button: 0 },
269
+ { type: "pause", duration },
270
+ { type: "pointerUp", button: 0 }
271
+ ]
272
+ }
273
+ ]
274
+ }),
275
+ catch: (e) => new DriverError({ message: `Long press failed: ${e}` })
276
+ }),
277
+ swipe: (sx, sy, ex, ey, dur) => Effect.tryPromise({
278
+ try: () => client.request("POST", client.sessionPath("/actions"), {
279
+ actions: [
280
+ {
281
+ type: "pointer",
282
+ id: "finger1",
283
+ parameters: { pointerType: "touch" },
284
+ actions: [
285
+ { type: "pointerMove", duration: 0, x: sx, y: sy },
286
+ { type: "pointerDown", button: 0 },
287
+ { type: "pointerMove", duration: dur, x: ex, y: ey },
288
+ { type: "pointerUp", button: 0 }
289
+ ]
290
+ }
291
+ ]
292
+ }),
293
+ catch: (e) => new DriverError({ message: `Swipe failed: ${e}` })
294
+ }),
295
+ // -----------------------------------------------------------------------
296
+ // Text input
297
+ // -----------------------------------------------------------------------
298
+ inputText: (text) => Effect.tryPromise({
299
+ try: () => {
300
+ const keyActions = [];
301
+ for (const segment of splitGraphemes(text)) {
302
+ keyActions.push({ type: "keyDown", value: segment });
303
+ keyActions.push({ type: "keyUp", value: segment });
304
+ }
305
+ return client.request("POST", client.sessionPath("/actions"), {
306
+ actions: [
307
+ {
308
+ type: "key",
309
+ id: "keyboard",
310
+ actions: keyActions
311
+ }
312
+ ]
313
+ });
314
+ },
315
+ catch: (e) => new DriverError({ message: `Input text failed: ${e}` })
316
+ }),
317
+ pressKey: (key) => Effect.tryPromise({
318
+ try: () => client.request("POST", client.sessionPath("/appium/device/press_keycode"), {
319
+ keycode: parseInt(key, 10) || 0
320
+ }),
321
+ catch: (e) => new DriverError({ message: `Press key failed: ${e}` })
322
+ }),
323
+ hideKeyboard: () => Effect.tryPromise({
324
+ try: () => client.request("POST", client.sessionPath("/appium/device/hide_keyboard")),
325
+ catch: (e) => new DriverError({ message: `Hide keyboard failed: ${e}` })
326
+ }),
327
+ // -----------------------------------------------------------------------
328
+ // Queries
329
+ // -----------------------------------------------------------------------
330
+ takeScreenshot: () => Effect.tryPromise({
331
+ try: async () => {
332
+ const base64 = await client.request("GET", client.sessionPath("/screenshot"));
333
+ return Uint8Array.from(atob(base64), (c) => c.charCodeAt(0));
334
+ },
335
+ catch: (e) => new DriverError({ message: `Screenshot failed: ${e}` })
336
+ }),
337
+ getDeviceInfo: () => Effect.tryPromise({
338
+ try: async () => {
339
+ const size = await getAppiumWindowSize(client);
340
+ const caps = client.getSessionCaps();
341
+ return {
342
+ platform: "android",
343
+ deviceId: client.getSessionId() ?? "appium",
344
+ name: caps["deviceName"] ?? "Android Device (Appium)",
345
+ isEmulator: false,
346
+ screenWidth: size.width,
347
+ screenHeight: size.height,
348
+ driverType: "appium"
349
+ };
350
+ },
351
+ catch: (e) => new DriverError({ message: `Get device info failed: ${e}` })
352
+ }),
353
+ // -----------------------------------------------------------------------
354
+ // App lifecycle
355
+ // -----------------------------------------------------------------------
356
+ launchApp: (bundleId, opts) => Effect.tryPromise({
357
+ try: async () => {
358
+ if (opts?.clearState) {
359
+ try {
360
+ await client.request("POST", client.sessionPath("/appium/device/terminate_app"), {
361
+ appId: bundleId
362
+ });
363
+ } catch {
364
+ }
365
+ await client.executeScript("mobile: clearApp", [{ appId: bundleId }]);
366
+ }
367
+ if (opts?.clearKeychain) {
368
+ console.warn("clearKeychain is not supported on Android, skipping.");
369
+ }
370
+ if (opts?.launchArguments && Object.keys(opts.launchArguments).length > 0) {
371
+ throw new DriverError({
372
+ message: "launchArguments are not supported in Appium Android mode. Remove launchArguments from your config or use local mode."
373
+ });
374
+ }
375
+ if (hasLaunchDeviceState(opts?.deviceState)) {
376
+ console.warn(
377
+ "deviceState launch overrides are not supported during Appium Android relaunches. Set launchOptions.deviceState in config to apply Android language/locale/timeZone at session start."
378
+ );
379
+ }
380
+ if (opts?.deepLink) {
381
+ await client.executeScript("mobile: deepLink", [
382
+ { url: opts.deepLink, package: bundleId }
383
+ ]);
384
+ } else {
385
+ await client.request("POST", client.sessionPath("/appium/device/activate_app"), {
386
+ appId: bundleId
387
+ });
388
+ }
389
+ },
390
+ catch: (e) => new DriverError({ message: `Launch app failed: ${e}` })
391
+ }),
392
+ stopApp: (bundleId) => Effect.tryPromise({
393
+ try: () => client.request("POST", client.sessionPath("/appium/device/terminate_app"), {
394
+ appId: bundleId
395
+ }),
396
+ catch: (e) => new DriverError({ message: `Stop app failed: ${e}` })
397
+ }),
398
+ killApp: (bundleId) => Effect.tryPromise({
399
+ try: () => client.request("POST", client.sessionPath("/appium/device/terminate_app"), {
400
+ appId: bundleId
401
+ }),
402
+ catch: (e) => new DriverError({ message: `Kill app failed: ${e}` })
403
+ }),
404
+ clearAppState: (bundleId) => Effect.tryPromise({
405
+ try: async () => {
406
+ try {
407
+ await client.request("POST", client.sessionPath("/appium/device/terminate_app"), {
408
+ appId: bundleId
409
+ });
410
+ } catch {
411
+ }
412
+ await client.executeScript("mobile: clearApp", [{ appId: bundleId }]);
413
+ },
414
+ catch: (e) => new DriverError({ message: `Clear app state failed: ${e}` })
415
+ }),
416
+ // -----------------------------------------------------------------------
417
+ // Navigation
418
+ // -----------------------------------------------------------------------
419
+ openLink: (url) => Effect.tryPromise({
420
+ try: () => {
421
+ const args = { url };
422
+ if (defaultBundleId) args.package = defaultBundleId;
423
+ return client.executeScript("mobile: deepLink", [args]);
424
+ },
425
+ catch: (e) => new DriverError({ message: `Open link failed: ${e}` })
426
+ }),
427
+ back: () => Effect.tryPromise({
428
+ try: () => client.request("POST", client.sessionPath("/back")),
429
+ catch: (e) => new DriverError({ message: `Back failed: ${e}` })
430
+ }),
431
+ // -----------------------------------------------------------------------
432
+ // Scripting (works when switched to a WebView context)
433
+ // -----------------------------------------------------------------------
434
+ evaluate: (script, ...args) => Effect.tryPromise({
435
+ try: () => client.executeScript(
436
+ typeof script === "function" ? `return (${script})(...arguments)` : script,
437
+ args
438
+ ),
439
+ catch: (e) => new DriverError({ message: `evaluate() failed: ${e}` })
440
+ }),
441
+ // -----------------------------------------------------------------------
442
+ // WebView / hybrid context switching
443
+ // -----------------------------------------------------------------------
444
+ getContexts: () => Effect.tryPromise({
445
+ try: () => client.getContexts(),
446
+ catch: (e) => new DriverError({ message: `getContexts failed: ${e}` })
447
+ }),
448
+ getCurrentContext: () => Effect.tryPromise({
449
+ try: () => client.getCurrentContext(),
450
+ catch: (e) => new DriverError({ message: `getCurrentContext failed: ${e}` })
451
+ }),
452
+ setContext: (contextId) => Effect.tryPromise({
453
+ try: () => client.setContext(contextId),
454
+ catch: (e) => new DriverError({ message: `setContext failed: ${e}` })
455
+ }),
456
+ // -----------------------------------------------------------------------
457
+ // Network conditions
458
+ // -----------------------------------------------------------------------
459
+ setNetworkConditions: (conditions) => Effect.tryPromise({
460
+ try: () => {
461
+ const resolved = resolveNetworkConditions(conditions);
462
+ const hasAnyValue = conditions.profile !== void 0 || conditions.offline !== void 0 || conditions.latencyMs !== void 0 || conditions.downloadThroughputKbps !== void 0 || conditions.uploadThroughputKbps !== void 0;
463
+ if (!hasAnyValue) {
464
+ return client.executeScript("mobile: setConnectivity", [
465
+ { wifi: true, data: true, airplaneMode: false }
466
+ ]);
467
+ }
468
+ if (resolved.offline) {
469
+ return client.executeScript("mobile: setConnectivity", [
470
+ { wifi: false, data: false, airplaneMode: true }
471
+ ]);
472
+ }
473
+ return client.executeScript("mobile: setConnectivity", [
474
+ { wifi: true, data: true, airplaneMode: false }
475
+ ]);
476
+ },
477
+ catch: (e) => new DriverError({ message: `setNetworkConditions failed: ${e}` })
478
+ })
479
+ };
480
+ return Effect.succeed(service);
481
+ }
482
+
483
+ // src/drivers/appium/ios.ts
484
+ init_esm_shims();
485
+ import { Effect as Effect2 } from "effect";
486
+ function createAppiumIOSDriver(client) {
487
+ const mobile = async (command, params) => {
488
+ await client.request("POST", client.sessionPath("/execute/sync"), {
489
+ script: `mobile: ${command}`,
490
+ args: [params]
491
+ });
492
+ };
493
+ const service = {
494
+ setOrientation: (orientation) => deviceEffect("setOrientation", async () => {
495
+ await client.request("POST", client.sessionPath("/orientation"), {
496
+ orientation: orientation.toUpperCase()
497
+ });
498
+ }),
499
+ setGeolocation: ({ latitude, longitude }) => deviceEffect("setGeolocation", () => mobile("setSimulatedLocation", { latitude, longitude })),
500
+ setPermission: (bundleId, permission, state) => deviceEffect(
501
+ "setPermission",
502
+ () => mobile("setPermission", {
503
+ bundleId,
504
+ access: { [permission]: state === "grant" ? "yes" : "no" }
505
+ })
506
+ ),
507
+ setBiometricEnrollment: (isEnabled) => deviceEffect("setBiometricEnrollment", () => mobile("enrollBiometric", { isEnabled })),
508
+ simulateBiometric: (options) => deviceEffect("simulateBiometric", () => {
509
+ if (options.type === "fingerprint") throw new Error("Use touchId or faceId on iOS");
510
+ return mobile("sendBiometricMatch", { type: options.type, match: options.match ?? true });
511
+ }),
512
+ sendPushNotification: (bundleId, payload) => deviceEffect("sendPushNotification", () => mobile("pushNotification", { bundleId, payload })),
513
+ // -----------------------------------------------------------------------
514
+ // Hierarchy
515
+ // -----------------------------------------------------------------------
516
+ dumpHierarchy: () => Effect2.tryPromise({
517
+ try: () => client.request("GET", client.sessionPath("/source")),
518
+ catch: (e) => new DriverError({ message: `Failed to get page source: ${e}` })
519
+ }),
520
+ // -----------------------------------------------------------------------
521
+ // Coordinate-level actions (W3C touch pointer actions for iOS)
522
+ // -----------------------------------------------------------------------
523
+ tapAtCoordinate: (x, y) => Effect2.tryPromise({
524
+ try: () => client.request("POST", client.sessionPath("/actions"), {
525
+ actions: [
526
+ {
527
+ type: "pointer",
528
+ id: "finger1",
529
+ parameters: { pointerType: "touch" },
530
+ actions: [
531
+ { type: "pointerMove", duration: 0, x, y },
532
+ { type: "pointerDown", button: 0 },
533
+ { type: "pointerUp", button: 0 }
534
+ ]
535
+ }
536
+ ]
537
+ }),
538
+ catch: (e) => new DriverError({ message: `Tap failed: ${e}` })
539
+ }),
540
+ doubleTapAtCoordinate: (x, y) => Effect2.tryPromise({
541
+ try: () => client.request("POST", client.sessionPath("/actions"), {
542
+ actions: [
543
+ {
544
+ type: "pointer",
545
+ id: "finger1",
546
+ parameters: { pointerType: "touch" },
547
+ actions: [
548
+ { type: "pointerMove", duration: 0, x, y },
549
+ { type: "pointerDown", button: 0 },
550
+ { type: "pointerUp", button: 0 },
551
+ { type: "pause", duration: 40 },
552
+ { type: "pointerDown", button: 0 },
553
+ { type: "pointerUp", button: 0 }
554
+ ]
555
+ }
556
+ ]
557
+ }),
558
+ catch: (e) => new DriverError({ message: `Double tap failed: ${e}` })
559
+ }),
560
+ longPressAtCoordinate: (x, y, duration) => Effect2.tryPromise({
561
+ try: () => client.request("POST", client.sessionPath("/actions"), {
562
+ actions: [
563
+ {
564
+ type: "pointer",
565
+ id: "finger1",
566
+ parameters: { pointerType: "touch" },
567
+ actions: [
568
+ { type: "pointerMove", duration: 0, x, y },
569
+ { type: "pointerDown", button: 0 },
570
+ { type: "pause", duration },
571
+ { type: "pointerUp", button: 0 }
572
+ ]
573
+ }
574
+ ]
575
+ }),
576
+ catch: (e) => new DriverError({ message: `Long press failed: ${e}` })
577
+ }),
578
+ swipe: (sx, sy, ex, ey, dur) => Effect2.tryPromise({
579
+ try: () => client.request("POST", client.sessionPath("/actions"), {
580
+ actions: [
581
+ {
582
+ type: "pointer",
583
+ id: "finger1",
584
+ parameters: { pointerType: "touch" },
585
+ actions: [
586
+ { type: "pointerMove", duration: 0, x: sx, y: sy },
587
+ { type: "pointerDown", button: 0 },
588
+ { type: "pointerMove", duration: dur, x: ex, y: ey },
589
+ { type: "pointerUp", button: 0 }
590
+ ]
591
+ }
592
+ ]
593
+ }),
594
+ catch: (e) => new DriverError({ message: `Swipe failed: ${e}` })
595
+ }),
596
+ // -----------------------------------------------------------------------
597
+ // Text input
598
+ // -----------------------------------------------------------------------
599
+ inputText: (text) => Effect2.tryPromise({
600
+ try: () => {
601
+ const keyActions = [];
602
+ for (const segment of splitGraphemes(text)) {
603
+ keyActions.push({ type: "keyDown", value: segment });
604
+ keyActions.push({ type: "keyUp", value: segment });
605
+ }
606
+ return client.request("POST", client.sessionPath("/actions"), {
607
+ actions: [
608
+ {
609
+ type: "key",
610
+ id: "keyboard",
611
+ actions: keyActions
612
+ }
613
+ ]
614
+ });
615
+ },
616
+ catch: (e) => new DriverError({ message: `Input text failed: ${e}` })
617
+ }),
618
+ pressKey: (key) => Effect2.tryPromise({
619
+ try: () => client.request("POST", client.sessionPath("/actions"), {
620
+ actions: [
621
+ {
622
+ type: "key",
623
+ id: "keyboard",
624
+ actions: [
625
+ { type: "keyDown", value: key },
626
+ { type: "keyUp", value: key }
627
+ ]
628
+ }
629
+ ]
630
+ }),
631
+ catch: (e) => new DriverError({ message: `Press key failed: ${e}` })
632
+ }),
633
+ hideKeyboard: () => Effect2.tryPromise({
634
+ try: () => client.request("POST", client.sessionPath("/appium/device/hide_keyboard")),
635
+ catch: (e) => new DriverError({ message: `Hide keyboard failed: ${e}` })
636
+ }),
637
+ // -----------------------------------------------------------------------
638
+ // Queries
639
+ // -----------------------------------------------------------------------
640
+ takeScreenshot: () => Effect2.tryPromise({
641
+ try: async () => {
642
+ const base64 = await client.request("GET", client.sessionPath("/screenshot"));
643
+ return Uint8Array.from(atob(base64), (c) => c.charCodeAt(0));
644
+ },
645
+ catch: (e) => new DriverError({ message: `Screenshot failed: ${e}` })
646
+ }),
647
+ getDeviceInfo: () => Effect2.tryPromise({
648
+ try: async () => {
649
+ const size = await getAppiumWindowSize(client);
650
+ const caps = client.getSessionCaps();
651
+ return {
652
+ platform: "ios",
653
+ deviceId: client.getSessionId() ?? "appium",
654
+ name: caps["deviceName"] ?? "iOS Device (Appium)",
655
+ isEmulator: false,
656
+ screenWidth: size.width,
657
+ screenHeight: size.height,
658
+ driverType: "appium"
659
+ };
660
+ },
661
+ catch: (e) => new DriverError({ message: `Get device info failed: ${e}` })
662
+ }),
663
+ // -----------------------------------------------------------------------
664
+ // App lifecycle
665
+ // -----------------------------------------------------------------------
666
+ launchApp: (bundleId, opts) => Effect2.tryPromise({
667
+ try: async () => {
668
+ const launchConfig = buildIOSLaunchConfiguration(opts);
669
+ if (opts?.clearState) {
670
+ try {
671
+ await client.request("POST", client.sessionPath("/appium/device/terminate_app"), {
672
+ appId: bundleId
673
+ });
674
+ } catch {
675
+ }
676
+ try {
677
+ await client.executeScript("mobile: clearApp", [{ bundleId }]);
678
+ } catch (e) {
679
+ console.warn(
680
+ `mobile: clearApp unavailable on this provider; falling back to terminate-only. In-memory state will still be reset. (${e})`
681
+ );
682
+ }
683
+ }
684
+ if (!launchConfig) {
685
+ await client.request("POST", client.sessionPath("/appium/device/activate_app"), {
686
+ appId: bundleId
687
+ });
688
+ }
689
+ if (opts?.clearKeychain) {
690
+ console.warn(
691
+ "clearKeychain is not available via Appium on iOS. Use local mode with xcrun simctl for keychain operations."
692
+ );
693
+ }
694
+ if (launchConfig) {
695
+ try {
696
+ await client.request("POST", client.sessionPath("/appium/device/terminate_app"), {
697
+ appId: bundleId
698
+ });
699
+ } catch {
700
+ }
701
+ await client.executeScript("mobile: launchApp", [
702
+ {
703
+ bundleId,
704
+ arguments: launchConfig.arguments,
705
+ environment: launchConfig.environment
706
+ }
707
+ ]);
708
+ }
709
+ if (opts?.deepLink) {
710
+ await client.request("POST", client.sessionPath("/url"), {
711
+ url: opts.deepLink
712
+ });
713
+ }
714
+ },
715
+ catch: (e) => new DriverError({ message: `Launch app failed: ${e}` })
716
+ }),
717
+ stopApp: (bundleId) => Effect2.tryPromise({
718
+ try: () => client.request("POST", client.sessionPath("/appium/device/terminate_app"), {
719
+ appId: bundleId
720
+ }),
721
+ catch: (e) => new DriverError({ message: `Stop app failed: ${e}` })
722
+ }),
723
+ killApp: (bundleId) => Effect2.tryPromise({
724
+ try: () => client.request("POST", client.sessionPath("/appium/device/terminate_app"), {
725
+ appId: bundleId
726
+ }),
727
+ catch: (e) => new DriverError({ message: `Kill app failed: ${e}` })
728
+ }),
729
+ clearAppState: (bundleId) => Effect2.tryPromise({
730
+ try: async () => {
731
+ try {
732
+ await client.request("POST", client.sessionPath("/appium/device/terminate_app"), {
733
+ appId: bundleId
734
+ });
735
+ } catch {
736
+ }
737
+ await client.executeScript("mobile: clearApp", [{ bundleId }]);
738
+ },
739
+ catch: (e) => new DriverError({
740
+ message: `Clear app state failed: ${e}. Note: clearApp may not be available on all iOS Appium providers. If this persists, consider using terminate + uninstall + install instead.`
741
+ })
742
+ }),
743
+ // -----------------------------------------------------------------------
744
+ // Navigation
745
+ // -----------------------------------------------------------------------
746
+ openLink: (url) => Effect2.tryPromise({
747
+ try: () => client.request("POST", client.sessionPath("/url"), { url }),
748
+ catch: (e) => new DriverError({ message: `Open link failed: ${e}` })
749
+ }),
750
+ back: () => Effect2.fail(
751
+ new DriverError({
752
+ message: "back() is not supported on iOS. Use navigation within the app or swipe gestures."
753
+ })
754
+ ),
755
+ // -----------------------------------------------------------------------
756
+ // Scripting (works when switched to a WebView context)
757
+ // -----------------------------------------------------------------------
758
+ evaluate: (script, ...args) => Effect2.tryPromise({
759
+ try: () => client.executeScript(
760
+ typeof script === "function" ? `return (${script})(...arguments)` : script,
761
+ args
762
+ ),
763
+ catch: (e) => new DriverError({ message: `evaluate() failed: ${e}` })
764
+ }),
765
+ // -----------------------------------------------------------------------
766
+ // WebView / hybrid context switching
767
+ // -----------------------------------------------------------------------
768
+ getContexts: () => Effect2.tryPromise({
769
+ try: () => client.getContexts(),
770
+ catch: (e) => new DriverError({ message: `getContexts failed: ${e}` })
771
+ }),
772
+ getCurrentContext: () => Effect2.tryPromise({
773
+ try: () => client.getCurrentContext(),
774
+ catch: (e) => new DriverError({ message: `getCurrentContext failed: ${e}` })
775
+ }),
776
+ setContext: (contextId) => Effect2.tryPromise({
777
+ try: () => client.setContext(contextId),
778
+ catch: (e) => new DriverError({ message: `setContext failed: ${e}` })
779
+ }),
780
+ // -----------------------------------------------------------------------
781
+ // Network conditions
782
+ // -----------------------------------------------------------------------
783
+ setNetworkConditions: (conditions) => Effect2.tryPromise({
784
+ try: () => {
785
+ const resolved = resolveNetworkConditions(conditions);
786
+ const hasAnyValue = conditions.profile !== void 0 || conditions.offline !== void 0 || conditions.latencyMs !== void 0 || conditions.downloadThroughputKbps !== void 0 || conditions.uploadThroughputKbps !== void 0;
787
+ if (!hasAnyValue) {
788
+ return client.executeScript("mobile: setConnectivity", [
789
+ { wifi: true, data: true, airplaneMode: false }
790
+ ]);
791
+ }
792
+ if (resolved.offline) {
793
+ return client.executeScript("mobile: setConnectivity", [
794
+ { wifi: false, data: false, airplaneMode: true }
795
+ ]);
796
+ }
797
+ return client.executeScript("mobile: setConnectivity", [
798
+ { wifi: true, data: true, airplaneMode: false }
799
+ ]);
800
+ },
801
+ catch: (e) => new DriverError({ message: `setNetworkConditions failed: ${e}` })
802
+ })
803
+ };
804
+ return Effect2.succeed(service);
805
+ }
806
+
807
+ // src/runtime/appium.ts
808
+ async function buildAppiumAndroidRuntime(config, appiumUrl, caps) {
809
+ const appId = caps["appium:appPackage"] ?? config.apps?.android?.packageName ?? "";
810
+ const client = new AppiumClient(appiumUrl);
811
+ await client.createSession({
812
+ platformName: "Android",
813
+ ...caps
814
+ });
815
+ const driver = await Effect3.runPromise(createAppiumAndroidDriver(client, appId || void 0));
816
+ const deviceInfo = await Effect3.runPromise(driver.getDeviceInfo());
817
+ const sessionId = client.getSessionId() ?? void 0;
818
+ const sessionCaps = client.getSessionCaps();
819
+ const detectedProvider = detectProvider(appiumUrl);
820
+ const providerName = detectedProvider?.name();
821
+ return {
822
+ runtime: {
823
+ driver,
824
+ cleanup: async () => {
825
+ try {
826
+ await client.deleteSession();
827
+ } catch {
828
+ }
829
+ },
830
+ metadata: {
831
+ platform: "android",
832
+ mode: "appium",
833
+ sessionId,
834
+ sessionCaps,
835
+ provider: providerName
836
+ }
837
+ },
838
+ engineConfig: {
839
+ appId,
840
+ platform: "android",
841
+ coordinatorConfig: {
842
+ parse: parseAndroidHierarchy,
843
+ defaults: {
844
+ timeout: config.defaults?.waitTimeout,
845
+ pollInterval: config.defaults?.pollInterval,
846
+ settleTimeout: config.defaults?.settleTimeout,
847
+ initialPollInterval: config.defaults?.initialPollInterval
848
+ },
849
+ waitForIdleTimeout: config.defaults?.waitForIdleTimeout,
850
+ typingDelay: config.defaults?.typingDelay,
851
+ hierarchyCacheTtl: config.defaults?.hierarchyCacheTtl,
852
+ screenWidth: deviceInfo.screenWidth,
853
+ screenHeight: deviceInfo.screenHeight
854
+ },
855
+ autoLaunch: false,
856
+ // Appium manages app lifecycle
857
+ flowTimeout: config.defaults?.waitTimeout ? config.defaults.waitTimeout * 10 : 6e4,
858
+ artifactConfig: config.artifacts,
859
+ launchOptions: config.launchOptions,
860
+ hooks: config.hooks,
861
+ visualRegression: config.visualRegression
862
+ }
863
+ };
864
+ }
865
+ async function buildAppiumIOSRuntime(config, appiumUrl, caps) {
866
+ const appId = caps["appium:bundleId"] ?? config.apps?.ios?.bundleId ?? "";
867
+ const client = new AppiumClient(appiumUrl);
868
+ await client.createSession({
869
+ platformName: "iOS",
870
+ "appium:automationName": "XCUITest",
871
+ ...caps
872
+ });
873
+ const snapshotMaxDepth = config.defaults?.snapshotMaxDepth ?? 100;
874
+ try {
875
+ await client.request("POST", client.sessionPath("/appium/settings"), {
876
+ settings: { snapshotMaxDepth }
877
+ });
878
+ } catch (e) {
879
+ console.warn(`Failed to set snapshotMaxDepth (continuing): ${e}`);
880
+ }
881
+ const driver = await Effect3.runPromise(createAppiumIOSDriver(client));
882
+ const deviceInfo = await Effect3.runPromise(driver.getDeviceInfo());
883
+ const sessionId = client.getSessionId() ?? void 0;
884
+ const sessionCaps = client.getSessionCaps();
885
+ const detectedProvider = detectProvider(appiumUrl);
886
+ const providerName = detectedProvider?.name();
887
+ return {
888
+ runtime: {
889
+ driver,
890
+ cleanup: async () => {
891
+ try {
892
+ await client.deleteSession();
893
+ } catch {
894
+ }
895
+ },
896
+ metadata: {
897
+ platform: "ios",
898
+ mode: "appium",
899
+ sessionId,
900
+ sessionCaps,
901
+ provider: providerName
902
+ }
903
+ },
904
+ engineConfig: {
905
+ appId,
906
+ platform: "ios",
907
+ coordinatorConfig: {
908
+ parse: parseIOSHierarchy,
909
+ defaults: {
910
+ timeout: config.defaults?.waitTimeout,
911
+ pollInterval: config.defaults?.pollInterval,
912
+ settleTimeout: config.defaults?.settleTimeout,
913
+ initialPollInterval: config.defaults?.initialPollInterval
914
+ },
915
+ waitForIdleTimeout: config.defaults?.waitForIdleTimeout,
916
+ typingDelay: config.defaults?.typingDelay,
917
+ hierarchyCacheTtl: config.defaults?.hierarchyCacheTtl,
918
+ screenWidth: deviceInfo.screenWidth,
919
+ screenHeight: deviceInfo.screenHeight
920
+ },
921
+ autoLaunch: false,
922
+ // Appium manages app lifecycle
923
+ flowTimeout: config.defaults?.waitTimeout ? config.defaults.waitTimeout * 10 : 6e4,
924
+ artifactConfig: config.artifacts,
925
+ launchOptions: config.launchOptions,
926
+ hooks: config.hooks,
927
+ visualRegression: config.visualRegression
928
+ }
929
+ };
930
+ }
931
+ export {
932
+ buildAppiumAndroidRuntime,
933
+ buildAppiumIOSRuntime
934
+ };
935
+ //# sourceMappingURL=appium-CC77BJNK.js.map