@limrun/appium-xcuitest-driver 10.11.0-lim.4 → 10.14.6-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 (279) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/build/lib/commands/active-app-info.d.ts +4 -3
  3. package/build/lib/commands/active-app-info.d.ts.map +1 -1
  4. package/build/lib/commands/active-app-info.js +2 -3
  5. package/build/lib/commands/active-app-info.js.map +1 -1
  6. package/build/lib/commands/alert.d.ts +26 -31
  7. package/build/lib/commands/alert.d.ts.map +1 -1
  8. package/build/lib/commands/alert.js +20 -29
  9. package/build/lib/commands/alert.js.map +1 -1
  10. package/build/lib/commands/app-management.d.ts +99 -76
  11. package/build/lib/commands/app-management.d.ts.map +1 -1
  12. package/build/lib/commands/app-management.js +83 -73
  13. package/build/lib/commands/app-management.js.map +1 -1
  14. package/build/lib/commands/app-strings.d.ts +6 -7
  15. package/build/lib/commands/app-strings.d.ts.map +1 -1
  16. package/build/lib/commands/app-strings.js +3 -8
  17. package/build/lib/commands/app-strings.js.map +1 -1
  18. package/build/lib/commands/appearance.d.ts +7 -9
  19. package/build/lib/commands/appearance.d.ts.map +1 -1
  20. package/build/lib/commands/appearance.js +13 -19
  21. package/build/lib/commands/appearance.js.map +1 -1
  22. package/build/lib/commands/audit.d.ts +5 -33
  23. package/build/lib/commands/audit.d.ts.map +1 -1
  24. package/build/lib/commands/audit.js +3 -16
  25. package/build/lib/commands/audit.js.map +1 -1
  26. package/build/lib/commands/battery.d.ts +4 -4
  27. package/build/lib/commands/battery.d.ts.map +1 -1
  28. package/build/lib/commands/battery.js +3 -7
  29. package/build/lib/commands/battery.js.map +1 -1
  30. package/build/lib/commands/biometric.d.ts +12 -14
  31. package/build/lib/commands/biometric.d.ts.map +1 -1
  32. package/build/lib/commands/biometric.js +10 -19
  33. package/build/lib/commands/biometric.js.map +1 -1
  34. package/build/lib/commands/certificate.d.ts +14 -19
  35. package/build/lib/commands/certificate.d.ts.map +1 -1
  36. package/build/lib/commands/certificate.js +24 -31
  37. package/build/lib/commands/certificate.js.map +1 -1
  38. package/build/lib/commands/clipboard.d.ts +9 -11
  39. package/build/lib/commands/clipboard.d.ts.map +1 -1
  40. package/build/lib/commands/clipboard.js +8 -13
  41. package/build/lib/commands/clipboard.js.map +1 -1
  42. package/build/lib/commands/condition.d.ts +9 -72
  43. package/build/lib/commands/condition.d.ts.map +1 -1
  44. package/build/lib/commands/condition.js +5 -66
  45. package/build/lib/commands/condition.js.map +1 -1
  46. package/build/lib/commands/content-size.d.ts +16 -19
  47. package/build/lib/commands/content-size.d.ts.map +1 -1
  48. package/build/lib/commands/content-size.js +14 -22
  49. package/build/lib/commands/content-size.js.map +1 -1
  50. package/build/lib/commands/context.d.ts +130 -161
  51. package/build/lib/commands/context.d.ts.map +1 -1
  52. package/build/lib/commands/context.js +123 -108
  53. package/build/lib/commands/context.js.map +1 -1
  54. package/build/lib/commands/device-info.d.ts +13 -0
  55. package/build/lib/commands/device-info.d.ts.map +1 -0
  56. package/build/lib/commands/device-info.js +20 -0
  57. package/build/lib/commands/device-info.js.map +1 -0
  58. package/build/lib/commands/element.d.ts +83 -67
  59. package/build/lib/commands/element.d.ts.map +1 -1
  60. package/build/lib/commands/element.js +111 -134
  61. package/build/lib/commands/element.js.map +1 -1
  62. package/build/lib/commands/execute.d.ts +10 -22
  63. package/build/lib/commands/execute.d.ts.map +1 -1
  64. package/build/lib/commands/execute.js +13 -29
  65. package/build/lib/commands/execute.js.map +1 -1
  66. package/build/lib/commands/file-movement.d.ts +31 -42
  67. package/build/lib/commands/file-movement.d.ts.map +1 -1
  68. package/build/lib/commands/file-movement.js +146 -205
  69. package/build/lib/commands/file-movement.js.map +1 -1
  70. package/build/lib/commands/find.d.ts +20 -12
  71. package/build/lib/commands/find.d.ts.map +1 -1
  72. package/build/lib/commands/find.js +27 -65
  73. package/build/lib/commands/find.js.map +1 -1
  74. package/build/lib/commands/general.d.ts +84 -80
  75. package/build/lib/commands/general.d.ts.map +1 -1
  76. package/build/lib/commands/general.js +67 -54
  77. package/build/lib/commands/general.js.map +1 -1
  78. package/build/lib/commands/geolocation.d.ts +16 -36
  79. package/build/lib/commands/geolocation.d.ts.map +1 -1
  80. package/build/lib/commands/geolocation.js +8 -25
  81. package/build/lib/commands/geolocation.js.map +1 -1
  82. package/build/lib/commands/gesture.d.ts +103 -119
  83. package/build/lib/commands/gesture.d.ts.map +1 -1
  84. package/build/lib/commands/gesture.js +98 -138
  85. package/build/lib/commands/gesture.js.map +1 -1
  86. package/build/lib/commands/increase-contrast.d.ts +10 -13
  87. package/build/lib/commands/increase-contrast.d.ts.map +1 -1
  88. package/build/lib/commands/increase-contrast.js +8 -16
  89. package/build/lib/commands/increase-contrast.js.map +1 -1
  90. package/build/lib/commands/iohid.d.ts +6 -1359
  91. package/build/lib/commands/iohid.d.ts.map +1 -1
  92. package/build/lib/commands/iohid.js +5 -10
  93. package/build/lib/commands/iohid.js.map +1 -1
  94. package/build/lib/commands/keyboard.d.ts +16 -13
  95. package/build/lib/commands/keyboard.d.ts.map +1 -1
  96. package/build/lib/commands/keyboard.js +14 -18
  97. package/build/lib/commands/keyboard.js.map +1 -1
  98. package/build/lib/commands/keychains.d.ts +2 -2
  99. package/build/lib/commands/keychains.d.ts.map +1 -1
  100. package/build/lib/commands/keychains.js +1 -4
  101. package/build/lib/commands/keychains.js.map +1 -1
  102. package/build/lib/commands/localization.d.ts +7 -6
  103. package/build/lib/commands/localization.d.ts.map +1 -1
  104. package/build/lib/commands/localization.js +7 -8
  105. package/build/lib/commands/localization.js.map +1 -1
  106. package/build/lib/commands/location.d.ts +8 -11
  107. package/build/lib/commands/location.d.ts.map +1 -1
  108. package/build/lib/commands/location.js +7 -15
  109. package/build/lib/commands/location.js.map +1 -1
  110. package/build/lib/commands/lock.d.ts +6 -10
  111. package/build/lib/commands/lock.d.ts.map +1 -1
  112. package/build/lib/commands/lock.js +3 -10
  113. package/build/lib/commands/lock.js.map +1 -1
  114. package/build/lib/commands/log.d.ts +42 -44
  115. package/build/lib/commands/log.d.ts.map +1 -1
  116. package/build/lib/commands/log.js +32 -53
  117. package/build/lib/commands/log.js.map +1 -1
  118. package/build/lib/commands/memory.d.ts +4 -5
  119. package/build/lib/commands/memory.d.ts.map +1 -1
  120. package/build/lib/commands/memory.js +3 -8
  121. package/build/lib/commands/memory.js.map +1 -1
  122. package/build/lib/commands/navigation.d.ts +14 -26
  123. package/build/lib/commands/navigation.d.ts.map +1 -1
  124. package/build/lib/commands/navigation.js +22 -32
  125. package/build/lib/commands/navigation.js.map +1 -1
  126. package/build/lib/commands/notifications.d.ts +10 -10
  127. package/build/lib/commands/notifications.d.ts.map +1 -1
  128. package/build/lib/commands/notifications.js +8 -12
  129. package/build/lib/commands/notifications.js.map +1 -1
  130. package/build/lib/commands/pasteboard.d.ts +9 -10
  131. package/build/lib/commands/pasteboard.d.ts.map +1 -1
  132. package/build/lib/commands/pasteboard.js +8 -13
  133. package/build/lib/commands/pasteboard.js.map +1 -1
  134. package/build/lib/commands/pcap.d.ts +18 -38
  135. package/build/lib/commands/pcap.d.ts.map +1 -1
  136. package/build/lib/commands/pcap.js +9 -14
  137. package/build/lib/commands/pcap.js.map +1 -1
  138. package/build/lib/commands/performance.d.ts +36 -55
  139. package/build/lib/commands/performance.d.ts.map +1 -1
  140. package/build/lib/commands/performance.js +93 -86
  141. package/build/lib/commands/performance.js.map +1 -1
  142. package/build/lib/commands/permissions.d.ts +15 -17
  143. package/build/lib/commands/permissions.d.ts.map +1 -1
  144. package/build/lib/commands/permissions.js +12 -18
  145. package/build/lib/commands/permissions.js.map +1 -1
  146. package/build/lib/commands/proxy-helper.d.ts +11 -11
  147. package/build/lib/commands/proxy-helper.d.ts.map +1 -1
  148. package/build/lib/commands/proxy-helper.js +15 -24
  149. package/build/lib/commands/proxy-helper.js.map +1 -1
  150. package/build/lib/commands/record-audio.d.ts +25 -52
  151. package/build/lib/commands/record-audio.d.ts.map +1 -1
  152. package/build/lib/commands/record-audio.js +17 -19
  153. package/build/lib/commands/record-audio.js.map +1 -1
  154. package/build/lib/commands/recordscreen.d.ts +31 -62
  155. package/build/lib/commands/recordscreen.d.ts.map +1 -1
  156. package/build/lib/commands/recordscreen.js +29 -28
  157. package/build/lib/commands/recordscreen.js.map +1 -1
  158. package/build/lib/commands/screenshots.d.ts +15 -9
  159. package/build/lib/commands/screenshots.d.ts.map +1 -1
  160. package/build/lib/commands/screenshots.js +16 -16
  161. package/build/lib/commands/screenshots.js.map +1 -1
  162. package/build/lib/commands/simctl.d.ts +16 -22
  163. package/build/lib/commands/simctl.d.ts.map +1 -1
  164. package/build/lib/commands/simctl.js +13 -17
  165. package/build/lib/commands/simctl.js.map +1 -1
  166. package/build/lib/commands/source.d.ts +10 -8
  167. package/build/lib/commands/source.d.ts.map +1 -1
  168. package/build/lib/commands/source.js +11 -14
  169. package/build/lib/commands/source.js.map +1 -1
  170. package/build/lib/commands/timeouts.d.ts +25 -32
  171. package/build/lib/commands/timeouts.d.ts.map +1 -1
  172. package/build/lib/commands/timeouts.js +19 -15
  173. package/build/lib/commands/timeouts.js.map +1 -1
  174. package/build/lib/commands/types.d.ts +80 -0
  175. package/build/lib/commands/types.d.ts.map +1 -1
  176. package/build/lib/commands/web.d.ts +199 -202
  177. package/build/lib/commands/web.d.ts.map +1 -1
  178. package/build/lib/commands/web.js +216 -175
  179. package/build/lib/commands/web.js.map +1 -1
  180. package/build/lib/commands/xctest-record-screen.d.ts +17 -47
  181. package/build/lib/commands/xctest-record-screen.d.ts.map +1 -1
  182. package/build/lib/commands/xctest-record-screen.js +28 -59
  183. package/build/lib/commands/xctest-record-screen.js.map +1 -1
  184. package/build/lib/commands/xctest.d.ts +37 -37
  185. package/build/lib/commands/xctest.d.ts.map +1 -1
  186. package/build/lib/commands/xctest.js +38 -50
  187. package/build/lib/commands/xctest.js.map +1 -1
  188. package/build/lib/desired-caps.js +1 -1
  189. package/build/lib/device/log/ios-simulator-log.d.ts.map +1 -1
  190. package/build/lib/device/log/ios-simulator-log.js +2 -0
  191. package/build/lib/device/log/ios-simulator-log.js.map +1 -1
  192. package/build/lib/device/simulator-management.d.ts.map +1 -1
  193. package/build/lib/device/simulator-management.js +0 -2
  194. package/build/lib/device/simulator-management.js.map +1 -1
  195. package/build/lib/doctor/optional-checks.d.ts +0 -9
  196. package/build/lib/doctor/optional-checks.d.ts.map +1 -1
  197. package/build/lib/doctor/optional-checks.js +1 -30
  198. package/build/lib/doctor/optional-checks.js.map +1 -1
  199. package/build/lib/driver.d.ts +6 -5
  200. package/build/lib/driver.d.ts.map +1 -1
  201. package/build/lib/driver.js +16 -14
  202. package/build/lib/driver.js.map +1 -1
  203. package/build/lib/execute-method-map.d.ts.map +1 -1
  204. package/build/lib/execute-method-map.js +0 -9
  205. package/build/lib/execute-method-map.js.map +1 -1
  206. package/lib/commands/active-app-info.ts +15 -0
  207. package/lib/commands/alert.ts +98 -0
  208. package/lib/commands/app-management.ts +414 -0
  209. package/lib/commands/{app-strings.js → app-strings.ts} +10 -9
  210. package/lib/commands/appearance.ts +70 -0
  211. package/lib/commands/audit.ts +25 -0
  212. package/lib/commands/{battery.js → battery.ts} +10 -12
  213. package/lib/commands/biometric.ts +52 -0
  214. package/lib/commands/{certificate.js → certificate.ts} +55 -50
  215. package/lib/commands/clipboard.ts +37 -0
  216. package/lib/commands/{condition.js → condition.ts} +21 -77
  217. package/lib/commands/content-size.ts +67 -0
  218. package/lib/commands/{context.js → context.ts} +174 -146
  219. package/lib/commands/device-info.ts +24 -0
  220. package/lib/commands/element.ts +419 -0
  221. package/lib/commands/{execute.js → execute.ts} +42 -38
  222. package/lib/commands/{file-movement.js → file-movement.ts} +212 -235
  223. package/lib/commands/find.ts +277 -0
  224. package/lib/commands/{general.js → general.ts} +102 -77
  225. package/lib/commands/geolocation.ts +55 -0
  226. package/lib/commands/{gesture.js → gesture.ts} +225 -183
  227. package/lib/commands/increase-contrast.ts +49 -0
  228. package/lib/commands/{iohid.js → iohid.ts} +15 -13
  229. package/lib/commands/keyboard.ts +70 -0
  230. package/lib/commands/keychains.ts +16 -0
  231. package/lib/commands/{localization.js → localization.ts} +22 -12
  232. package/lib/commands/{location.js → location.ts} +19 -22
  233. package/lib/commands/lock.ts +43 -0
  234. package/lib/commands/{log.js → log.ts} +68 -68
  235. package/lib/commands/{memory.js → memory.ts} +9 -9
  236. package/lib/commands/{navigation.js → navigation.ts} +42 -39
  237. package/lib/commands/{notifications.js → notifications.ts} +22 -14
  238. package/lib/commands/pasteboard.ts +44 -0
  239. package/lib/commands/{pcap.js → pcap.ts} +28 -28
  240. package/lib/commands/{performance.js → performance.ts} +133 -114
  241. package/lib/commands/permissions.ts +90 -0
  242. package/lib/commands/{proxy-helper.js → proxy-helper.ts} +26 -26
  243. package/lib/commands/{record-audio.js → record-audio.ts} +35 -33
  244. package/lib/commands/{recordscreen.js → recordscreen.ts} +78 -50
  245. package/lib/commands/{screenshots.js → screenshots.ts} +27 -21
  246. package/lib/commands/simctl.ts +82 -0
  247. package/lib/commands/{source.js → source.ts} +23 -20
  248. package/lib/commands/timeouts.ts +95 -0
  249. package/lib/commands/types.ts +86 -0
  250. package/lib/commands/{web.js → web.ts} +314 -264
  251. package/lib/commands/{xctest-record-screen.js → xctest-record-screen.ts} +54 -71
  252. package/lib/commands/{xctest.js → xctest.ts} +78 -71
  253. package/lib/desired-caps.ts +1 -1
  254. package/lib/device/log/ios-simulator-log.ts +2 -0
  255. package/lib/device/simulator-management.ts +0 -2
  256. package/lib/doctor/optional-checks.ts +0 -33
  257. package/lib/driver.ts +19 -17
  258. package/lib/execute-method-map.ts +0 -9
  259. package/package.json +6 -6
  260. package/lib/commands/active-app-info.js +0 -12
  261. package/lib/commands/alert.js +0 -88
  262. package/lib/commands/app-management.js +0 -346
  263. package/lib/commands/appearance.js +0 -71
  264. package/lib/commands/audit.js +0 -31
  265. package/lib/commands/biometric.js +0 -52
  266. package/lib/commands/clipboard.js +0 -35
  267. package/lib/commands/content-size.js +0 -68
  268. package/lib/commands/deviceInfo.js +0 -27
  269. package/lib/commands/element.js +0 -423
  270. package/lib/commands/find.js +0 -205
  271. package/lib/commands/geolocation.js +0 -56
  272. package/lib/commands/increase-contrast.js +0 -50
  273. package/lib/commands/keyboard.js +0 -62
  274. package/lib/commands/keychains.js +0 -17
  275. package/lib/commands/lock.js +0 -46
  276. package/lib/commands/pasteboard.js +0 -43
  277. package/lib/commands/permissions.js +0 -85
  278. package/lib/commands/simctl.js +0 -71
  279. package/lib/commands/timeouts.js +0 -68
@@ -11,31 +11,23 @@ const lodash_1 = __importDefault(require("lodash"));
11
11
  const css_converter_1 = require("../css-converter");
12
12
  const driver_1 = require("appium/driver");
13
13
  const support_1 = require("appium/support");
14
- /**
15
- * @this {XCUITestDriver}
16
- */
17
14
  async function findElOrEls(strategy, selector, mult, context) {
18
15
  if (this.isWebview()) {
19
- return await this.findWebElementOrElements(strategy, selector, mult, context);
20
- }
21
- else {
22
- return await this.findNativeElementOrElements(strategy, selector, mult, context);
16
+ return mult
17
+ ? await this.findWebElementOrElements(strategy, selector, true, context)
18
+ : await this.findWebElementOrElements(strategy, selector, false, context);
23
19
  }
20
+ return mult
21
+ ? await this.findNativeElementOrElements(strategy, selector, true, context)
22
+ : await this.findNativeElementOrElements(strategy, selector, false, context);
24
23
  }
25
- /**
26
- * @this {XCUITestDriver}
27
- * @privateRemarks I'm not sure what these objects are; they aren't `Element`.
28
- * @returns {Promise<any|any[]|undefined>}
29
- */
30
24
  async function findNativeElementOrElements(strategy, selector, mult, context) {
31
25
  const initSelector = selector;
32
26
  let rewroteSelector = false;
33
27
  if (strategy === '-ios predicate string') {
34
- // WebDriverAgent uses 'predicate string'
35
28
  strategy = 'predicate string';
36
29
  }
37
30
  else if (strategy === '-ios class chain') {
38
- // WebDriverAgent uses 'class chain'
39
31
  strategy = WDA_CLASS_CHAIN_STRATEGY;
40
32
  }
41
33
  else if (strategy === 'css selector') {
@@ -43,12 +35,9 @@ async function findNativeElementOrElements(strategy, selector, mult, context) {
43
35
  selector = css_converter_1.CssConverter.toIosClassChainSelector(selector);
44
36
  }
45
37
  if (strategy === 'class name') {
46
- // XCUITest classes have `XCUIElementType` prepended
47
- // first check if there is the old `UIA` prefix
48
38
  if (selector.startsWith('UIA')) {
49
39
  selector = selector.substring(3);
50
40
  }
51
- // now check if we need to add `XCUIElementType`
52
41
  if (!selector.startsWith('XCUIElementType')) {
53
42
  selector = stripViewFromSelector(`XCUIElementType${selector}`);
54
43
  rewroteSelector = true;
@@ -61,8 +50,7 @@ async function findNativeElementOrElements(strategy, selector, mult, context) {
61
50
  [strategy, selector] = rewriteMagicScrollable(mult, this.log);
62
51
  }
63
52
  else if (strategy === 'xpath') {
64
- // Replace UIA if it comes after a forward slash or is at the beginning of the string
65
- selector = selector.replace(/(^|\/)(UIA)([^[/]+)/g, (str, g1, g2, g3) => {
53
+ selector = selector.replace(/(^|\/)(UIA)([^[/]+)/g, (str, g1, _g2, g3) => {
66
54
  rewroteSelector = true;
67
55
  return g1 + stripViewFromSelector(`XCUIElementType${g3}`);
68
56
  });
@@ -72,39 +60,32 @@ async function findNativeElementOrElements(strategy, selector, mult, context) {
72
60
  `'${selector}' to match XCUI type. You should consider ` +
73
61
  `updating your tests to use the new selectors directly`);
74
62
  }
75
- return await this.doNativeFind(strategy, selector, mult, context);
63
+ return mult
64
+ ? await this.doNativeFind(strategy, selector, true, context)
65
+ : await this.doNativeFind(strategy, selector, false, context);
76
66
  }
77
- /**
78
- * @this {XCUITestDriver}
79
- */
80
67
  async function doNativeFind(strategy, selector, mult, context) {
81
- context = support_1.util.unwrapElement(context);
82
- let endpoint = `/element${context ? `/${context}/element` : ''}${mult ? 's' : ''}`;
83
- let body = {
68
+ const ctx = support_1.util.unwrapElement(context ?? null);
69
+ const endpoint = `/element${ctx ? `/${ctx}/element` : ''}${mult ? 's' : ''}`;
70
+ const body = {
84
71
  using: strategy,
85
72
  value: selector,
86
73
  };
87
- /** @type {import('./proxy-helper').AllowedHttpMethod} */
88
74
  const method = 'POST';
89
- // This is either an array is mult === true
90
- // or an object if mult === false
91
- /** @type {Element[]|undefined} */
92
- let els;
75
+ let els = [];
93
76
  try {
94
77
  await this.implicitWaitForCondition(async () => {
95
78
  try {
96
- els = /** @type {Element[]|undefined} */ (await this.proxyCommand(endpoint, method, body));
79
+ els = (await this.proxyCommand(endpoint, method, body));
97
80
  }
98
81
  catch {
99
82
  els = [];
100
83
  }
101
- // we succeed if we get some elements
102
84
  return !lodash_1.default.isEmpty(els);
103
85
  });
104
86
  }
105
87
  catch (err) {
106
88
  if (err.message?.match(/Condition unmet/)) {
107
- // condition was not met setting res to empty array
108
89
  els = [];
109
90
  }
110
91
  else {
@@ -112,15 +93,21 @@ async function doNativeFind(strategy, selector, mult, context) {
112
93
  }
113
94
  }
114
95
  if (mult) {
115
- return els;
96
+ return Array.isArray(els) ? els : [els];
116
97
  }
117
- if (lodash_1.default.isEmpty(els)) {
98
+ if (Array.isArray(els)) {
99
+ if (lodash_1.default.isEmpty(els)) {
100
+ throw new driver_1.errors.NoSuchElementError();
101
+ }
102
+ return els[0];
103
+ }
104
+ if (!els) {
118
105
  throw new driver_1.errors.NoSuchElementError();
119
106
  }
120
107
  return els;
121
108
  }
122
109
  /**
123
- * @this {XCUITestDriver}
110
+ * Finds the first visible child element inside a context.
124
111
  */
125
112
  async function getFirstVisibleChild(mult, context) {
126
113
  this.log.info(`Getting first visible child`);
@@ -131,16 +118,10 @@ async function getFirstVisibleChild(mult, context) {
131
118
  throw new Error('Cannot get first visible child without a context element');
132
119
  }
133
120
  let index = 1;
134
- // loop through children via class-chain finds, until we run out of children
135
- // or we find a visible one. This loop looks infinite but its not, because at
136
- // some point the call to doNativeFind will throw with an Element Not Found
137
- // error, when the index gets higher than the number of child elements. This
138
- // is what we want because that error will halt the loop and make it all the
139
- // way to the client.
140
121
  while (true) {
141
122
  const strategy = WDA_CLASS_CHAIN_STRATEGY;
142
123
  const selector = `*[${index}]`;
143
- const nthChild = await this.doNativeFind(strategy, selector, false, context);
124
+ const nthChild = (await this.doNativeFind(strategy, selector, false, context));
144
125
  const visible = await this.getAttribute('visible', nthChild);
145
126
  if (visible === 'true') {
146
127
  this.log.info(`Found first visible child at position ${index}`);
@@ -149,17 +130,10 @@ async function getFirstVisibleChild(mult, context) {
149
130
  index++;
150
131
  }
151
132
  }
152
- // we override the xpath search for this first-visible-child selector, which
153
- // looks like /*[@firstVisible="true"]
154
133
  const MAGIC_FIRST_VIS_CHILD_SEL = /\/\*\[@firstVisible\s*=\s*('|")true\1\]/;
155
- // we likewise override xpath search to provide a shortcut for finding all
156
- // scrollable elements
157
134
  const MAGIC_SCROLLABLE_SEL = /\/\/\*\[@scrollable\s*=\s*('|")true\1\]/;
158
135
  const WDA_CLASS_CHAIN_STRATEGY = 'class chain';
159
- // Check if the word 'View' is appended to selector and if it is, strip it out
160
136
  function stripViewFromSelector(selector) {
161
- // Don't strip it out if it's one of these 4 element types
162
- // (see https://github.com/facebook/WebDriverAgent/blob/master/WebDriverAgentLib/Utilities/FBElementTypeTransformer.m for reference)
163
137
  const keepView = [
164
138
  'XCUIElementTypeScrollView',
165
139
  'XCUIElementTypeCollectionView',
@@ -167,18 +141,10 @@ function stripViewFromSelector(selector) {
167
141
  'XCUIElementTypeWebView',
168
142
  ].includes(selector);
169
143
  if (!keepView && selector.indexOf('View') === selector.length - 4) {
170
- return selector.substr(0, selector.length - 4);
171
- }
172
- else {
173
- return selector;
144
+ return selector.substring(0, selector.length - 4);
174
145
  }
146
+ return selector;
175
147
  }
176
- /**
177
- *
178
- * @param {boolean} mult
179
- * @param {import('@appium/types').AppiumLogger|null} log
180
- * @returns {[string, string]}
181
- */
182
148
  function rewriteMagicScrollable(mult, log = null) {
183
149
  const pred = ['ScrollView', 'Table', 'CollectionView', 'WebView']
184
150
  .map((t) => `type == "XCUIElementType${t}"`)
@@ -192,8 +158,4 @@ function rewriteMagicScrollable(mult, log = null) {
192
158
  `format with selector '${selector}'`);
193
159
  return [strategy, selector];
194
160
  }
195
- /**
196
- * @typedef {import('../driver').XCUITestDriver} XCUITestDriver
197
- * @typedef {import('@appium/types').Element} Element
198
- */
199
161
  //# sourceMappingURL=find.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"find.js","sourceRoot":"","sources":["../../../lib/commands/find.js"],"names":[],"mappings":";;;;;AAQA,kCAMC;AAOD,kEAgDC;AAKD,oCA4CC;AAKD,oDA0BC;AArJD,oDAAuB;AACvB,oDAA8C;AAC9C,0CAAqC;AACrC,4CAAoC;AAEpC;;GAEG;AACI,KAAK,UAAU,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO;IACjE,IAAI,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;QACrB,OAAO,MAAM,IAAI,CAAC,wBAAwB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAChF,CAAC;SAAM,CAAC;QACN,OAAO,MAAM,IAAI,CAAC,2BAA2B,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACnF,CAAC;AACH,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,2BAA2B,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO;IACjF,MAAM,YAAY,GAAG,QAAQ,CAAC;IAC9B,IAAI,eAAe,GAAG,KAAK,CAAC;IAC5B,IAAI,QAAQ,KAAK,uBAAuB,EAAE,CAAC;QACzC,yCAAyC;QACzC,QAAQ,GAAG,kBAAkB,CAAC;IAChC,CAAC;SAAM,IAAI,QAAQ,KAAK,kBAAkB,EAAE,CAAC;QAC3C,oCAAoC;QACpC,QAAQ,GAAG,wBAAwB,CAAC;IACtC,CAAC;SAAM,IAAI,QAAQ,KAAK,cAAc,EAAE,CAAC;QACvC,QAAQ,GAAG,wBAAwB,CAAC;QACpC,QAAQ,GAAG,4BAAY,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IAC5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Q,IAAI,KAAK,CAAC;IACpB,CAAC;IACD,GAAG,EAAE,IAAI,CACP,4DAA4D;QAC1D,yBAAyB,QAAQ,GAAG,CACvC,CAAC;IACF,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC9B,CAAC"}
@@ -1,102 +1,121 @@
1
+ import type { XCUITestDriver } from '../driver';
2
+ import type { Viewport, ScreenInfo, ButtonName } from './types';
3
+ import type { Size, Rect } from '@appium/types';
1
4
  /**
2
- * @this {XCUITestDriver}
5
+ * Gets the currently active element.
6
+ *
7
+ * In web context, returns the active element from the DOM.
8
+ * In native context, returns the active element from the current view.
9
+ *
10
+ * @returns The active element
3
11
  */
4
- export function active(this: import("../driver").XCUITestDriver): Promise<any>;
12
+ export declare function active(this: XCUITestDriver): Promise<any>;
5
13
  /**
6
- * Trigger a touch/fingerprint match or match failure
14
+ * Trigger a touch/fingerprint match or match failure.
7
15
  *
8
- * @param {boolean} match - whether the match should be a success or failure
9
- * @this {XCUITestDriver}
16
+ * @param match - Whether the match should be a success or failure
10
17
  */
11
- export function touchId(this: import("../driver").XCUITestDriver, match?: boolean): Promise<void>;
18
+ export declare function touchId(this: XCUITestDriver, match?: boolean): Promise<void>;
12
19
  /**
13
- * Toggle whether the device is enrolled in the touch ID program
14
- *
15
- * @param {boolean} isEnabled - whether to enable or disable the touch ID program
20
+ * Toggle whether the device is enrolled in the touch ID program.
16
21
  *
17
- * @this {XCUITestDriver}
22
+ * @param isEnabled - Whether to enable or disable the touch ID program
18
23
  */
19
- export function toggleEnrollTouchId(this: import("../driver").XCUITestDriver, isEnabled?: boolean): Promise<void>;
24
+ export declare function toggleEnrollTouchId(this: XCUITestDriver, isEnabled?: boolean): Promise<void>;
20
25
  /**
21
- * Get the window size
22
- * @this {XCUITestDriver}
23
- * @returns {Promise<import('@appium/types').Size>}
26
+ * Get the window size.
27
+ *
28
+ * @returns The window size (width and height)
24
29
  */
25
- export function getWindowSize(this: import("../driver").XCUITestDriver): Promise<import("@appium/types").Size>;
30
+ export declare function getWindowSize(this: XCUITestDriver): Promise<Size>;
26
31
  /**
27
32
  * Retrieves the actual device time.
28
33
  *
29
- * @param {string} format - The format specifier string. Read the [MomentJS documentation](https://momentjs.com/docs/) to get the full list of supported datetime format specifiers. The default format is `YYYY-MM-DDTHH:mm:ssZ`, which complies to ISO-8601.
30
- * @returns {Promise<string>} Formatted datetime string or the raw command output (if formatting fails)
31
- * @this {XCUITestDriver}
34
+ * @param format - The format specifier string. Read the [MomentJS documentation](https://momentjs.com/docs/) to get the full list of supported datetime format specifiers. The default format is `YYYY-MM-DDTHH:mm:ssZ`, which complies to ISO-8601.
35
+ * @returns Formatted datetime string or the raw command output (if formatting fails)
32
36
  */
33
- export function getDeviceTime(this: import("../driver").XCUITestDriver, format?: string): Promise<string>;
37
+ export declare function getDeviceTime(this: XCUITestDriver, format?: string): Promise<string>;
34
38
  /**
35
- * Retrieves the current device time
39
+ * Retrieves the current device time.
40
+ *
41
+ * This is a wrapper around {@linkcode getDeviceTime}.
36
42
  *
37
- * @param {string} format - See {@linkcode getDeviceTime.format}
38
- * @returns {Promise<string>} Formatted datetime string or the raw command output if formatting fails
39
- * @this {XCUITestDriver}
43
+ * @param format - See {@linkcode getDeviceTime.format}
44
+ * @returns Formatted datetime string or the raw command output if formatting fails
40
45
  */
41
- export function mobileGetDeviceTime(this: import("../driver").XCUITestDriver, format?: string): Promise<string>;
46
+ export declare function mobileGetDeviceTime(this: XCUITestDriver, format?: string): Promise<string>;
42
47
  /**
43
- * For W3C
44
- * @this {XCUITestDriver}
45
- * @return {Promise<import('@appium/types').Rect>}
48
+ * Gets the window rectangle (position and size).
49
+ *
50
+ * For W3C compatibility. In web context, returns the browser window dimensions.
51
+ * In native context, returns the device window dimensions.
52
+ *
53
+ * @returns The window rectangle
46
54
  */
47
- export function getWindowRect(this: import("../driver").XCUITestDriver): Promise<import("@appium/types").Rect>;
55
+ export declare function getWindowRect(this: XCUITestDriver): Promise<Rect>;
48
56
  /**
49
- * @this {XCUITestDriver}
57
+ * Removes/uninstalls the given application from the device under test.
58
+ *
59
+ * This is a wrapper around {@linkcode mobileRemoveApp mobile: removeApp}.
60
+ *
61
+ * @param bundleId - The bundle identifier of the application to be removed
62
+ * @returns `true` if the application has been removed successfully; `false` otherwise
50
63
  */
51
- export function removeApp(this: import("../driver").XCUITestDriver, bundleId: any): Promise<boolean>;
64
+ export declare function removeApp(this: XCUITestDriver, bundleId: string): Promise<boolean>;
52
65
  /**
53
- * @this {XCUITestDriver}
66
+ * Launches the app.
67
+ *
68
+ * @deprecated This API has been deprecated and is not supported anymore.
69
+ * Consider using corresponding 'mobile:' extensions to manage the state of the app under test.
70
+ * @throws {Error} Always throws an error indicating the API is deprecated
54
71
  */
55
- export function launchApp(this: import("../driver").XCUITestDriver): Promise<void>;
72
+ export declare function launchApp(this: XCUITestDriver): Promise<void>;
56
73
  /**
57
- * @this {XCUITestDriver}
74
+ * Closes the app.
75
+ *
76
+ * @deprecated This API has been deprecated and is not supported anymore.
77
+ * Consider using corresponding 'mobile:' extensions to manage the state of the app under test.
78
+ * @throws {Error} Always throws an error indicating the API is deprecated
58
79
  */
59
- export function closeApp(this: import("../driver").XCUITestDriver): Promise<void>;
80
+ export declare function closeApp(this: XCUITestDriver): Promise<void>;
60
81
  /**
61
- * @this {XCUITestDriver}
62
- * @param {string} url
63
- * @returns {Promise<void>}
82
+ * Sets the URL for the current session.
83
+ *
84
+ * In web context, navigates to the URL using the remote debugger.
85
+ * In native context on real devices, uses the proxy command.
86
+ * In native context on simulators, uses simctl to open the URL.
87
+ *
88
+ * @param url - The URL to navigate to
64
89
  */
65
- export function setUrl(this: import("../driver").XCUITestDriver, url: string): Promise<void>;
66
- export class setUrl {
67
- /**
68
- * @this {XCUITestDriver}
69
- * @param {string} url
70
- * @returns {Promise<void>}
71
- */
72
- constructor(this: import("../driver").XCUITestDriver, url: string);
73
- curWebFrames: any[] | undefined;
74
- }
90
+ export declare function setUrl(this: XCUITestDriver, url: string): Promise<void>;
75
91
  /**
76
92
  * Retrieves the viewport dimensions.
77
93
  *
78
94
  * The viewport is the device's screen size with status bar size subtracted if the latter is present/visible.
79
- * @returns {Promise<import('./types').Viewport>}
80
- * @this {XCUITestDriver}
95
+ *
96
+ * @returns The viewport rectangle
81
97
  */
82
- export function getViewportRect(this: import("../driver").XCUITestDriver): Promise<import("./types").Viewport>;
98
+ export declare function getViewportRect(this: XCUITestDriver): Promise<Viewport>;
83
99
  /**
84
100
  * Get information about the screen.
85
101
  *
86
102
  * @privateRemarks memoized in constructor
87
- * @this {XCUITestDriver}
88
- * @returns {Promise<ScreenInfo>}
103
+ * @returns Screen information including dimensions, scale, and status bar size
89
104
  */
90
- export function getScreenInfo(this: import("../driver").XCUITestDriver): Promise<ScreenInfo>;
105
+ export declare function getScreenInfo(this: XCUITestDriver): Promise<ScreenInfo>;
91
106
  /**
92
- * @this {XCUITestDriver}
107
+ * Gets the status bar height.
108
+ *
109
+ * @returns The height of the status bar in logical pixels
93
110
  */
94
- export function getStatusBarHeight(this: import("../driver").XCUITestDriver): Promise<number>;
111
+ export declare function getStatusBarHeight(this: XCUITestDriver): Promise<number>;
95
112
  /**
96
- * memoized in constructor
97
- * @this {XCUITestDriver}
113
+ * Gets the device pixel ratio.
114
+ *
115
+ * @privateRemarks memoized in constructor
116
+ * @returns The device pixel ratio (scale factor)
98
117
  */
99
- export function getDevicePixelRatio(this: import("../driver").XCUITestDriver): Promise<number>;
118
+ export declare function getDevicePixelRatio(this: XCUITestDriver): Promise<number>;
100
119
  /**
101
120
  * Emulates press action on the given physical device button.
102
121
  *
@@ -107,31 +126,16 @@ export function getDevicePixelRatio(this: import("../driver").XCUITestDriver): P
107
126
  *
108
127
  * Use {@linkcode mobilePerformIoHidEvent} to call a more universal API to perform a button press with duration on any supported device.
109
128
  *
110
- * @param {import('./types').ButtonName} name - The name of the button to be pressed.
111
- * @param {number} [durationSeconds] - The duration of the button press in seconds (float).
112
- * @this {XCUITestDriver}
129
+ * @param name - The name of the button to be pressed
130
+ * @param durationSeconds - The duration of the button press in seconds (float)
113
131
  */
114
- export function mobilePressButton(this: import("../driver").XCUITestDriver, name: import("./types").ButtonName, durationSeconds?: number): Promise<unknown>;
132
+ export declare function mobilePressButton(this: XCUITestDriver, name: ButtonName, durationSeconds?: number): Promise<void>;
115
133
  /**
116
134
  * Process a string as speech and send it to Siri.
117
135
  *
118
136
  * Presents the Siri UI, if it is not currently active, and accepts a string which is then processed as if it were recognized speech. See [the documentation of `activateWithVoiceRecognitionText`](https://developer.apple.com/documentation/xctest/xcuisiriservice/2852140-activatewithvoicerecognitiontext?language=objc) for more details.
119
-
120
- * @param {string} text - Text to be sent to Siri
121
- * @returns {Promise<void>}
122
- * @this {XCUITestDriver}
123
- */
124
- export function mobileSiriCommand(this: import("../driver").XCUITestDriver, text: string): Promise<void>;
125
- export type PressButtonOptions = {
126
- /**
127
- * - The name of the button to be pressed.
128
- */
129
- name: string;
130
- /**
131
- * - Duration in float seconds.
132
- */
133
- durationSeconds?: number | undefined;
134
- };
135
- export type XCUITestDriver = import("../driver").XCUITestDriver;
136
- export type ScreenInfo = import("./types").ScreenInfo;
137
+ *
138
+ * @param text - Text to be sent to Siri
139
+ */
140
+ export declare function mobileSiriCommand(this: XCUITestDriver, text: string): Promise<void>;
137
141
  //# sourceMappingURL=general.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../lib/commands/general.js"],"names":[],"mappings":"AAQA;;GAEG;AACH,+EAKC;AAED;;;;;GAKG;AACH,0EAHW,OAAO,iBAKjB;AACC;;;;;;GAMG;AACL,0FAJa,OAAO,iBAMnB;AAED;;;;GAIG;AACH,yEAFa,OAAO,CAAC,OAAO,eAAe,EAAE,IAAI,CAAC,CAKjD;AAED;;;;;;GAMG;AACH,iFAJW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAyC3B;AAED;;;;;;GAMG;AACH,uFAJW,MAAM,GACJ,OAAO,CAAC,MAAM,C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