appium-xcuitest-driver 10.3.0 → 10.4.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 (257) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/lib/commands/active-app-info.d.ts +9 -0
  3. package/build/lib/commands/active-app-info.d.ts.map +1 -0
  4. package/build/lib/commands/active-app-info.js +14 -0
  5. package/build/lib/commands/active-app-info.js.map +1 -0
  6. package/build/lib/commands/alert.d.ts +42 -45
  7. package/build/lib/commands/alert.d.ts.map +1 -1
  8. package/build/lib/commands/alert.js +66 -62
  9. package/build/lib/commands/alert.js.map +1 -1
  10. package/build/lib/commands/app-management.d.ts +150 -153
  11. package/build/lib/commands/app-management.d.ts.map +1 -1
  12. package/build/lib/commands/app-management.js +300 -286
  13. package/build/lib/commands/app-management.js.map +1 -1
  14. package/build/lib/commands/app-strings.d.ts +14 -17
  15. package/build/lib/commands/app-strings.d.ts.map +1 -1
  16. package/build/lib/commands/app-strings.js +23 -24
  17. package/build/lib/commands/app-strings.js.map +1 -1
  18. package/build/lib/commands/appearance.d.ts +19 -22
  19. package/build/lib/commands/appearance.d.ts.map +1 -1
  20. package/build/lib/commands/appearance.js +56 -56
  21. package/build/lib/commands/appearance.js.map +1 -1
  22. package/build/lib/commands/audit.d.ts +22 -17
  23. package/build/lib/commands/audit.d.ts.map +1 -1
  24. package/build/lib/commands/audit.js +17 -18
  25. package/build/lib/commands/audit.js.map +1 -1
  26. package/build/lib/commands/battery.d.ts +11 -14
  27. package/build/lib/commands/battery.d.ts.map +1 -1
  28. package/build/lib/commands/battery.js +36 -37
  29. package/build/lib/commands/battery.js.map +1 -1
  30. package/build/lib/commands/biometric.d.ts +30 -33
  31. package/build/lib/commands/biometric.d.ts.map +1 -1
  32. package/build/lib/commands/biometric.js +42 -41
  33. package/build/lib/commands/biometric.js.map +1 -1
  34. package/build/lib/commands/certificate.d.ts +48 -45
  35. package/build/lib/commands/certificate.d.ts.map +1 -1
  36. package/build/lib/commands/certificate.js +218 -205
  37. package/build/lib/commands/certificate.js.map +1 -1
  38. package/build/lib/commands/clipboard.d.ts +19 -22
  39. package/build/lib/commands/clipboard.d.ts.map +1 -1
  40. package/build/lib/commands/clipboard.js +30 -30
  41. package/build/lib/commands/clipboard.js.map +1 -1
  42. package/build/lib/commands/condition.d.ts +49 -26
  43. package/build/lib/commands/condition.d.ts.map +1 -1
  44. package/build/lib/commands/condition.js +87 -86
  45. package/build/lib/commands/condition.js.map +1 -1
  46. package/build/lib/commands/content-size.d.ts +26 -29
  47. package/build/lib/commands/content-size.d.ts.map +1 -1
  48. package/build/lib/commands/content-size.js +36 -36
  49. package/build/lib/commands/content-size.js.map +1 -1
  50. package/build/lib/commands/context.d.ts +161 -108
  51. package/build/lib/commands/context.d.ts.map +1 -1
  52. package/build/lib/commands/context.js +530 -517
  53. package/build/lib/commands/context.js.map +1 -1
  54. package/build/lib/commands/deviceInfo.d.ts +9 -12
  55. package/build/lib/commands/deviceInfo.d.ts.map +1 -1
  56. package/build/lib/commands/deviceInfo.js +17 -18
  57. package/build/lib/commands/deviceInfo.js.map +1 -1
  58. package/build/lib/commands/element.d.ts +102 -105
  59. package/build/lib/commands/element.d.ts.map +1 -1
  60. package/build/lib/commands/element.js +337 -323
  61. package/build/lib/commands/element.js.map +1 -1
  62. package/build/lib/commands/execute.d.ts +24 -19
  63. package/build/lib/commands/execute.d.ts.map +1 -1
  64. package/build/lib/commands/execute.js +63 -62
  65. package/build/lib/commands/execute.js.map +1 -1
  66. package/build/lib/commands/file-movement.d.ts +77 -80
  67. package/build/lib/commands/file-movement.d.ts.map +1 -1
  68. package/build/lib/commands/file-movement.js +130 -124
  69. package/build/lib/commands/file-movement.js.map +1 -1
  70. package/build/lib/commands/find.d.ts +18 -21
  71. package/build/lib/commands/find.d.ts.map +1 -1
  72. package/build/lib/commands/find.js +158 -156
  73. package/build/lib/commands/find.js.map +1 -1
  74. package/build/lib/commands/general.d.ts +124 -116
  75. package/build/lib/commands/general.d.ts.map +1 -1
  76. package/build/lib/commands/general.js +248 -232
  77. package/build/lib/commands/general.js.map +1 -1
  78. package/build/lib/commands/geolocation.d.ts +43 -46
  79. package/build/lib/commands/geolocation.d.ts.map +1 -1
  80. package/build/lib/commands/geolocation.js +10 -11
  81. package/build/lib/commands/geolocation.js.map +1 -1
  82. package/build/lib/commands/gesture.d.ts +273 -276
  83. package/build/lib/commands/gesture.d.ts.map +1 -1
  84. package/build/lib/commands/gesture.js +506 -492
  85. package/build/lib/commands/gesture.js.map +1 -1
  86. package/build/lib/commands/increase-contrast.d.ts +20 -23
  87. package/build/lib/commands/increase-contrast.d.ts.map +1 -1
  88. package/build/lib/commands/increase-contrast.js +30 -30
  89. package/build/lib/commands/increase-contrast.js.map +1 -1
  90. package/build/lib/commands/iohid.d.ts +1370 -1373
  91. package/build/lib/commands/iohid.d.ts.map +1 -1
  92. package/build/lib/commands/iohid.js +30 -31
  93. package/build/lib/commands/iohid.js.map +1 -1
  94. package/build/lib/commands/keyboard.d.ts +29 -32
  95. package/build/lib/commands/keyboard.d.ts.map +1 -1
  96. package/build/lib/commands/keyboard.js +53 -51
  97. package/build/lib/commands/keyboard.js.map +1 -1
  98. package/build/lib/commands/keychains.d.ts +9 -12
  99. package/build/lib/commands/keychains.d.ts.map +1 -1
  100. package/build/lib/commands/keychains.js +13 -14
  101. package/build/lib/commands/keychains.js.map +1 -1
  102. package/build/lib/commands/localization.d.ts +16 -19
  103. package/build/lib/commands/localization.d.ts.map +1 -1
  104. package/build/lib/commands/localization.js +25 -26
  105. package/build/lib/commands/localization.js.map +1 -1
  106. package/build/lib/commands/location.d.ts +36 -39
  107. package/build/lib/commands/location.d.ts.map +1 -1
  108. package/build/lib/commands/location.js +99 -98
  109. package/build/lib/commands/location.js.map +1 -1
  110. package/build/lib/commands/lock.d.ts +21 -24
  111. package/build/lib/commands/lock.d.ts.map +1 -1
  112. package/build/lib/commands/lock.js +39 -38
  113. package/build/lib/commands/lock.js.map +1 -1
  114. package/build/lib/commands/log.d.ts +43 -37
  115. package/build/lib/commands/log.d.ts.map +1 -1
  116. package/build/lib/commands/log.js +174 -171
  117. package/build/lib/commands/log.js.map +1 -1
  118. package/build/lib/commands/memory.d.ts +9 -12
  119. package/build/lib/commands/memory.d.ts.map +1 -1
  120. package/build/lib/commands/memory.js +37 -38
  121. package/build/lib/commands/memory.js.map +1 -1
  122. package/build/lib/commands/navigation.d.ts +30 -33
  123. package/build/lib/commands/navigation.d.ts.map +1 -1
  124. package/build/lib/commands/navigation.js +92 -92
  125. package/build/lib/commands/navigation.js.map +1 -1
  126. package/build/lib/commands/notifications.d.ts +26 -29
  127. package/build/lib/commands/notifications.d.ts.map +1 -1
  128. package/build/lib/commands/notifications.js +53 -53
  129. package/build/lib/commands/notifications.js.map +1 -1
  130. package/build/lib/commands/pasteboard.d.ts +21 -24
  131. package/build/lib/commands/pasteboard.d.ts.map +1 -1
  132. package/build/lib/commands/pasteboard.js +37 -37
  133. package/build/lib/commands/pasteboard.js.map +1 -1
  134. package/build/lib/commands/pcap.d.ts +39 -26
  135. package/build/lib/commands/pcap.d.ts.map +1 -1
  136. package/build/lib/commands/pcap.js +81 -81
  137. package/build/lib/commands/pcap.js.map +1 -1
  138. package/build/lib/commands/performance.d.ts +63 -44
  139. package/build/lib/commands/performance.d.ts.map +1 -1
  140. package/build/lib/commands/performance.js +105 -105
  141. package/build/lib/commands/performance.js.map +1 -1
  142. package/build/lib/commands/permissions.d.ts +33 -36
  143. package/build/lib/commands/permissions.d.ts.map +1 -1
  144. package/build/lib/commands/permissions.js +66 -65
  145. package/build/lib/commands/permissions.js.map +1 -1
  146. package/build/lib/commands/proxy-helper.d.ts +12 -15
  147. package/build/lib/commands/proxy-helper.d.ts.map +1 -1
  148. package/build/lib/commands/proxy-helper.js +53 -54
  149. package/build/lib/commands/proxy-helper.js.map +1 -1
  150. package/build/lib/commands/record-audio.d.ts +49 -29
  151. package/build/lib/commands/record-audio.d.ts.map +1 -1
  152. package/build/lib/commands/record-audio.js +100 -104
  153. package/build/lib/commands/record-audio.js.map +1 -1
  154. package/build/lib/commands/recordscreen.d.ts +54 -18
  155. package/build/lib/commands/recordscreen.d.ts.map +1 -1
  156. package/build/lib/commands/recordscreen.js +127 -129
  157. package/build/lib/commands/recordscreen.js.map +1 -1
  158. package/build/lib/commands/screenshots.d.ts +14 -17
  159. package/build/lib/commands/screenshots.d.ts.map +1 -1
  160. package/build/lib/commands/screenshots.js +108 -107
  161. package/build/lib/commands/screenshots.js.map +1 -1
  162. package/build/lib/commands/simctl.d.ts +11 -14
  163. package/build/lib/commands/simctl.d.ts.map +1 -1
  164. package/build/lib/commands/simctl.js +23 -26
  165. package/build/lib/commands/simctl.js.map +1 -1
  166. package/build/lib/commands/source.d.ts +14 -17
  167. package/build/lib/commands/source.d.ts.map +1 -1
  168. package/build/lib/commands/source.js +40 -43
  169. package/build/lib/commands/source.js.map +1 -1
  170. package/build/lib/commands/timeouts.d.ts +44 -33
  171. package/build/lib/commands/timeouts.d.ts.map +1 -1
  172. package/build/lib/commands/timeouts.js +65 -63
  173. package/build/lib/commands/timeouts.js.map +1 -1
  174. package/build/lib/commands/web.d.ts +275 -197
  175. package/build/lib/commands/web.d.ts.map +1 -1
  176. package/build/lib/commands/web.js +866 -785
  177. package/build/lib/commands/web.js.map +1 -1
  178. package/build/lib/commands/xctest-record-screen.d.ts +63 -66
  179. package/build/lib/commands/xctest-record-screen.d.ts.map +1 -1
  180. package/build/lib/commands/xctest-record-screen.js +103 -102
  181. package/build/lib/commands/xctest-record-screen.js.map +1 -1
  182. package/build/lib/commands/xctest.d.ts +55 -51
  183. package/build/lib/commands/xctest.d.ts.map +1 -1
  184. package/build/lib/commands/xctest.js +116 -117
  185. package/build/lib/commands/xctest.js.map +1 -1
  186. package/build/lib/driver.d.ts +277 -1597
  187. package/build/lib/driver.d.ts.map +1 -1
  188. package/build/lib/driver.js +318 -235
  189. package/build/lib/driver.js.map +1 -1
  190. package/build/lib/execute-method-map.d.ts.map +1 -1
  191. package/build/lib/execute-method-map.js +9 -0
  192. package/build/lib/execute-method-map.js.map +1 -1
  193. package/lib/commands/active-app-info.js +12 -0
  194. package/lib/commands/alert.js +68 -65
  195. package/lib/commands/app-management.js +308 -301
  196. package/lib/commands/app-strings.js +24 -26
  197. package/lib/commands/appearance.js +54 -56
  198. package/lib/commands/audit.js +18 -20
  199. package/lib/commands/battery.js +35 -37
  200. package/lib/commands/biometric.js +44 -46
  201. package/lib/commands/certificate.js +226 -215
  202. package/lib/commands/clipboard.js +30 -32
  203. package/lib/commands/condition.js +98 -100
  204. package/lib/commands/content-size.js +36 -38
  205. package/lib/commands/context.js +495 -490
  206. package/lib/commands/deviceInfo.js +19 -20
  207. package/lib/commands/element.js +367 -357
  208. package/lib/commands/execute.js +72 -72
  209. package/lib/commands/file-movement.js +132 -134
  210. package/lib/commands/find.js +160 -159
  211. package/lib/commands/general.js +238 -231
  212. package/lib/commands/geolocation.js +6 -14
  213. package/lib/commands/gesture.js +525 -515
  214. package/lib/commands/increase-contrast.js +30 -32
  215. package/lib/commands/iohid.js +32 -34
  216. package/lib/commands/keyboard.js +49 -51
  217. package/lib/commands/keychains.js +12 -14
  218. package/lib/commands/localization.js +24 -26
  219. package/lib/commands/location.js +102 -104
  220. package/lib/commands/lock.js +38 -38
  221. package/lib/commands/log.js +197 -198
  222. package/lib/commands/memory.js +40 -42
  223. package/lib/commands/navigation.js +96 -100
  224. package/lib/commands/notifications.js +57 -59
  225. package/lib/commands/pasteboard.js +37 -39
  226. package/lib/commands/pcap.js +84 -86
  227. package/lib/commands/performance.js +132 -133
  228. package/lib/commands/permissions.js +67 -69
  229. package/lib/commands/proxy-helper.js +60 -61
  230. package/lib/commands/record-audio.js +115 -120
  231. package/lib/commands/recordscreen.js +145 -149
  232. package/lib/commands/screenshots.js +116 -116
  233. package/lib/commands/simctl.js +25 -29
  234. package/lib/commands/source.js +42 -46
  235. package/lib/commands/timeouts.js +59 -63
  236. package/lib/commands/web.js +932 -859
  237. package/lib/commands/xctest-record-screen.js +103 -105
  238. package/lib/commands/xctest.js +134 -139
  239. package/lib/driver.js +286 -235
  240. package/lib/execute-method-map.ts +9 -0
  241. package/npm-shrinkwrap.json +8 -8
  242. package/package.json +1 -1
  243. package/build/lib/commands/activeAppInfo.d.ts +0 -12
  244. package/build/lib/commands/activeAppInfo.d.ts.map +0 -1
  245. package/build/lib/commands/activeAppInfo.js +0 -15
  246. package/build/lib/commands/activeAppInfo.js.map +0 -1
  247. package/build/lib/commands/index.d.ts +0 -96
  248. package/build/lib/commands/index.d.ts.map +0 -1
  249. package/build/lib/commands/index.js +0 -100
  250. package/build/lib/commands/index.js.map +0 -1
  251. package/build/lib/cookies.d.ts +0 -15
  252. package/build/lib/cookies.d.ts.map +0 -1
  253. package/build/lib/cookies.js +0 -84
  254. package/build/lib/cookies.js.map +0 -1
  255. package/lib/commands/activeAppInfo.js +0 -14
  256. package/lib/commands/index.js +0 -95
  257. package/lib/cookies.js +0 -92
@@ -1 +1 @@
1
- {"version":3,"file":"app-management.d.ts","sourceRoot":"","sources":["../../../lib/commands/app-management.js"],"names":[],"mappings":";IAaE;;;;;;;;;;;;OAYG;IACH,yEATW,MAAM,cACN,MAAM,iBAEN,OAAO,GAGL,OAAO,CAAC,IAAI,CAAC,CA2CzB;IACD;;;;;;;OAOG;IACH,kFAJW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAO5B;IACD;;;;;;;OAOG;IACH,6EAJW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAgB5B;IACD;;;;;;;;;OASG;IACH,6EANW,MAAM,SACN,MAAM,GAAC,MAAM,EAAE,gBACf,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAazB;IACD;;;;;;;OAOG;IACH,gFAJW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAO5B;IACD;;;;;;;;OAQG;IACH,+EAJW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAKzB;IAED;;;;;;;;;;;;OAYG;IACH,2EALW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAY5B;IAED;;;;;;;;;OASG;IACH,iFALW,MAAM,GACJ,OAAO,CAAC,QAAQ,CAAC,CAM7B;IAED;;;;OAIG;IACH,6BAJW,MAAM,4BACN,MAAM,iBAMhB;IACD;;;;OAIG;IACH,+BAJW,MAAM,SACN,MAAM,iCAOhB;IACD;;;OAGG;IACH,4EAHW,MAAM,oBAKhB;IACD;;;;OAIG;IACH,0EAJW,MAAM,GAEJ,OAAO,CAAC,OAAO,CAAC,CAI5B;IACD;;;OAGG;IACH,2EAHW,MAAM,sCAKhB;IAED;;;;;;;;OAQG;IACH,0CALW,MAAM,GAAC,QAAQ,GACb,OAAO,CAAC,MAAM,CAAC,MAAM,EAAC,GAAG,CAAC,EAAE,CAAC,CAezC;IAED;;;;;;;;OAQG;IACH,4EAJW,MAAM,GAEJ,OAAO,CAAC,OAAO,CAAC,CA6B5B;IAED;;;;;;;;;;;OAWG;IACH,wEARW,MAAM,GAAC;QAAC,OAAO,EAAE,MAAM,OAAC,CAAA;KAAC,oBAwCnC;;;6BAIU,OAAO,WAAW,EAAE,cAAc;uBAClC,OAAO,QAAQ,EAAE,QAAQ"}
1
+ {"version":3,"file":"app-management.d.ts","sourceRoot":"","sources":["../../../lib/commands/app-management.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;GAYG;AACH,gFATW,MAAM,cACN,MAAM,iBAEN,OAAO,GAGL,OAAO,CAAC,IAAI,CAAC,CA2CzB;AAED;;;;;;;GAOG;AACH,yFAJW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAO5B;AAED;;;;;;;GAOG;AACH,oFAJW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAgB5B;AAED;;;;;;;;;GASG;AACH,oFANW,MAAM,SACN,MAAM,GAAC,MAAM,EAAE,gBACf,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAazB;AAED;;;;;;;GAOG;AACH,uFAJW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAO5B;AAED;;;;;;;;GAQG;AACH,sFAJW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAKzB;AAED;;;;;;;;;;;;GAYG;AACH,kFALW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAY5B;AAED;;;;;;;;;GASG;AACH,wFALW,MAAM,GACJ,OAAO,CAAC,QAAQ,CAAC,CAM7B;AAED;;;;GAIG;AACH,oCAJW,MAAM,4BACN,MAAM,iBAMhB;AAED;;;;GAIG;AACH,sCAJW,MAAM,SACN,MAAM,gCAOhB;AAED;;;GAGG;AACH,mFAHW,MAAM,oBAKhB;AAED;;;;GAIG;AACH,iFAJW,MAAM,GAEJ,OAAO,CAAC,OAAO,CAAC,CAI5B;AAED;;;GAGG;AACH,kFAHW,MAAM,sCAKhB;AAED;;;;;;;;GAQG;AACH,iDALW,MAAM,GAAC,QAAQ,GACb,OAAO,CAAC,MAAM,CAAC,MAAM,EAAC,GAAG,CAAC,EAAE,CAAC,CAezC;AAED;;;;;;;;GAQG;AACH,mFAJW,MAAM,GAEJ,OAAO,CAAC,OAAO,CAAC,CA6B5B;AAED;;;;;;;;;;;GAWG;AACH,+EARW,MAAM,GAAC;IAAC,OAAO,EAAE,MAAM,OAAC,CAAA;CAAC,oBAwCnC;6BAGY,OAAO,WAAW,EAAE,cAAc;uBAClC,OAAO,QAAQ,EAAE,QAAQ"}
@@ -3,6 +3,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.mobileInstallApp = mobileInstallApp;
7
+ exports.mobileIsAppInstalled = mobileIsAppInstalled;
8
+ exports.mobileRemoveApp = mobileRemoveApp;
9
+ exports.mobileLaunchApp = mobileLaunchApp;
10
+ exports.mobileTerminateApp = mobileTerminateApp;
11
+ exports.mobileActivateApp = mobileActivateApp;
12
+ exports.mobileKillApp = mobileKillApp;
13
+ exports.mobileQueryAppState = mobileQueryAppState;
14
+ exports.installApp = installApp;
15
+ exports.activateApp = activateApp;
16
+ exports.isAppInstalled = isAppInstalled;
17
+ exports.terminateApp = terminateApp;
18
+ exports.queryAppState = queryAppState;
19
+ exports.mobileListApps = mobileListApps;
20
+ exports.mobileClearApp = mobileClearApp;
21
+ exports.background = background;
6
22
  const lodash_1 = __importDefault(require("lodash"));
7
23
  const support_1 = require("appium/support");
8
24
  const driver_1 = require("appium/driver");
@@ -10,298 +26,296 @@ const appium_ios_device_1 = require("appium-ios-device");
10
26
  const node_path_1 = __importDefault(require("node:path"));
11
27
  const bluebird_1 = __importDefault(require("bluebird"));
12
28
  const app_utils_1 = require("../app-utils");
13
- exports.default = {
14
- /**
15
- * Installs the given application to the device under test.
16
- *
17
- * Please ensure the app is built for a correct architecture and is signed with a proper developer signature (for real devices) prior to calling this.
18
- * @param {string} app - See docs for `appium:app` capability
19
- * @param {number} [timeoutMs] - The maximum time to wait until app install is finished (in ms) on real devices.
20
- * If not provided, then the value of `appium:appPushTimeout` capability is used. If the capability is not provided then the default is 240000ms (4 minutes).
21
- * @param {boolean} [checkVersion] - If the application installation follows currently installed application's version status if provided.
22
- * No checking occurs if no this option.
23
- * @privateRemarks Link to capability docs
24
- * @returns {Promise<void>}
25
- * @this {XCUITestDriver}
26
- */
27
- async mobileInstallApp(app, timeoutMs, checkVersion) {
28
- const srcAppPath = await this.helpers.configureApp(app, {
29
- onPostProcess: app_utils_1.onPostConfigureApp.bind(this),
30
- onDownload: app_utils_1.onDownloadApp.bind(this),
31
- supportedExtensions: app_utils_1.SUPPORTED_EXTENSIONS,
32
- });
33
- this.log.info(`Installing '${srcAppPath}' to the ${this.isRealDevice() ? 'real device' : 'Simulator'} ` +
34
- `with UDID '${this.device.udid}'`);
35
- if (!(await support_1.fs.exists(srcAppPath))) {
36
- throw this.log.errorWithException(`The application at '${srcAppPath}' does not exist or is not accessible`);
37
- }
38
- const bundleId = await this.appInfosCache.extractBundleId(srcAppPath);
39
- if (checkVersion) {
40
- const { install } = await this.checkAutInstallationState({
41
- enforceAppInstall: false,
42
- fullReset: false,
43
- noReset: false,
44
- bundleId,
45
- app: srcAppPath,
46
- });
47
- if (!install) {
48
- this.log.info(`Skipping the installation of '${bundleId}'`);
49
- return;
50
- }
51
- }
52
- await this.device.installApp(srcAppPath, bundleId, {
53
- timeoutMs: timeoutMs ?? this.opts.appPushTimeout
29
+ /**
30
+ * Installs the given application to the device under test.
31
+ *
32
+ * Please ensure the app is built for a correct architecture and is signed with a proper developer signature (for real devices) prior to calling this.
33
+ * @param {string} app - See docs for `appium:app` capability
34
+ * @param {number} [timeoutMs] - The maximum time to wait until app install is finished (in ms) on real devices.
35
+ * If not provided, then the value of `appium:appPushTimeout` capability is used. If the capability is not provided then the default is 240000ms (4 minutes).
36
+ * @param {boolean} [checkVersion] - If the application installation follows currently installed application's version status if provided.
37
+ * No checking occurs if no this option.
38
+ * @privateRemarks Link to capability docs
39
+ * @returns {Promise<void>}
40
+ * @this {XCUITestDriver}
41
+ */
42
+ async function mobileInstallApp(app, timeoutMs, checkVersion) {
43
+ const srcAppPath = await this.helpers.configureApp(app, {
44
+ onPostProcess: app_utils_1.onPostConfigureApp.bind(this),
45
+ onDownload: app_utils_1.onDownloadApp.bind(this),
46
+ supportedExtensions: app_utils_1.SUPPORTED_EXTENSIONS,
47
+ });
48
+ this.log.info(`Installing '${srcAppPath}' to the ${this.isRealDevice() ? 'real device' : 'Simulator'} ` +
49
+ `with UDID '${this.device.udid}'`);
50
+ if (!(await support_1.fs.exists(srcAppPath))) {
51
+ throw this.log.errorWithException(`The application at '${srcAppPath}' does not exist or is not accessible`);
52
+ }
53
+ const bundleId = await this.appInfosCache.extractBundleId(srcAppPath);
54
+ if (checkVersion) {
55
+ const { install } = await this.checkAutInstallationState({
56
+ enforceAppInstall: false,
57
+ fullReset: false,
58
+ noReset: false,
59
+ bundleId,
60
+ app: srcAppPath,
54
61
  });
55
- this.log.info(`Installation of '${srcAppPath}' succeeded`);
56
- },
57
- /**
58
- * Checks whether the given application is installed on the device under test.
59
- * Offload app is handled as not installed.
60
- *
61
- * @param {string} bundleId - The bundle identifier of the application to be checked
62
- * @returns {Promise<boolean>} `true` if the application is installed; `false` otherwise
63
- * @this {XCUITestDriver}
64
- */
65
- async mobileIsAppInstalled(bundleId) {
66
- const installed = await this.device.isAppInstalled(bundleId);
67
- this.log.info(`App '${bundleId}' is${installed ? '' : ' not'} installed`);
68
- return installed;
69
- },
70
- /**
71
- * Removes/uninstalls the given application from the device under test.
72
- * Offload app data could also be removed.
73
- *
74
- * @param {string} bundleId - The bundle identifier of the application to be removed
75
- * @returns {Promise<boolean>} `true` if the application has been removed successfully; `false` otherwise
76
- * @this {XCUITestDriver}
77
- */
78
- async mobileRemoveApp(bundleId) {
79
- this.log.info(`Uninstalling the application with bundle identifier '${bundleId}' ` +
80
- `from the ${this.isRealDevice() ? 'real device' : 'Simulator'} with UDID '${this.device.udid}'`);
81
- try {
82
- await this.device.removeApp(bundleId);
83
- this.log.info(`Removal of '${bundleId}' succeeded`);
84
- return true;
85
- }
86
- catch (err) {
87
- this.log.warn(`Cannot remove '${bundleId}'. Original error: ${err.message}`);
88
- return false;
89
- }
90
- },
91
- /**
92
- * Executes the given app on the device under test.
93
- *
94
- * If the app is already running it will be activated. If the app is not installed or cannot be launched then an exception is thrown.
95
- * @param {string} bundleId - The bundle identifier of the application to be launched
96
- * @param {string|string[]} [args] - One or more command line arguments for the app. If the app is already running then this argument is ignored.
97
- * @param {object} [environment] - Environment variables mapping for the app. If the app is already running then this argument is ignored.
98
- * @returns {Promise<void>}
99
- * @this {XCUITestDriver}
100
- */
101
- async mobileLaunchApp(bundleId, args, environment) {
102
- /** @type { {arguments?: any[], environment?: any, bundleId: string} } */
103
- const launchOptions = { bundleId };
104
- if (args) {
105
- launchOptions.arguments = Array.isArray(args) ? args : [args];
106
- }
107
- if (environment) {
108
- launchOptions.environment = environment;
109
- }
110
- await this.proxyCommand('/wda/apps/launch', 'POST', launchOptions);
111
- },
112
- /**
113
- * Terminates the given app on the device under test.
114
- *
115
- * This command performs termination via [XCTest's `terminate`](https://developer.apple.com/documentation/xctest/xcuiapplication/1500637-terminate) API. If the app is not installed an exception is thrown. If the app is not running then nothing is done.
116
- * @param {string} bundleId - The bundle identifier of the application to be terminated
117
- * @returns {Promise<boolean>} `true` if the app has been terminated successfully; `false` otherwise
118
- * @this {XCUITestDriver}
119
- */
120
- async mobileTerminateApp(bundleId) {
121
- return /** @type {boolean} */ (await this.proxyCommand('/wda/apps/terminate', 'POST', { bundleId }));
122
- },
123
- /**
124
- * Activate the given app on the device under test.
125
- *
126
- * This pushes the app to the foreground if it is running in the background. An exception is thrown if the app is not install or isn't running. Nothing is done if the app is already in the foreground.
127
- *
128
- * @param {string} bundleId - The bundle identifier of the application to be activated
129
- * @returns {Promise<void>}
130
- * @this {XCUITestDriver}
131
- */
132
- async mobileActivateApp(bundleId) {
133
- await this.proxyCommand('/wda/apps/activate', 'POST', { bundleId });
134
- },
135
- /**
136
- * Kill the given app on the real device under test by instruments service.
137
- *
138
- * If the app is not running or kill failed, then nothing is done.
139
- *
140
- * @remarks `appium-xcuitest-driver` v4.4 does not require `py-ios-device` to be installed.
141
- * @privateRemarks See implementation at https://github.com/YueChen-C/py-ios-device/blob/51f4683c5c3c385a015858ada07a5f1c62d3cf57/ios_device/cli/base.py#L220
142
- * @see https://github.com/YueChen-C/py-ios-device
143
- * @param {string} bundleId - The bundle identifier of the application to be killed
144
- * @returns {Promise<boolean>} `true` if the app has been killed successfully; `false` otherwise
145
- * @group Real Device Only
146
- * @this {XCUITestDriver}
147
- */
148
- async mobileKillApp(bundleId) {
149
- if (!this.isRealDevice()) {
150
- throw new driver_1.errors.UnsupportedOperationError('A real device is required');
151
- }
152
- return await /** @type {import('../real-device').RealDevice} */ (this.device).terminateApp(bundleId, String(this.opts.platformVersion));
153
- },
154
- /**
155
- * Queries the state of an installed application from the device under test.
156
- *
157
- * If the app with the given `bundleId` is not installed, an exception will be thrown.
158
- *
159
- * @param {string} bundleId - The bundle identifier of the application to be queried
160
- * @returns {Promise<AppState>} The actual application state code
161
- * @see https://developer.apple.com/documentation/xctest/xcuiapplicationstate?language=objc
162
- * @this {XCUITestDriver}
163
- */
164
- async mobileQueryAppState(bundleId) {
165
- return /** @type {AppState} */ (await this.proxyCommand('/wda/apps/state', 'POST', { bundleId }));
166
- },
167
- /**
168
- * @param {string} appPath
169
- * @param {object} opts
170
- * @this {XCUITestDriver}
171
- */
172
- async installApp(appPath, { timeoutMs, strategy } = {}) {
173
- // @ts-ignore Probably a TS bug
174
- await this.mobileInstallApp(appPath, timeoutMs, strategy);
175
- },
176
- /**
177
- * @param {string} bundleId
178
- * @param {object} opts
179
- * @this {XCUITestDriver}
180
- */
181
- async activateApp(bundleId, opts = {}) {
182
- const { environment, arguments: args } = opts;
183
- // @ts-ignore Probably a TS bug
184
- return await this.mobileLaunchApp(bundleId, args, environment);
185
- },
186
- /**
187
- * @param {string} bundleId
188
- * @this {XCUITestDriver}
189
- */
190
- async isAppInstalled(bundleId) {
191
- return await this.mobileIsAppInstalled(bundleId);
192
- },
193
- /**
194
- * @param {string} bundleId
195
- * @this {XCUITestDriver}
196
- * @returns {Promise<boolean>}
197
- */
198
- async terminateApp(bundleId) {
199
- return await this.mobileTerminateApp(bundleId);
200
- },
201
- /**
202
- * @param {string} bundleId
203
- * @this {XCUITestDriver}
204
- */
205
- async queryAppState(bundleId) {
206
- return await this.mobileQueryAppState(bundleId);
207
- },
208
- /**
209
- * List applications installed on the real device under test
210
- *
211
- * Read [Pushing/Pulling files](https://appium.io/docs/en/writing-running-appium/ios/ios-xctest-file-movement/) for more details.
212
- * @param {'User'|'System'} applicationType - The type of applications to list.
213
- * @returns {Promise<Record<string,any>[]>} A list of apps where each item is a mapping of bundle identifiers to maps of platform-specific app properties.
214
- * @remarks Having `UIFileSharingEnabled` set to `true` in the return app properties map means this app supports file upload/download in its `documents` container.
215
- * @group Real Device Only
216
- */
217
- async mobileListApps(applicationType = 'User') {
218
- if (!this.isRealDevice()) {
219
- throw new driver_1.errors.NotImplementedError(`This extension is only supported on real devices`);
220
- }
221
- const service = await appium_ios_device_1.services.startInstallationProxyService(this.device.udid);
222
- try {
223
- return await service.listApplications({ applicationType });
224
- }
225
- finally {
226
- service.close();
62
+ if (!install) {
63
+ this.log.info(`Skipping the installation of '${bundleId}'`);
64
+ return;
227
65
  }
228
- },
229
- /**
230
- * Deletes application data files, so it could start from the clean state next time
231
- * it is launched.
232
- * This API only works on a Simulator.
233
- *
234
- * @param {string} bundleId Application bundle identifier
235
- * @this {XCUITestDriver}
236
- * @returns {Promise<boolean>} true if any files from the app's data container have been deleted
237
- */
238
- async mobileClearApp(bundleId) {
239
- if (this.isRealDevice()) {
240
- throw new driver_1.errors.NotImplementedError(`This extension is only supported on simulators. ` +
241
- `The only known way to clear app data on real devices ` +
242
- `would be to uninstall the app then perform a fresh install of it.`);
243
- }
244
- const simctl = /** @type {import('../driver').Simulator} */ (this.device).simctl;
245
- const dataRoot = await simctl.getAppContainer(bundleId, 'data');
246
- this.log.debug(`Got the data container root of ${bundleId} at '${dataRoot}'`);
247
- if (!await support_1.fs.exists(dataRoot)) {
248
- return false;
249
- }
250
- await this.mobileTerminateApp(bundleId);
251
- const items = await support_1.fs.readdir(dataRoot);
252
- if (!items.length) {
253
- return false;
254
- }
255
- await bluebird_1.default.all(items.map((item) => support_1.fs.rimraf(node_path_1.default.join(dataRoot, item))));
256
- this.log.info(`Cleaned up ${support_1.util.pluralize('item', items.length, true)} from ${bundleId}'s data container`);
66
+ }
67
+ await this.device.installApp(srcAppPath, bundleId, {
68
+ timeoutMs: timeoutMs ?? this.opts.appPushTimeout
69
+ });
70
+ this.log.info(`Installation of '${srcAppPath}' succeeded`);
71
+ }
72
+ /**
73
+ * Checks whether the given application is installed on the device under test.
74
+ * Offload app is handled as not installed.
75
+ *
76
+ * @param {string} bundleId - The bundle identifier of the application to be checked
77
+ * @returns {Promise<boolean>} `true` if the application is installed; `false` otherwise
78
+ * @this {XCUITestDriver}
79
+ */
80
+ async function mobileIsAppInstalled(bundleId) {
81
+ const installed = await this.device.isAppInstalled(bundleId);
82
+ this.log.info(`App '${bundleId}' is${installed ? '' : ' not'} installed`);
83
+ return installed;
84
+ }
85
+ /**
86
+ * Removes/uninstalls the given application from the device under test.
87
+ * Offload app data could also be removed.
88
+ *
89
+ * @param {string} bundleId - The bundle identifier of the application to be removed
90
+ * @returns {Promise<boolean>} `true` if the application has been removed successfully; `false` otherwise
91
+ * @this {XCUITestDriver}
92
+ */
93
+ async function mobileRemoveApp(bundleId) {
94
+ this.log.info(`Uninstalling the application with bundle identifier '${bundleId}' ` +
95
+ `from the ${this.isRealDevice() ? 'real device' : 'Simulator'} with UDID '${this.device.udid}'`);
96
+ try {
97
+ await this.device.removeApp(bundleId);
98
+ this.log.info(`Removal of '${bundleId}' succeeded`);
257
99
  return true;
258
- },
259
- /**
260
- * Close app (simulate device home button). It is possible to restore
261
- * the app after the timeout or keep it minimized based on the parameter value.
262
- *
263
- * @param {number|{timeout: number?}} [seconds]
264
- * - any positive number of seconds: come back after X seconds
265
- * - any negative number of seconds or zero: never come back
266
- * - undefined/null: never come back
267
- * - {timeout: 5000}: come back after 5 seconds
268
- * - {timeout: null}, {timeout: -2}: never come back
269
- * @this {XCUITestDriver}
270
- */
271
- async background(seconds) {
272
- const homescreen = '/wda/homescreen';
273
- const deactivateApp = '/wda/deactivateApp';
274
- let endpoint;
275
- let params = {};
276
- const selectEndpoint = (timeoutSeconds) => {
277
- if (!support_1.util.hasValue(timeoutSeconds)) {
278
- endpoint = homescreen;
100
+ }
101
+ catch (err) {
102
+ this.log.warn(`Cannot remove '${bundleId}'. Original error: ${err.message}`);
103
+ return false;
104
+ }
105
+ }
106
+ /**
107
+ * Executes the given app on the device under test.
108
+ *
109
+ * If the app is already running it will be activated. If the app is not installed or cannot be launched then an exception is thrown.
110
+ * @param {string} bundleId - The bundle identifier of the application to be launched
111
+ * @param {string|string[]} [args] - One or more command line arguments for the app. If the app is already running then this argument is ignored.
112
+ * @param {object} [environment] - Environment variables mapping for the app. If the app is already running then this argument is ignored.
113
+ * @returns {Promise<void>}
114
+ * @this {XCUITestDriver}
115
+ */
116
+ async function mobileLaunchApp(bundleId, args, environment) {
117
+ /** @type { {arguments?: any[], environment?: any, bundleId: string} } */
118
+ const launchOptions = { bundleId };
119
+ if (args) {
120
+ launchOptions.arguments = Array.isArray(args) ? args : [args];
121
+ }
122
+ if (environment) {
123
+ launchOptions.environment = environment;
124
+ }
125
+ await this.proxyCommand('/wda/apps/launch', 'POST', launchOptions);
126
+ }
127
+ /**
128
+ * Terminates the given app on the device under test.
129
+ *
130
+ * This command performs termination via [XCTest's `terminate`](https://developer.apple.com/documentation/xctest/xcuiapplication/1500637-terminate) API. If the app is not installed an exception is thrown. If the app is not running then nothing is done.
131
+ * @param {string} bundleId - The bundle identifier of the application to be terminated
132
+ * @returns {Promise<boolean>} `true` if the app has been terminated successfully; `false` otherwise
133
+ * @this {XCUITestDriver}
134
+ */
135
+ async function mobileTerminateApp(bundleId) {
136
+ return /** @type {boolean} */ (await this.proxyCommand('/wda/apps/terminate', 'POST', { bundleId }));
137
+ }
138
+ /**
139
+ * Activate the given app on the device under test.
140
+ *
141
+ * This pushes the app to the foreground if it is running in the background. An exception is thrown if the app is not install or isn't running. Nothing is done if the app is already in the foreground.
142
+ *
143
+ * @param {string} bundleId - The bundle identifier of the application to be activated
144
+ * @returns {Promise<void>}
145
+ * @this {XCUITestDriver}
146
+ */
147
+ async function mobileActivateApp(bundleId) {
148
+ await this.proxyCommand('/wda/apps/activate', 'POST', { bundleId });
149
+ }
150
+ /**
151
+ * Kill the given app on the real device under test by instruments service.
152
+ *
153
+ * If the app is not running or kill failed, then nothing is done.
154
+ *
155
+ * @remarks `appium-xcuitest-driver` v4.4 does not require `py-ios-device` to be installed.
156
+ * @privateRemarks See implementation at https://github.com/YueChen-C/py-ios-device/blob/51f4683c5c3c385a015858ada07a5f1c62d3cf57/ios_device/cli/base.py#L220
157
+ * @see https://github.com/YueChen-C/py-ios-device
158
+ * @param {string} bundleId - The bundle identifier of the application to be killed
159
+ * @returns {Promise<boolean>} `true` if the app has been killed successfully; `false` otherwise
160
+ * @group Real Device Only
161
+ * @this {XCUITestDriver}
162
+ */
163
+ async function mobileKillApp(bundleId) {
164
+ if (!this.isRealDevice()) {
165
+ throw new driver_1.errors.UnsupportedOperationError('A real device is required');
166
+ }
167
+ return await /** @type {import('../real-device').RealDevice} */ (this.device).terminateApp(bundleId, String(this.opts.platformVersion));
168
+ }
169
+ /**
170
+ * Queries the state of an installed application from the device under test.
171
+ *
172
+ * If the app with the given `bundleId` is not installed, an exception will be thrown.
173
+ *
174
+ * @param {string} bundleId - The bundle identifier of the application to be queried
175
+ * @returns {Promise<AppState>} The actual application state code
176
+ * @see https://developer.apple.com/documentation/xctest/xcuiapplicationstate?language=objc
177
+ * @this {XCUITestDriver}
178
+ */
179
+ async function mobileQueryAppState(bundleId) {
180
+ return /** @type {AppState} */ (await this.proxyCommand('/wda/apps/state', 'POST', { bundleId }));
181
+ }
182
+ /**
183
+ * @param {string} appPath
184
+ * @param {object} opts
185
+ * @this {XCUITestDriver}
186
+ */
187
+ async function installApp(appPath, { timeoutMs, strategy } = {}) {
188
+ // @ts-ignore Probably a TS bug
189
+ await this.mobileInstallApp(appPath, timeoutMs, strategy);
190
+ }
191
+ /**
192
+ * @param {string} bundleId
193
+ * @param {object} opts
194
+ * @this {XCUITestDriver}
195
+ */
196
+ async function activateApp(bundleId, opts = {}) {
197
+ const { environment, arguments: args } = opts;
198
+ // @ts-ignore Probably a TS bug
199
+ return await this.mobileLaunchApp(bundleId, args, environment);
200
+ }
201
+ /**
202
+ * @param {string} bundleId
203
+ * @this {XCUITestDriver}
204
+ */
205
+ async function isAppInstalled(bundleId) {
206
+ return await this.mobileIsAppInstalled(bundleId);
207
+ }
208
+ /**
209
+ * @param {string} bundleId
210
+ * @this {XCUITestDriver}
211
+ * @returns {Promise<boolean>}
212
+ */
213
+ async function terminateApp(bundleId) {
214
+ return await this.mobileTerminateApp(bundleId);
215
+ }
216
+ /**
217
+ * @param {string} bundleId
218
+ * @this {XCUITestDriver}
219
+ */
220
+ async function queryAppState(bundleId) {
221
+ return await this.mobileQueryAppState(bundleId);
222
+ }
223
+ /**
224
+ * List applications installed on the real device under test
225
+ *
226
+ * Read [Pushing/Pulling files](https://appium.io/docs/en/writing-running-appium/ios/ios-xctest-file-movement/) for more details.
227
+ * @param {'User'|'System'} applicationType - The type of applications to list.
228
+ * @returns {Promise<Record<string,any>[]>} A list of apps where each item is a mapping of bundle identifiers to maps of platform-specific app properties.
229
+ * @remarks Having `UIFileSharingEnabled` set to `true` in the return app properties map means this app supports file upload/download in its `documents` container.
230
+ * @group Real Device Only
231
+ */
232
+ async function mobileListApps(applicationType = 'User') {
233
+ if (!this.isRealDevice()) {
234
+ throw new driver_1.errors.NotImplementedError(`This extension is only supported on real devices`);
235
+ }
236
+ const service = await appium_ios_device_1.services.startInstallationProxyService(this.device.udid);
237
+ try {
238
+ return await service.listApplications({ applicationType });
239
+ }
240
+ finally {
241
+ service.close();
242
+ }
243
+ }
244
+ /**
245
+ * Deletes application data files, so it could start from the clean state next time
246
+ * it is launched.
247
+ * This API only works on a Simulator.
248
+ *
249
+ * @param {string} bundleId Application bundle identifier
250
+ * @this {XCUITestDriver}
251
+ * @returns {Promise<boolean>} true if any files from the app's data container have been deleted
252
+ */
253
+ async function mobileClearApp(bundleId) {
254
+ if (this.isRealDevice()) {
255
+ throw new driver_1.errors.NotImplementedError(`This extension is only supported on simulators. ` +
256
+ `The only known way to clear app data on real devices ` +
257
+ `would be to uninstall the app then perform a fresh install of it.`);
258
+ }
259
+ const simctl = /** @type {import('../driver').Simulator} */ (this.device).simctl;
260
+ const dataRoot = await simctl.getAppContainer(bundleId, 'data');
261
+ this.log.debug(`Got the data container root of ${bundleId} at '${dataRoot}'`);
262
+ if (!await support_1.fs.exists(dataRoot)) {
263
+ return false;
264
+ }
265
+ await this.mobileTerminateApp(bundleId);
266
+ const items = await support_1.fs.readdir(dataRoot);
267
+ if (!items.length) {
268
+ return false;
269
+ }
270
+ await bluebird_1.default.all(items.map((item) => support_1.fs.rimraf(node_path_1.default.join(dataRoot, item))));
271
+ this.log.info(`Cleaned up ${support_1.util.pluralize('item', items.length, true)} from ${bundleId}'s data container`);
272
+ return true;
273
+ }
274
+ /**
275
+ * Close app (simulate device home button). It is possible to restore
276
+ * the app after the timeout or keep it minimized based on the parameter value.
277
+ *
278
+ * @param {number|{timeout: number?}} [seconds]
279
+ * - any positive number of seconds: come back after X seconds
280
+ * - any negative number of seconds or zero: never come back
281
+ * - undefined/null: never come back
282
+ * - {timeout: 5000}: come back after 5 seconds
283
+ * - {timeout: null}, {timeout: -2}: never come back
284
+ * @this {XCUITestDriver}
285
+ */
286
+ async function background(seconds) {
287
+ const homescreen = '/wda/homescreen';
288
+ const deactivateApp = '/wda/deactivateApp';
289
+ let endpoint;
290
+ let params = {};
291
+ const selectEndpoint = (timeoutSeconds) => {
292
+ if (!support_1.util.hasValue(timeoutSeconds)) {
293
+ endpoint = homescreen;
294
+ }
295
+ else if (!isNaN(timeoutSeconds)) {
296
+ const duration = parseFloat(timeoutSeconds);
297
+ if (duration >= 0) {
298
+ params = { duration };
299
+ endpoint = deactivateApp;
279
300
  }
280
- else if (!isNaN(timeoutSeconds)) {
281
- const duration = parseFloat(timeoutSeconds);
282
- if (duration >= 0) {
283
- params = { duration };
284
- endpoint = deactivateApp;
285
- }
286
- else {
287
- endpoint = homescreen;
288
- }
301
+ else {
302
+ endpoint = homescreen;
289
303
  }
290
- };
291
- if (seconds && !lodash_1.default.isNumber(seconds) && lodash_1.default.has(seconds, 'timeout')) {
292
- const timeout = seconds.timeout;
293
- selectEndpoint(isNaN(Number(timeout)) ? timeout : parseFloat(String(timeout)) / 1000.0);
294
304
  }
295
- else {
296
- selectEndpoint(seconds);
297
- }
298
- if (!endpoint) {
299
- throw new driver_1.errors.InvalidArgumentError(`Argument value is expected to be a valid number. ` +
300
- `${JSON.stringify(seconds)} has been provided instead`);
301
- }
302
- return await this.proxyCommand(endpoint, 'POST', params, endpoint !== homescreen);
303
- },
304
- };
305
+ };
306
+ if (seconds && !lodash_1.default.isNumber(seconds) && lodash_1.default.has(seconds, 'timeout')) {
307
+ const timeout = seconds.timeout;
308
+ selectEndpoint(isNaN(Number(timeout)) ? timeout : parseFloat(String(timeout)) / 1000.0);
309
+ }
310
+ else {
311
+ selectEndpoint(seconds);
312
+ }
313
+ if (!endpoint) {
314
+ throw new driver_1.errors.InvalidArgumentError(`Argument value is expected to be a valid number. ` +
315
+ `${JSON.stringify(seconds)} has been provided instead`);
316
+ }
317
+ return await this.proxyCommand(endpoint, 'POST', params, endpoint !== homescreen);
318
+ }
305
319
  /**
306
320
  * @typedef {import('../driver').XCUITestDriver} XCUITestDriver
307
321
  * @typedef {import('./enum').AppState} AppState