@limrun/appium-xcuitest-driver 10.4.3-lim.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 (444) hide show
  1. package/CHANGELOG.md +2600 -0
  2. package/LICENSE +201 -0
  3. package/README.md +55 -0
  4. package/build/index.d.ts +5 -0
  5. package/build/index.js +41 -0
  6. package/build/lib/app-infos-cache.d.ts +62 -0
  7. package/build/lib/app-infos-cache.d.ts.map +1 -0
  8. package/build/lib/app-infos-cache.js +180 -0
  9. package/build/lib/app-infos-cache.js.map +1 -0
  10. package/build/lib/app-utils.d.ts +89 -0
  11. package/build/lib/app-utils.d.ts.map +1 -0
  12. package/build/lib/app-utils.js +657 -0
  13. package/build/lib/app-utils.js.map +1 -0
  14. package/build/lib/commands/active-app-info.d.ts +9 -0
  15. package/build/lib/commands/active-app-info.d.ts.map +1 -0
  16. package/build/lib/commands/active-app-info.js +14 -0
  17. package/build/lib/commands/active-app-info.js.map +1 -0
  18. package/build/lib/commands/advanced-battery-types.d.ts +444 -0
  19. package/build/lib/commands/advanced-battery-types.d.ts.map +1 -0
  20. package/build/lib/commands/advanced-battery-types.js +8 -0
  21. package/build/lib/commands/advanced-battery-types.js.map +1 -0
  22. package/build/lib/commands/alert.d.ts +45 -0
  23. package/build/lib/commands/alert.d.ts.map +1 -0
  24. package/build/lib/commands/alert.js +87 -0
  25. package/build/lib/commands/alert.js.map +1 -0
  26. package/build/lib/commands/app-management.d.ts +153 -0
  27. package/build/lib/commands/app-management.d.ts.map +1 -0
  28. package/build/lib/commands/app-management.js +323 -0
  29. package/build/lib/commands/app-management.js.map +1 -0
  30. package/build/lib/commands/app-strings.d.ts +16 -0
  31. package/build/lib/commands/app-strings.d.ts.map +1 -0
  32. package/build/lib/commands/app-strings.js +30 -0
  33. package/build/lib/commands/app-strings.js.map +1 -0
  34. package/build/lib/commands/appearance.d.ts +22 -0
  35. package/build/lib/commands/appearance.d.ts.map +1 -0
  36. package/build/lib/commands/appearance.js +74 -0
  37. package/build/lib/commands/appearance.js.map +1 -0
  38. package/build/lib/commands/audit.d.ts +43 -0
  39. package/build/lib/commands/audit.d.ts.map +1 -0
  40. package/build/lib/commands/audit.js +31 -0
  41. package/build/lib/commands/audit.js.map +1 -0
  42. package/build/lib/commands/battery.d.ts +13 -0
  43. package/build/lib/commands/battery.d.ts.map +1 -0
  44. package/build/lib/commands/battery.js +49 -0
  45. package/build/lib/commands/battery.js.map +1 -0
  46. package/build/lib/commands/bidi/constants.d.ts +6 -0
  47. package/build/lib/commands/bidi/constants.d.ts.map +1 -0
  48. package/build/lib/commands/bidi/constants.js +10 -0
  49. package/build/lib/commands/bidi/constants.js.map +1 -0
  50. package/build/lib/commands/bidi/models.d.ts +9 -0
  51. package/build/lib/commands/bidi/models.d.ts.map +1 -0
  52. package/build/lib/commands/bidi/models.js +54 -0
  53. package/build/lib/commands/bidi/models.js.map +1 -0
  54. package/build/lib/commands/bidi/types.d.ts +26 -0
  55. package/build/lib/commands/bidi/types.d.ts.map +1 -0
  56. package/build/lib/commands/bidi/types.js +4 -0
  57. package/build/lib/commands/bidi/types.js.map +1 -0
  58. package/build/lib/commands/biometric.d.ts +32 -0
  59. package/build/lib/commands/biometric.d.ts.map +1 -0
  60. package/build/lib/commands/biometric.js +54 -0
  61. package/build/lib/commands/biometric.js.map +1 -0
  62. package/build/lib/commands/certificate.d.ts +50 -0
  63. package/build/lib/commands/certificate.d.ts.map +1 -0
  64. package/build/lib/commands/certificate.js +454 -0
  65. package/build/lib/commands/certificate.js.map +1 -0
  66. package/build/lib/commands/clipboard.d.ts +21 -0
  67. package/build/lib/commands/clipboard.d.ts.map +1 -0
  68. package/build/lib/commands/clipboard.js +36 -0
  69. package/build/lib/commands/clipboard.js.map +1 -0
  70. package/build/lib/commands/condition.d.ts +102 -0
  71. package/build/lib/commands/condition.d.ts.map +1 -0
  72. package/build/lib/commands/condition.js +146 -0
  73. package/build/lib/commands/condition.js.map +1 -0
  74. package/build/lib/commands/content-size.d.ts +30 -0
  75. package/build/lib/commands/content-size.d.ts.map +1 -0
  76. package/build/lib/commands/content-size.js +67 -0
  77. package/build/lib/commands/content-size.js.map +1 -0
  78. package/build/lib/commands/context.d.ts +191 -0
  79. package/build/lib/commands/context.d.ts.map +1 -0
  80. package/build/lib/commands/context.js +625 -0
  81. package/build/lib/commands/context.js.map +1 -0
  82. package/build/lib/commands/deviceInfo.d.ts +12 -0
  83. package/build/lib/commands/deviceInfo.d.ts.map +1 -0
  84. package/build/lib/commands/deviceInfo.js +25 -0
  85. package/build/lib/commands/deviceInfo.js.map +1 -0
  86. package/build/lib/commands/element.d.ts +108 -0
  87. package/build/lib/commands/element.d.ts.map +1 -0
  88. package/build/lib/commands/element.js +395 -0
  89. package/build/lib/commands/element.js.map +1 -0
  90. package/build/lib/commands/enum.d.ts +105 -0
  91. package/build/lib/commands/enum.d.ts.map +1 -0
  92. package/build/lib/commands/enum.js +113 -0
  93. package/build/lib/commands/enum.js.map +1 -0
  94. package/build/lib/commands/execute.d.ts +33 -0
  95. package/build/lib/commands/execute.d.ts.map +1 -0
  96. package/build/lib/commands/execute.js +142 -0
  97. package/build/lib/commands/execute.js.map +1 -0
  98. package/build/lib/commands/file-movement.d.ts +90 -0
  99. package/build/lib/commands/file-movement.d.ts.map +1 -0
  100. package/build/lib/commands/file-movement.js +477 -0
  101. package/build/lib/commands/file-movement.js.map +1 -0
  102. package/build/lib/commands/find.d.ts +21 -0
  103. package/build/lib/commands/find.d.ts.map +1 -0
  104. package/build/lib/commands/find.js +199 -0
  105. package/build/lib/commands/find.js.map +1 -0
  106. package/build/lib/commands/general.d.ts +137 -0
  107. package/build/lib/commands/general.d.ts.map +1 -0
  108. package/build/lib/commands/general.js +270 -0
  109. package/build/lib/commands/general.js.map +1 -0
  110. package/build/lib/commands/geolocation.d.ts +57 -0
  111. package/build/lib/commands/geolocation.d.ts.map +1 -0
  112. package/build/lib/commands/geolocation.js +58 -0
  113. package/build/lib/commands/geolocation.js.map +1 -0
  114. package/build/lib/commands/gesture.d.ts +283 -0
  115. package/build/lib/commands/gesture.d.ts.map +1 -0
  116. package/build/lib/commands/gesture.js +565 -0
  117. package/build/lib/commands/gesture.js.map +1 -0
  118. package/build/lib/commands/hid-event.d.ts +2773 -0
  119. package/build/lib/commands/hid-event.d.ts.map +1 -0
  120. package/build/lib/commands/hid-event.js +1633 -0
  121. package/build/lib/commands/hid-event.js.map +1 -0
  122. package/build/lib/commands/increase-contrast.d.ts +24 -0
  123. package/build/lib/commands/increase-contrast.d.ts.map +1 -0
  124. package/build/lib/commands/increase-contrast.js +49 -0
  125. package/build/lib/commands/increase-contrast.js.map +1 -0
  126. package/build/lib/commands/iohid.d.ts +1372 -0
  127. package/build/lib/commands/iohid.d.ts.map +1 -0
  128. package/build/lib/commands/iohid.js +63 -0
  129. package/build/lib/commands/iohid.js.map +1 -0
  130. package/build/lib/commands/keyboard.d.ts +32 -0
  131. package/build/lib/commands/keyboard.d.ts.map +1 -0
  132. package/build/lib/commands/keyboard.js +67 -0
  133. package/build/lib/commands/keyboard.js.map +1 -0
  134. package/build/lib/commands/keychains.d.ts +10 -0
  135. package/build/lib/commands/keychains.d.ts.map +1 -0
  136. package/build/lib/commands/keychains.js +22 -0
  137. package/build/lib/commands/keychains.js.map +1 -0
  138. package/build/lib/commands/localization.d.ts +17 -0
  139. package/build/lib/commands/localization.d.ts.map +1 -0
  140. package/build/lib/commands/localization.js +34 -0
  141. package/build/lib/commands/localization.js.map +1 -0
  142. package/build/lib/commands/location.d.ts +40 -0
  143. package/build/lib/commands/location.d.ts.map +1 -0
  144. package/build/lib/commands/location.js +121 -0
  145. package/build/lib/commands/location.js.map +1 -0
  146. package/build/lib/commands/lock.d.ts +23 -0
  147. package/build/lib/commands/lock.d.ts.map +1 -0
  148. package/build/lib/commands/lock.js +49 -0
  149. package/build/lib/commands/lock.js.map +1 -0
  150. package/build/lib/commands/log.d.ts +68 -0
  151. package/build/lib/commands/log.d.ts.map +1 -0
  152. package/build/lib/commands/log.js +287 -0
  153. package/build/lib/commands/log.js.map +1 -0
  154. package/build/lib/commands/memory.d.ts +11 -0
  155. package/build/lib/commands/memory.d.ts.map +1 -0
  156. package/build/lib/commands/memory.js +49 -0
  157. package/build/lib/commands/memory.js.map +1 -0
  158. package/build/lib/commands/navigation.d.ts +44 -0
  159. package/build/lib/commands/navigation.d.ts.map +1 -0
  160. package/build/lib/commands/navigation.js +121 -0
  161. package/build/lib/commands/navigation.js.map +1 -0
  162. package/build/lib/commands/notifications.d.ts +28 -0
  163. package/build/lib/commands/notifications.d.ts.map +1 -0
  164. package/build/lib/commands/notifications.js +64 -0
  165. package/build/lib/commands/notifications.js.map +1 -0
  166. package/build/lib/commands/pasteboard.d.ts +23 -0
  167. package/build/lib/commands/pasteboard.d.ts.map +1 -0
  168. package/build/lib/commands/pasteboard.js +43 -0
  169. package/build/lib/commands/pasteboard.js.map +1 -0
  170. package/build/lib/commands/pcap.d.ts +54 -0
  171. package/build/lib/commands/pcap.d.ts.map +1 -0
  172. package/build/lib/commands/pcap.js +149 -0
  173. package/build/lib/commands/pcap.js.map +1 -0
  174. package/build/lib/commands/performance.d.ts +85 -0
  175. package/build/lib/commands/performance.d.ts.map +1 -0
  176. package/build/lib/commands/performance.js +331 -0
  177. package/build/lib/commands/performance.js.map +1 -0
  178. package/build/lib/commands/permissions.d.ts +36 -0
  179. package/build/lib/commands/permissions.d.ts.map +1 -0
  180. package/build/lib/commands/permissions.js +80 -0
  181. package/build/lib/commands/permissions.js.map +1 -0
  182. package/build/lib/commands/proxy-helper.d.ts +15 -0
  183. package/build/lib/commands/proxy-helper.d.ts.map +1 -0
  184. package/build/lib/commands/proxy-helper.js +117 -0
  185. package/build/lib/commands/proxy-helper.js.map +1 -0
  186. package/build/lib/commands/record-audio.d.ts +69 -0
  187. package/build/lib/commands/record-audio.d.ts.map +1 -0
  188. package/build/lib/commands/record-audio.js +228 -0
  189. package/build/lib/commands/record-audio.js.map +1 -0
  190. package/build/lib/commands/recordscreen.d.ts +89 -0
  191. package/build/lib/commands/recordscreen.d.ts.map +1 -0
  192. package/build/lib/commands/recordscreen.js +326 -0
  193. package/build/lib/commands/recordscreen.js.map +1 -0
  194. package/build/lib/commands/screenshots.d.ts +16 -0
  195. package/build/lib/commands/screenshots.d.ts.map +1 -0
  196. package/build/lib/commands/screenshots.js +129 -0
  197. package/build/lib/commands/screenshots.js.map +1 -0
  198. package/build/lib/commands/simctl.d.ts +27 -0
  199. package/build/lib/commands/simctl.d.ts.map +1 -0
  200. package/build/lib/commands/simctl.js +65 -0
  201. package/build/lib/commands/simctl.js.map +1 -0
  202. package/build/lib/commands/source.d.ts +16 -0
  203. package/build/lib/commands/source.d.ts.map +1 -0
  204. package/build/lib/commands/source.js +128 -0
  205. package/build/lib/commands/source.js.map +1 -0
  206. package/build/lib/commands/timeouts.d.ts +53 -0
  207. package/build/lib/commands/timeouts.d.ts.map +1 -0
  208. package/build/lib/commands/timeouts.js +71 -0
  209. package/build/lib/commands/timeouts.js.map +1 -0
  210. package/build/lib/commands/types.d.ts +539 -0
  211. package/build/lib/commands/types.d.ts.map +1 -0
  212. package/build/lib/commands/types.js +3 -0
  213. package/build/lib/commands/types.js.map +1 -0
  214. package/build/lib/commands/web.d.ts +297 -0
  215. package/build/lib/commands/web.d.ts.map +1 -0
  216. package/build/lib/commands/web.js +1029 -0
  217. package/build/lib/commands/web.js.map +1 -0
  218. package/build/lib/commands/xctest-record-screen.d.ts +92 -0
  219. package/build/lib/commands/xctest-record-screen.d.ts.map +1 -0
  220. package/build/lib/commands/xctest-record-screen.js +193 -0
  221. package/build/lib/commands/xctest-record-screen.js.map +1 -0
  222. package/build/lib/commands/xctest.d.ts +71 -0
  223. package/build/lib/commands/xctest.d.ts.map +1 -0
  224. package/build/lib/commands/xctest.js +257 -0
  225. package/build/lib/commands/xctest.js.map +1 -0
  226. package/build/lib/css-converter.d.ts +10 -0
  227. package/build/lib/css-converter.d.ts.map +1 -0
  228. package/build/lib/css-converter.js +258 -0
  229. package/build/lib/css-converter.js.map +1 -0
  230. package/build/lib/desired-caps.d.ts +506 -0
  231. package/build/lib/desired-caps.d.ts.map +1 -0
  232. package/build/lib/desired-caps.js +400 -0
  233. package/build/lib/desired-caps.js.map +1 -0
  234. package/build/lib/device-connections-factory.d.ts +13 -0
  235. package/build/lib/device-connections-factory.d.ts.map +1 -0
  236. package/build/lib/device-connections-factory.js +244 -0
  237. package/build/lib/device-connections-factory.js.map +1 -0
  238. package/build/lib/device-log/helpers.d.ts +10 -0
  239. package/build/lib/device-log/helpers.d.ts.map +1 -0
  240. package/build/lib/device-log/helpers.js +37 -0
  241. package/build/lib/device-log/helpers.js.map +1 -0
  242. package/build/lib/device-log/ios-crash-log.d.ts +34 -0
  243. package/build/lib/device-log/ios-crash-log.d.ts.map +1 -0
  244. package/build/lib/device-log/ios-crash-log.js +141 -0
  245. package/build/lib/device-log/ios-crash-log.js.map +1 -0
  246. package/build/lib/device-log/ios-device-log.d.ts +19 -0
  247. package/build/lib/device-log/ios-device-log.d.ts.map +1 -0
  248. package/build/lib/device-log/ios-device-log.js +42 -0
  249. package/build/lib/device-log/ios-device-log.js.map +1 -0
  250. package/build/lib/device-log/ios-log.d.ts +24 -0
  251. package/build/lib/device-log/ios-log.d.ts.map +1 -0
  252. package/build/lib/device-log/ios-log.js +50 -0
  253. package/build/lib/device-log/ios-log.js.map +1 -0
  254. package/build/lib/device-log/ios-performance-log.d.ts +18 -0
  255. package/build/lib/device-log/ios-performance-log.d.ts.map +1 -0
  256. package/build/lib/device-log/ios-performance-log.js +43 -0
  257. package/build/lib/device-log/ios-performance-log.js.map +1 -0
  258. package/build/lib/device-log/ios-simulator-log.d.ts +38 -0
  259. package/build/lib/device-log/ios-simulator-log.d.ts.map +1 -0
  260. package/build/lib/device-log/ios-simulator-log.js +184 -0
  261. package/build/lib/device-log/ios-simulator-log.js.map +1 -0
  262. package/build/lib/device-log/line-consuming-log.d.ts +9 -0
  263. package/build/lib/device-log/line-consuming-log.d.ts.map +1 -0
  264. package/build/lib/device-log/line-consuming-log.js +16 -0
  265. package/build/lib/device-log/line-consuming-log.js.map +1 -0
  266. package/build/lib/device-log/safari-console-log.d.ts +67 -0
  267. package/build/lib/device-log/safari-console-log.d.ts.map +1 -0
  268. package/build/lib/device-log/safari-console-log.js +81 -0
  269. package/build/lib/device-log/safari-console-log.js.map +1 -0
  270. package/build/lib/device-log/safari-network-log.d.ts +75 -0
  271. package/build/lib/device-log/safari-network-log.d.ts.map +1 -0
  272. package/build/lib/device-log/safari-network-log.js +47 -0
  273. package/build/lib/device-log/safari-network-log.js.map +1 -0
  274. package/build/lib/doctor/checks.d.ts +3 -0
  275. package/build/lib/doctor/checks.d.ts.map +1 -0
  276. package/build/lib/doctor/checks.js +39 -0
  277. package/build/lib/doctor/checks.js.map +1 -0
  278. package/build/lib/doctor/optional-checks.d.ts +46 -0
  279. package/build/lib/doctor/optional-checks.d.ts.map +1 -0
  280. package/build/lib/doctor/optional-checks.js +129 -0
  281. package/build/lib/doctor/optional-checks.js.map +1 -0
  282. package/build/lib/doctor/required-checks.d.ts +42 -0
  283. package/build/lib/doctor/required-checks.d.ts.map +1 -0
  284. package/build/lib/doctor/required-checks.js +94 -0
  285. package/build/lib/doctor/required-checks.js.map +1 -0
  286. package/build/lib/doctor/utils.d.ts +8 -0
  287. package/build/lib/doctor/utils.d.ts.map +1 -0
  288. package/build/lib/doctor/utils.js +21 -0
  289. package/build/lib/doctor/utils.js.map +1 -0
  290. package/build/lib/driver.d.ts +2429 -0
  291. package/build/lib/driver.d.ts.map +1 -0
  292. package/build/lib/driver.js +1967 -0
  293. package/build/lib/driver.js.map +1 -0
  294. package/build/lib/execute-method-map.d.ts +552 -0
  295. package/build/lib/execute-method-map.d.ts.map +1 -0
  296. package/build/lib/execute-method-map.js +586 -0
  297. package/build/lib/execute-method-map.js.map +1 -0
  298. package/build/lib/ios-fs-helpers.d.ts +75 -0
  299. package/build/lib/ios-fs-helpers.d.ts.map +1 -0
  300. package/build/lib/ios-fs-helpers.js +370 -0
  301. package/build/lib/ios-fs-helpers.js.map +1 -0
  302. package/build/lib/ios-generic-simulators.d.ts +6 -0
  303. package/build/lib/ios-generic-simulators.d.ts.map +1 -0
  304. package/build/lib/ios-generic-simulators.js +14 -0
  305. package/build/lib/ios-generic-simulators.js.map +1 -0
  306. package/build/lib/logger.d.ts +3 -0
  307. package/build/lib/logger.d.ts.map +1 -0
  308. package/build/lib/logger.js +6 -0
  309. package/build/lib/logger.js.map +1 -0
  310. package/build/lib/method-map.d.ts +229 -0
  311. package/build/lib/method-map.d.ts.map +1 -0
  312. package/build/lib/method-map.js +200 -0
  313. package/build/lib/method-map.js.map +1 -0
  314. package/build/lib/real-device-clients/base-device-client.d.ts +22 -0
  315. package/build/lib/real-device-clients/base-device-client.d.ts.map +1 -0
  316. package/build/lib/real-device-clients/base-device-client.js +14 -0
  317. package/build/lib/real-device-clients/base-device-client.js.map +1 -0
  318. package/build/lib/real-device-clients/py-ios-device-client.d.ts +21 -0
  319. package/build/lib/real-device-clients/py-ios-device-client.d.ts.map +1 -0
  320. package/build/lib/real-device-clients/py-ios-device-client.js +125 -0
  321. package/build/lib/real-device-clients/py-ios-device-client.js.map +1 -0
  322. package/build/lib/real-device-management.d.ts +53 -0
  323. package/build/lib/real-device-management.d.ts.map +1 -0
  324. package/build/lib/real-device-management.js +128 -0
  325. package/build/lib/real-device-management.js.map +1 -0
  326. package/build/lib/real-device.d.ts +112 -0
  327. package/build/lib/real-device.d.ts.map +1 -0
  328. package/build/lib/real-device.js +352 -0
  329. package/build/lib/real-device.js.map +1 -0
  330. package/build/lib/simulator-management.d.ts +96 -0
  331. package/build/lib/simulator-management.d.ts.map +1 -0
  332. package/build/lib/simulator-management.js +278 -0
  333. package/build/lib/simulator-management.js.map +1 -0
  334. package/build/lib/stubs.d.ts +3 -0
  335. package/build/lib/stubs.d.ts.map +1 -0
  336. package/build/lib/stubs.js +3 -0
  337. package/build/lib/stubs.js.map +1 -0
  338. package/build/lib/types.d.ts +31 -0
  339. package/build/lib/types.d.ts.map +1 -0
  340. package/build/lib/types.js +3 -0
  341. package/build/lib/types.js.map +1 -0
  342. package/build/lib/utils.d.ts +191 -0
  343. package/build/lib/utils.d.ts.map +1 -0
  344. package/build/lib/utils.js +549 -0
  345. package/build/lib/utils.js.map +1 -0
  346. package/build/lib/xcrun.d.ts +3 -0
  347. package/build/lib/xcrun.d.ts.map +1 -0
  348. package/build/lib/xcrun.js +17 -0
  349. package/build/lib/xcrun.js.map +1 -0
  350. package/index.js +7 -0
  351. package/lib/app-infos-cache.js +187 -0
  352. package/lib/app-utils.js +710 -0
  353. package/lib/commands/active-app-info.js +12 -0
  354. package/lib/commands/advanced-battery-types.ts +454 -0
  355. package/lib/commands/alert.js +88 -0
  356. package/lib/commands/app-management.js +346 -0
  357. package/lib/commands/app-strings.js +30 -0
  358. package/lib/commands/appearance.js +71 -0
  359. package/lib/commands/audit.js +31 -0
  360. package/lib/commands/battery.js +45 -0
  361. package/lib/commands/bidi/constants.ts +6 -0
  362. package/lib/commands/bidi/models.ts +55 -0
  363. package/lib/commands/bidi/types.ts +31 -0
  364. package/lib/commands/biometric.js +53 -0
  365. package/lib/commands/certificate.js +497 -0
  366. package/lib/commands/clipboard.js +35 -0
  367. package/lib/commands/condition.js +155 -0
  368. package/lib/commands/content-size.js +68 -0
  369. package/lib/commands/context.js +705 -0
  370. package/lib/commands/deviceInfo.js +27 -0
  371. package/lib/commands/element.js +423 -0
  372. package/lib/commands/enum.ts +108 -0
  373. package/lib/commands/execute.js +153 -0
  374. package/lib/commands/file-movement.js +510 -0
  375. package/lib/commands/find.js +205 -0
  376. package/lib/commands/general.js +278 -0
  377. package/lib/commands/geolocation.js +56 -0
  378. package/lib/commands/gesture.js +596 -0
  379. package/lib/commands/hid-event.ts +1634 -0
  380. package/lib/commands/increase-contrast.js +50 -0
  381. package/lib/commands/iohid.js +64 -0
  382. package/lib/commands/keyboard.js +62 -0
  383. package/lib/commands/keychains.js +18 -0
  384. package/lib/commands/localization.js +30 -0
  385. package/lib/commands/location.js +131 -0
  386. package/lib/commands/lock.js +46 -0
  387. package/lib/commands/log.js +327 -0
  388. package/lib/commands/memory.js +51 -0
  389. package/lib/commands/navigation.js +125 -0
  390. package/lib/commands/notifications.js +66 -0
  391. package/lib/commands/pasteboard.js +42 -0
  392. package/lib/commands/pcap.js +168 -0
  393. package/lib/commands/performance.js +392 -0
  394. package/lib/commands/permissions.js +85 -0
  395. package/lib/commands/proxy-helper.js +122 -0
  396. package/lib/commands/record-audio.js +264 -0
  397. package/lib/commands/recordscreen.js +391 -0
  398. package/lib/commands/screenshots.js +137 -0
  399. package/lib/commands/simctl.js +71 -0
  400. package/lib/commands/source.js +131 -0
  401. package/lib/commands/timeouts.js +68 -0
  402. package/lib/commands/types.ts +648 -0
  403. package/lib/commands/web.js +1113 -0
  404. package/lib/commands/xctest-record-screen.js +204 -0
  405. package/lib/commands/xctest.js +285 -0
  406. package/lib/css-converter.js +311 -0
  407. package/lib/desired-caps.js +396 -0
  408. package/lib/device-connections-factory.js +269 -0
  409. package/lib/device-log/helpers.ts +40 -0
  410. package/lib/device-log/ios-crash-log.ts +166 -0
  411. package/lib/device-log/ios-device-log.ts +51 -0
  412. package/lib/device-log/ios-log.ts +70 -0
  413. package/lib/device-log/ios-performance-log.ts +50 -0
  414. package/lib/device-log/ios-simulator-log.ts +202 -0
  415. package/lib/device-log/line-consuming-log.ts +16 -0
  416. package/lib/device-log/safari-console-log.ts +117 -0
  417. package/lib/device-log/safari-network-log.ts +120 -0
  418. package/lib/doctor/checks.ts +3 -0
  419. package/lib/doctor/optional-checks.ts +173 -0
  420. package/lib/doctor/required-checks.ts +120 -0
  421. package/lib/doctor/utils.ts +18 -0
  422. package/lib/driver.js +2316 -0
  423. package/lib/execute-method-map.ts +585 -0
  424. package/lib/ios-fs-helpers.js +355 -0
  425. package/lib/ios-generic-simulators.js +11 -0
  426. package/lib/logger.js +5 -0
  427. package/lib/method-map.js +196 -0
  428. package/lib/real-device-clients/base-device-client.ts +34 -0
  429. package/lib/real-device-clients/py-ios-device-client.ts +149 -0
  430. package/lib/real-device-management.js +133 -0
  431. package/lib/real-device.js +347 -0
  432. package/lib/simulator-management.js +324 -0
  433. package/lib/stubs.ts +3 -0
  434. package/lib/types.ts +33 -0
  435. package/lib/utils.js +551 -0
  436. package/lib/xcrun.js +16 -0
  437. package/package.json +175 -0
  438. package/scripts/build-docs.js +56 -0
  439. package/scripts/build-wda.js +42 -0
  440. package/scripts/download-wda-sim.mjs +68 -0
  441. package/scripts/image-mounter.mjs +239 -0
  442. package/scripts/open-wda.mjs +15 -0
  443. package/scripts/tunnel-creation.mjs +359 -0
  444. package/scripts/utils.js +16 -0
@@ -0,0 +1,327 @@
1
+ import _ from 'lodash';
2
+ import B from 'bluebird';
3
+ import {DEFAULT_WS_PATHNAME_PREFIX} from 'appium/driver';
4
+ import {IOSCrashLog} from '../device-log/ios-crash-log';
5
+ import {IOSSimulatorLog} from '../device-log/ios-simulator-log';
6
+ import {IOSDeviceLog} from '../device-log/ios-device-log';
7
+ import WebSocket from 'ws';
8
+ import { SafariConsoleLog } from '../device-log/safari-console-log';
9
+ import { SafariNetworkLog } from '../device-log/safari-network-log';
10
+ import { toLogEntry } from '../device-log/helpers';
11
+ import { NATIVE_WIN } from '../utils';
12
+ import { BIDI_EVENT_NAME } from './bidi/constants';
13
+ import { makeLogEntryAddedEvent } from './bidi/models';
14
+
15
+ /**
16
+ * Determines the websocket endpoint based on the `sessionId`
17
+ * @param {string} sessionId
18
+ * @returns {string}
19
+ */
20
+ const WEBSOCKET_ENDPOINT = (sessionId) =>
21
+ `${DEFAULT_WS_PATHNAME_PREFIX}/session/${sessionId}/appium/device/syslog`;
22
+ const COLOR_CODE_PATTERN = /\u001b\[(\d+(;\d+)*)?m/g; // eslint-disable-line no-control-regex
23
+ const GET_SERVER_LOGS_FEATURE = 'get_server_logs';
24
+
25
+ /**
26
+ * @type {import('@appium/types').LogDefRecord}
27
+ * @privateRemarks The return types for these getters should be specified
28
+ */
29
+ const SUPPORTED_LOG_TYPES = {
30
+ syslog: {
31
+ description: 'System Logs - Device logs for iOS applications on real devices and simulators',
32
+ getter: async (self) => await self.extractLogs('syslog', self.logs),
33
+ },
34
+ crashlog: {
35
+ description: 'Crash Logs - Crash reports for iOS applications on real devices and simulators',
36
+ getter: async (self) => await self.extractLogs('crashlog', self.logs),
37
+ },
38
+ performance: {
39
+ description: 'Performance Logs - Debug Timelines on real devices and simulators',
40
+ getter: async (self) => await self.extractLogs('performance', self.logs),
41
+ },
42
+ safariConsole: {
43
+ description: 'Safari Console Logs - data written to the JS console in Safari',
44
+ getter: async (self) => await self.extractLogs('safariConsole', self.logs),
45
+ },
46
+ safariNetwork: {
47
+ description: 'Safari Network Logs - information about network operations undertaken by Safari',
48
+ getter: async (self) => await self.extractLogs('safariNetwork', self.logs),
49
+ },
50
+ server: {
51
+ description: 'Appium server logs',
52
+ /**
53
+ * @returns {import('./types').LogEntry[]}
54
+ */
55
+ getter: (self) => {
56
+ self.assertFeatureEnabled(GET_SERVER_LOGS_FEATURE);
57
+ return self.log.unwrap().record.map(nativeLogEntryToSeleniumEntry);
58
+ },
59
+ },
60
+ };
61
+
62
+ const LOG_NAMES_TO_CAPABILITY_NAMES_MAP = {
63
+ safariConsole: 'showSafariConsoleLog',
64
+ safariNetwork: 'showSafariNetworkLog',
65
+ enablePerformanceLogging: 'enablePerformanceLogging',
66
+ };
67
+
68
+ export const supportedLogTypes = SUPPORTED_LOG_TYPES;
69
+
70
+ /**
71
+ *
72
+ * @param {XCUITestDriverLogTypes} logType
73
+ * @param {Partial<Record<XCUITestDriverLogTypes,{getLogs(): Promise<any>}>>} [logsContainer]
74
+ * @this {XCUITestDriver}
75
+ */
76
+ export async function extractLogs(logType, logsContainer = {}) {
77
+ // make sure that we have logs at all
78
+ // otherwise it's not been initialized
79
+ if (_.isEmpty(logsContainer)) {
80
+ throw new Error('No logs currently available. Is the device/simulator started?');
81
+ }
82
+
83
+ // If logs captured successfully send response with data, else send error
84
+ const logObject = logsContainer[logType];
85
+ if (logObject) {
86
+ return await logObject.getLogs();
87
+ }
88
+ if (logType in LOG_NAMES_TO_CAPABILITY_NAMES_MAP) {
89
+ throw new Error(
90
+ `${logType} logs are not enabled. Make sure you've set a proper value ` +
91
+ `to the 'appium:${LOG_NAMES_TO_CAPABILITY_NAMES_MAP[logType]}' capability.`
92
+ );
93
+ }
94
+ throw new Error(
95
+ `No logs of type '${logType}' found. Supported log types are: ${_.keys(SUPPORTED_LOG_TYPES)}.`
96
+ );
97
+ }
98
+
99
+ /**
100
+ * @this {XCUITestDriver}
101
+ */
102
+ export async function startLogCapture() {
103
+ this.logs = this.logs || {};
104
+ if (!_.isUndefined(this.logs.syslog) && this.logs.syslog.isCapturing) {
105
+ this.log.warn('Trying to start iOS log capture but it has already started!');
106
+ return true;
107
+ }
108
+
109
+ if (_.isUndefined(this.logs.syslog)) {
110
+ [this.logs.crashlog,] = assignBiDiLogListener.bind(this)(
111
+ new IOSCrashLog({
112
+ sim: /** @type {import('@limrun/appium-ios-simulator').Simulator} */ (this.device),
113
+ udid: this.isRealDevice() ? this.opts.udid : undefined,
114
+ log: this.log,
115
+ }), {
116
+ type: 'crashlog',
117
+ }
118
+ );
119
+ [this.logs.syslog,] = assignBiDiLogListener.bind(this)(
120
+ this.isRealDevice()
121
+ ? new IOSDeviceLog({
122
+ udid: this.opts.udid,
123
+ showLogs: this.opts.showIOSLog,
124
+ log: this.log,
125
+ })
126
+ : new IOSSimulatorLog({
127
+ sim: /** @type {import('@limrun/appium-ios-simulator').Simulator} */ (this.device),
128
+ showLogs: this.opts.showIOSLog,
129
+ iosSimulatorLogsPredicate: this.opts.iosSimulatorLogsPredicate,
130
+ simulatorLogLevel: this.opts.simulatorLogLevel,
131
+ log: this.log,
132
+ iosSyslogFile: this.opts.iosSyslogFile
133
+ }),
134
+ {
135
+ type: 'syslog',
136
+ }
137
+ );
138
+ if (_.isBoolean(this.opts.showSafariConsoleLog)) {
139
+ [this.logs.safariConsole,] = assignBiDiLogListener.bind(this)(
140
+ new SafariConsoleLog({
141
+ showLogs: this.opts.showSafariConsoleLog,
142
+ log: this.log,
143
+ }), {
144
+ type: 'safariConsole',
145
+ }
146
+ );
147
+ }
148
+ if (_.isBoolean(this.opts.showSafariNetworkLog)) {
149
+ [this.logs.safariNetwork,] = assignBiDiLogListener.bind(this)(
150
+ new SafariNetworkLog({
151
+ showLogs: this.opts.showSafariNetworkLog,
152
+ log: this.log,
153
+ }), {
154
+ type: 'safariNetwork',
155
+ }
156
+ );
157
+ }
158
+ if (this.isFeatureEnabled(GET_SERVER_LOGS_FEATURE)) {
159
+ [, this._bidiServerLogListener] = assignBiDiLogListener.bind(this)(
160
+ this.log.unwrap(), {
161
+ type: 'server',
162
+ srcEventName: 'log',
163
+ entryTransformer: nativeLogEntryToSeleniumEntry,
164
+ }
165
+ );
166
+ }
167
+ }
168
+
169
+ let didStartSyslog = false;
170
+ /** @type {Promise[]} */
171
+ const promises = [
172
+ (async () => {
173
+ try {
174
+ await this.logs.syslog?.startCapture();
175
+ didStartSyslog = true;
176
+ this.eventEmitter.emit('syslogStarted', this.logs.syslog);
177
+ } catch (err) {
178
+ this.log.debug(err.stack);
179
+ this.log.warn(`Continuing without capturing device logs: ${err.message}`);
180
+ }
181
+ })(),
182
+ this.logs.crashlog?.startCapture() ?? B.resolve(),
183
+ ];
184
+ await B.all(promises);
185
+
186
+ return didStartSyslog;
187
+ }
188
+
189
+ /**
190
+ * Starts an iOS system logs broadcast websocket.
191
+ *
192
+ * The websocket listens on the same host and port as Appium. The endpoint created is `/ws/session/:sessionId:/appium/syslog`.
193
+ *
194
+ * If the websocket is already running, this command does nothing.
195
+ *
196
+ * Each connected webcoket listener will receive syslog lines as soon as they are visible to Appium.
197
+ * @see https://appiumpro.com/editions/55-using-mobile-execution-commands-to-continuously-stream-device-logs-with-appium
198
+ * @returns {Promise<void>}
199
+ * @this {XCUITestDriver}
200
+ */
201
+ export async function mobileStartLogsBroadcast() {
202
+ const pathname = WEBSOCKET_ENDPOINT(/** @type {string} */ (this.sessionId));
203
+ if (
204
+ !_.isEmpty(
205
+ await /** @type {import('@appium/types').AppiumServer} */ (
206
+ this.server
207
+ ).getWebSocketHandlers(pathname),
208
+ )
209
+ ) {
210
+ this.log.debug(
211
+ `The system logs broadcasting web socket server is already listening at ${pathname}`,
212
+ );
213
+ return;
214
+ }
215
+
216
+ this.log.info(`Assigning system logs broadcasting web socket server to ${pathname}`);
217
+ // https://github.com/websockets/ws/blob/master/doc/ws.md
218
+ const wss = new WebSocket.Server({
219
+ noServer: true,
220
+ });
221
+ wss.on('connection', (ws, req) => {
222
+ if (req) {
223
+ const remoteIp = _.isEmpty(req.headers['x-forwarded-for'])
224
+ ? req.connection?.remoteAddress
225
+ : req.headers['x-forwarded-for'];
226
+ this.log.debug(`Established a new system logs listener web socket connection from ${remoteIp}`);
227
+ } else {
228
+ this.log.debug('Established a new system logs listener web socket connection');
229
+ }
230
+
231
+ if (_.isEmpty(this._syslogWebsocketListener)) {
232
+ this._syslogWebsocketListener = (logRecord) => {
233
+ if (ws?.readyState === WebSocket.OPEN) {
234
+ ws.send(logRecord.message);
235
+ }
236
+ };
237
+ }
238
+ this.logs.syslog?.on('output', this._syslogWebsocketListener);
239
+
240
+ ws.on('close', (code, reason) => {
241
+ if (!_.isEmpty(this._syslogWebsocketListener)) {
242
+ this.logs.syslog?.removeListener('output', this._syslogWebsocketListener);
243
+ this._syslogWebsocketListener = null;
244
+ }
245
+
246
+ let closeMsg = 'System logs listener web socket is closed.';
247
+ if (!_.isEmpty(code)) {
248
+ closeMsg += ` Code: ${code}.`;
249
+ }
250
+ if (!_.isEmpty(reason)) {
251
+ closeMsg += ` Reason: ${reason.toString()}.`;
252
+ }
253
+ this.log.debug(closeMsg);
254
+ });
255
+ });
256
+ await /** @type {AppiumServer} */ (this.server).addWebSocketHandler(
257
+ pathname,
258
+ /** @type {import('@appium/types').WSServer} */ (wss),
259
+ );
260
+ }
261
+
262
+ /**
263
+ * Stops the syslog broadcasting wesocket server previously started by `mobile: startLogsBroadcast`.
264
+ * If no websocket server is running, this command does nothing.
265
+ * @this {XCUITestDriver}
266
+ * @returns {Promise<void>}
267
+ */
268
+ export async function mobileStopLogsBroadcast() {
269
+ const pathname = WEBSOCKET_ENDPOINT(/** @type {string} */ (this.sessionId));
270
+ if (_.isEmpty(await /** @type {AppiumServer} */ (this.server).getWebSocketHandlers(pathname))) {
271
+ return;
272
+ }
273
+
274
+ this.log.debug('Stopping the system logs broadcasting web socket server');
275
+ await /** @type {AppiumServer} */ (this.server).removeWebSocketHandler(pathname);
276
+ }
277
+
278
+ /**
279
+ * https://w3c.github.io/webdriver-bidi/#event-log-entryAdded
280
+ *
281
+ * @template {import('node:events').EventEmitter} EE
282
+ * @this {XCUITestDriver}
283
+ * @param {EE} logEmitter
284
+ * @param {BiDiListenerProperties} properties
285
+ * @returns {[EE, import('./types').LogListener]}
286
+ */
287
+ export function assignBiDiLogListener (logEmitter, properties) {
288
+ const {
289
+ type,
290
+ context = NATIVE_WIN,
291
+ srcEventName = 'output',
292
+ entryTransformer,
293
+ } = properties;
294
+ const listener = (/** @type {import('./types').LogEntry} */ logEntry) => {
295
+ const finalEntry = entryTransformer ? entryTransformer(logEntry) : logEntry;
296
+ this.eventEmitter.emit(BIDI_EVENT_NAME, makeLogEntryAddedEvent(finalEntry, context, type));
297
+ };
298
+ logEmitter.on(srcEventName, listener);
299
+ return [logEmitter, listener];
300
+ }
301
+
302
+ /**
303
+ *
304
+ * @param {Object} x
305
+ * @returns {import('./types').LogEntry}
306
+ */
307
+ function nativeLogEntryToSeleniumEntry (x) {
308
+ const msg = _.isEmpty(x.prefix) ? x.message : `[${x.prefix}] ${x.message}`;
309
+ return toLogEntry(
310
+ _.replace(msg, COLOR_CODE_PATTERN, ''),
311
+ /** @type {any} */ (x).timestamp ?? Date.now()
312
+ );
313
+ }
314
+
315
+ /**
316
+ * @typedef {import('../driver').XCUITestDriver} XCUITestDriver
317
+ * @typedef {keyof typeof SUPPORTED_LOG_TYPES} XCUITestDriverLogTypes
318
+ * @typedef {import('@appium/types').AppiumServer} AppiumServer
319
+ */
320
+
321
+ /**
322
+ * @typedef {Object} BiDiListenerProperties
323
+ * @property {string} type
324
+ * @property {string} [srcEventName='output']
325
+ * @property {string} [context=NATIVE_WIN]
326
+ * @property {(x: Object) => import('./types').LogEntry} [entryTransformer]
327
+ */
@@ -0,0 +1,51 @@
1
+ import _ from 'lodash';
2
+ import { errors } from 'appium/driver';
3
+
4
+ /**
5
+ * Simulates Low Memory warning on the given application
6
+ *
7
+ * @since Xcode 15
8
+ * @param {string} bundleId - The bundle identifier of the target app. The app must be running
9
+ * @this {XCUITestDriver}
10
+ * @throws {Error} if the app is not running or is not installed
11
+ */
12
+ export async function mobileSendMemoryWarning(bundleId) {
13
+ if (!this.isRealDevice()) {
14
+ throw new Error('Memory warning simulation is only supported on real devices');
15
+ }
16
+
17
+ const device = /** @type {import('../real-device').RealDevice} */ (this.device);
18
+
19
+ const appInfos = await device.devicectl.listApps(bundleId);
20
+ if (_.isEmpty(appInfos)) {
21
+ throw new errors.InvalidArgumentError(
22
+ `The application identified by ${bundleId} cannot be found on the device. Is it installed?`
23
+ );
24
+ }
25
+
26
+ // This regexp tries to match the process name of the main bundle executable.
27
+ // For example, if 'url' contains something like
28
+ // `file:///private/var/containers/Bundle/Application/093ACA6D-8F0B-4601-87B9-4099E43A1A20/Target.app/`
29
+ // and the following processes might be running:
30
+ // `file:///private/var/containers/Bundle/Application/093ACA6D-8F0B-4601-87B9-4099E43A1A20/Target.app/Target`
31
+ // `file:///private/var/containers/Bundle/Application/093ACA6D-8F0B-4601-87B9-4099E43A1A20/Target.app/PlugIns/WidgetExtension.appex/WidgetExtension`
32
+ // then we only want to match the first one.
33
+ // Unfortunately devicectl does not provide more info which would
34
+ // allow to connect a bundle id to a process id.
35
+ const pattern = new RegExp(`^${_.escapeRegExp(appInfos[0].url)}[^/]+$`);
36
+ /** @type {number[]} */
37
+ const pids = (await device.devicectl.listProcesses())
38
+ .filter(({executable}) => pattern.test(executable))
39
+ .map(({processIdentifier}) => processIdentifier);
40
+ if (_.isEmpty(pids)) {
41
+ throw new errors.InvalidArgumentError(
42
+ `The application identified by ${bundleId} must be running in order to simulate the Low Memory warning`
43
+ );
44
+ }
45
+ this.log.info(`Emulating Low Memory warning for the process id ${pids[0]}, bundle id ${bundleId}`);
46
+ await device.devicectl.sendMemoryWarning(pids[0]);
47
+ }
48
+
49
+ /**
50
+ * @typedef {import('../driver').XCUITestDriver} XCUITestDriver
51
+ */
@@ -0,0 +1,125 @@
1
+ import {errors} from 'appium/driver';
2
+ import _ from 'lodash';
3
+ import {waitForCondition} from 'asyncbox';
4
+ import { isTvOs } from '../utils';
5
+
6
+ // these two constitute the wait after closing a window
7
+ const CLOSE_WINDOW_TIMEOUT = 5000;
8
+ const CLOSE_WINDOW_INTERVAL = 100;
9
+
10
+ /**
11
+ * @this {XCUITestDriver}
12
+ */
13
+ export async function back() {
14
+ if (!this.isWebContext()) {
15
+ await this.nativeBack();
16
+ } else {
17
+ await this.mobileWebNav('back');
18
+ }
19
+ }
20
+
21
+ /**
22
+ * @this {XCUITestDriver}
23
+ */
24
+ export async function forward() {
25
+ if (!this.isWebContext()) {
26
+ }
27
+ await this.mobileWebNav('forward');
28
+ }
29
+
30
+ /**
31
+ * @this {XCUITestDriver}
32
+ */
33
+ export async function closeWindow() {
34
+ if (!this.isWebContext()) {
35
+ throw new errors.NotImplementedError();
36
+ }
37
+
38
+ // since the window will be closed and the execution context gone, return
39
+ // first before closing. Waiting for close will happen in the finally block
40
+ const script = `setTimeout(function () {window.open('','_self').close();}, 0); return true;`;
41
+ const context = this.curContext;
42
+ try {
43
+ return await this.executeAtom('execute_script', [script, []], true);
44
+ } finally {
45
+ // wait for the window to successfully change...
46
+ try {
47
+ await waitForCondition(() => this.curContext !== context, {
48
+ waitMs: CLOSE_WINDOW_TIMEOUT,
49
+ intervalMs: CLOSE_WINDOW_INTERVAL,
50
+ });
51
+ } catch {
52
+ this.log.debug('Context has not yet been changed after closing window. Continuing...');
53
+ }
54
+ }
55
+ }
56
+
57
+ /**
58
+ * Opens the given URL with the default application assigned to handle it based on the URL
59
+ * scheme, or the application provided as an optional parameter
60
+ *
61
+ * (Note: the version of Xcode must be 14.3+ and iOS must be 16.4+)
62
+ *
63
+ * @param {string} url - the URL to be opened, e.g. `myscheme://yolo`
64
+ * @param {string} [bundleId] - the application to open the given URL with. If not provided, then
65
+ * the application assigned by the operating system to handle URLs of the appropriate type
66
+ * @returns {Promise<void>}
67
+ * @since 4.17
68
+ * @this {XCUITestDriver}
69
+ */
70
+ export async function mobileDeepLink(url, bundleId) {
71
+ return await this.proxyCommand('/url', 'POST', {
72
+ url,
73
+ bundleId,
74
+ });
75
+ }
76
+
77
+ /**
78
+ * @this {XCUITestDriver}
79
+ */
80
+ export async function nativeBack() {
81
+ if (isTvOs(this.opts.platformName)) {
82
+ this.log.debug(`Sending Menu button as back behavior in tvOS`);
83
+ return await this.mobilePressButton('Menu');
84
+ }
85
+
86
+ try {
87
+ let navBar = await this.findNativeElementOrElements(
88
+ 'class name',
89
+ 'XCUIElementTypeNavigationBar',
90
+ false,
91
+ );
92
+ let buttons = await this.findNativeElementOrElements(
93
+ 'class name',
94
+ 'XCUIElementTypeButton',
95
+ true,
96
+ navBar,
97
+ );
98
+ if (buttons?.length === 0) {
99
+ throw new Error('No buttons found in navigation bar');
100
+ }
101
+
102
+ let backButton = _.filter(buttons, (value) => value.label === 'Back')[0];
103
+ if (backButton) {
104
+ this.log.debug(`Found navigation bar 'back' button. Clicking.`);
105
+ } else {
106
+ this.log.debug(`Unable to find 'Back' button. Trying first button in navigation bar`);
107
+ backButton = buttons?.[0];
108
+ }
109
+ await this.nativeClick(/** @type {string} */ (backButton));
110
+ } catch (err) {
111
+ this.log.error(`Unable to find navigation bar and back button: ${err.message}`);
112
+ }
113
+ }
114
+
115
+ /**
116
+ * @typedef {import('../driver').XCUITestDriver} XCUITestDriver
117
+ */
118
+
119
+ /**
120
+ * @typedef {Object} DeepLinkOptions
121
+ * @property {string} url The URL to be opened. This parameter is manadatory
122
+ * @property {string?} bundleId The bundle identifier of an application to open the
123
+ * given url with. If not provided then the default application for the given url scheme
124
+ * is going to be used.
125
+ */
@@ -0,0 +1,66 @@
1
+ import {errors} from 'appium/driver';
2
+ import _ from 'lodash';
3
+
4
+ /**
5
+ * Simulates push notification delivery to a simulated device.
6
+ *
7
+ * **Only "remote" push notifications are supported.** VoIP, Complication, File Provider, and other types are unsupported.
8
+ *
9
+ * Supported in Xcode SDK 11.4+.
10
+ * @param {string} bundleId - The bundle identifier of the target application
11
+ * @param {import('./types').PushPayload} payload - Valid push payload.
12
+ * @group Simulator Only
13
+ * @this {XCUITestDriver}
14
+ */
15
+ export async function mobilePushNotification(bundleId, payload) {
16
+ if (!this.isSimulator()) {
17
+ throw new Error('This extension only works on Simulator');
18
+ }
19
+
20
+ if (!bundleId) {
21
+ throw new errors.InvalidArgumentError(
22
+ `'bundleId' argument must be a valid bundle identifier string`,
23
+ );
24
+ }
25
+ if (!_.isPlainObject(payload)) {
26
+ throw new errors.InvalidArgumentError(
27
+ `The 'payload' argument value must be a valid dictionary. ` +
28
+ `Got ${JSON.stringify(payload)} instead`,
29
+ );
30
+ }
31
+ if (!_.isPlainObject(payload.aps)) {
32
+ throw new errors.InvalidArgumentError(
33
+ `The 'payload.aps' value must be a valid dictionary. ` +
34
+ `Got ${JSON.stringify(payload.aps)} instead`,
35
+ );
36
+ }
37
+ return await /** @type {import('../driver').Simulator} */ (this.device).pushNotification({
38
+ ...payload,
39
+ 'Simulator Target Bundle': bundleId,
40
+ });
41
+ }
42
+
43
+ /**
44
+ * Blocks until the expected notification is delivered.
45
+ *
46
+ * This method is a thin wrapper over the
47
+ * [`XCTNSNotificationExpectation`](https://developer.apple.com/documentation/xctest/xctnsnotificationexpectation?language=objc) and
48
+ * [`XCTDarwinNotificationExpectation`](https://developer.apple.com/documentation/xctest/xctdarwinnotificationexpectation?language=objc) entities.
49
+ *
50
+ * @param {string} name - The name of the notification to expect
51
+ * @param {import('./types').NotificationType} type - Which notification type to expect.
52
+ * @param {number} timeoutSeconds - For how long to wait until the notification is delivered (in float seconds).
53
+ * @throws A [`TimeoutError`](https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/lib/error_exports_TimeoutError.html) if the expected notification has not been delivered within the given timeout.
54
+ * @this {XCUITestDriver}
55
+ */
56
+ export async function mobileExpectNotification(name, type = 'plain', timeoutSeconds = 60) {
57
+ return await this.proxyCommand('/wda/expectNotification', 'POST', {
58
+ name,
59
+ type,
60
+ timeout: timeoutSeconds,
61
+ });
62
+ }
63
+
64
+ /**
65
+ * @typedef {import('../driver').XCUITestDriver} XCUITestDriver
66
+ */
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Sets the Simulator's pasteboard content to the given value.
3
+ *
4
+ * Does not work for real devices.
5
+ * @param {string} content - The content to set
6
+ * @param {string} encoding - The content's encoding
7
+ * @group Simulator Only
8
+ * @returns {Promise<void>}
9
+ * @this {XCUITestDriver}
10
+ */
11
+ export async function mobileSetPasteboard(content, encoding = 'utf8') {
12
+ if (!this.isSimulator()) {
13
+ throw new Error('Setting pasteboard content is not supported on real devices');
14
+ }
15
+ if (!content) {
16
+ // can be empty string
17
+ throw new Error('Pasteboard content is mandatory to set');
18
+ }
19
+ return await /** @type {import('../driver').Simulator} */ (this.device).simctl.setPasteboard(
20
+ content, /** @type {BufferEncoding} */ (encoding)
21
+ );
22
+ }
23
+
24
+ /**
25
+ * Gets the Simulator's pasteboard content.
26
+ *
27
+ * Does not work for real devices.
28
+ * @param {BufferEncoding} encoding - Expected encoding of returned string
29
+ * @group Simulator Only
30
+ * @this {XCUITestDriver}
31
+ * @returns {Promise<string>} The pasteboard content string
32
+ */
33
+ export async function mobileGetPasteboard(encoding = 'utf8') {
34
+ if (!this.isSimulator()) {
35
+ throw new Error('Getting pasteboard content is not supported on real devices');
36
+ }
37
+ return await /** @type {import('../driver').Simulator} */ (this.device).simctl.getPasteboard(encoding);
38
+ }
39
+
40
+ /**
41
+ * @typedef {import('../driver').XCUITestDriver} XCUITestDriver
42
+ */