appium-xcuitest-driver 10.3.0 → 10.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (252) hide show
  1. package/CHANGELOG.md +6 -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 +247 -197
  175. package/build/lib/commands/web.d.ts.map +1 -1
  176. package/build/lib/commands/web.js +815 -786
  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 +278 -1597
  187. package/build/lib/driver.d.ts.map +1 -1
  188. package/build/lib/driver.js +319 -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 +878 -858
  237. package/lib/commands/xctest-record-screen.js +103 -105
  238. package/lib/commands/xctest.js +134 -139
  239. package/lib/driver.js +287 -235
  240. package/lib/execute-method-map.ts +9 -0
  241. package/npm-shrinkwrap.json +2 -2
  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/lib/commands/activeAppInfo.js +0 -14
  252. package/lib/commands/index.js +0 -95
@@ -3,174 +3,176 @@ 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.findElOrEls = findElOrEls;
7
+ exports.findNativeElementOrElements = findNativeElementOrElements;
8
+ exports.doNativeFind = doNativeFind;
9
+ exports.getFirstVisibleChild = getFirstVisibleChild;
6
10
  const lodash_1 = __importDefault(require("lodash"));
7
11
  const css_converter_1 = __importDefault(require("../css-converter"));
8
12
  const driver_1 = require("appium/driver");
9
13
  const support_1 = require("appium/support");
10
- // we override the xpath search for this first-visible-child selector, which
11
- // looks like /*[@firstVisible="true"]
12
- const MAGIC_FIRST_VIS_CHILD_SEL = /\/\*\[@firstVisible\s*=\s*('|")true\1\]/;
13
- // we likewise override xpath search to provide a shortcut for finding all
14
- // scrollable elements
15
- const MAGIC_SCROLLABLE_SEL = /\/\/\*\[@scrollable\s*=\s*('|")true\1\]/;
16
- const WDA_CLASS_CHAIN_STRATEGY = 'class chain';
17
- exports.default = {
18
- /**
19
- * @this {XCUITestDriver}
20
- */
21
- async findElOrEls(strategy, selector, mult, context) {
22
- if (this.isWebview()) {
23
- return await this.findWebElementOrElements(strategy, selector, mult, context);
24
- }
25
- else {
26
- return await this.findNativeElementOrElements(strategy, selector, mult, context);
27
- }
28
- },
29
- /**
30
- * @this {XCUITestDriver}
31
- * @privateRemarks I'm not sure what these objects are; they aren't `Element`.
32
- * @returns {Promise<any|any[]|undefined>}
33
- */
34
- async findNativeElementOrElements(strategy, selector, mult, context) {
35
- const initSelector = selector;
36
- let rewroteSelector = false;
37
- if (strategy === '-ios predicate string') {
38
- // WebDriverAgent uses 'predicate string'
39
- strategy = 'predicate string';
40
- }
41
- else if (strategy === '-ios class chain') {
42
- // WebDriverAgent uses 'class chain'
43
- strategy = WDA_CLASS_CHAIN_STRATEGY;
44
- }
45
- else if (strategy === 'css selector') {
46
- strategy = WDA_CLASS_CHAIN_STRATEGY;
47
- selector = css_converter_1.default.toIosClassChainSelector(selector);
14
+ /**
15
+ * @this {XCUITestDriver}
16
+ */
17
+ async function findElOrEls(strategy, selector, mult, context) {
18
+ if (this.isWebview()) {
19
+ return await this.findWebElementOrElements(strategy, selector, mult, context);
20
+ }
21
+ else {
22
+ return await this.findNativeElementOrElements(strategy, selector, mult, context);
23
+ }
24
+ }
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
+ async function findNativeElementOrElements(strategy, selector, mult, context) {
31
+ const initSelector = selector;
32
+ let rewroteSelector = false;
33
+ if (strategy === '-ios predicate string') {
34
+ // WebDriverAgent uses 'predicate string'
35
+ strategy = 'predicate string';
36
+ }
37
+ else if (strategy === '-ios class chain') {
38
+ // WebDriverAgent uses 'class chain'
39
+ strategy = WDA_CLASS_CHAIN_STRATEGY;
40
+ }
41
+ else if (strategy === 'css selector') {
42
+ strategy = WDA_CLASS_CHAIN_STRATEGY;
43
+ selector = css_converter_1.default.toIosClassChainSelector(selector);
44
+ }
45
+ if (strategy === 'class name') {
46
+ // XCUITest classes have `XCUIElementType` prepended
47
+ // first check if there is the old `UIA` prefix
48
+ if (selector.startsWith('UIA')) {
49
+ selector = selector.substring(3);
48
50
  }
49
- // Check if the word 'View' is appended to selector and if it is, strip it out
50
- function stripViewFromSelector(selector) {
51
- // Don't strip it out if it's one of these 4 element types
52
- // (see https://github.com/facebook/WebDriverAgent/blob/master/WebDriverAgentLib/Utilities/FBElementTypeTransformer.m for reference)
53
- const keepView = [
54
- 'XCUIElementTypeScrollView',
55
- 'XCUIElementTypeCollectionView',
56
- 'XCUIElementTypeTextView',
57
- 'XCUIElementTypeWebView',
58
- ].includes(selector);
59
- if (!keepView && selector.indexOf('View') === selector.length - 4) {
60
- return selector.substr(0, selector.length - 4);
61
- }
62
- else {
63
- return selector;
64
- }
51
+ // now check if we need to add `XCUIElementType`
52
+ if (!selector.startsWith('XCUIElementType')) {
53
+ selector = stripViewFromSelector(`XCUIElementType${selector}`);
54
+ rewroteSelector = true;
65
55
  }
66
- if (strategy === 'class name') {
67
- // XCUITest classes have `XCUIElementType` prepended
68
- // first check if there is the old `UIA` prefix
69
- if (selector.startsWith('UIA')) {
70
- selector = selector.substring(3);
71
- }
72
- // now check if we need to add `XCUIElementType`
73
- if (!selector.startsWith('XCUIElementType')) {
74
- selector = stripViewFromSelector(`XCUIElementType${selector}`);
75
- rewroteSelector = true;
56
+ }
57
+ if (strategy === 'xpath' && MAGIC_FIRST_VIS_CHILD_SEL.test(selector)) {
58
+ return await this.getFirstVisibleChild(mult, context);
59
+ }
60
+ else if (strategy === 'xpath' && MAGIC_SCROLLABLE_SEL.test(selector)) {
61
+ [strategy, selector] = rewriteMagicScrollable(mult, this.log);
62
+ }
63
+ 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) => {
66
+ rewroteSelector = true;
67
+ return g1 + stripViewFromSelector(`XCUIElementType${g3}`);
68
+ });
69
+ }
70
+ if (rewroteSelector) {
71
+ this.log.info(`Rewrote incoming selector from '${initSelector}' to ` +
72
+ `'${selector}' to match XCUI type. You should consider ` +
73
+ `updating your tests to use the new selectors directly`);
74
+ }
75
+ return await this.doNativeFind(strategy, selector, mult, context);
76
+ }
77
+ /**
78
+ * @this {XCUITestDriver}
79
+ */
80
+ 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 = {
84
+ using: strategy,
85
+ value: selector,
86
+ };
87
+ /** @type {import('./proxy-helper').AllowedHttpMethod} */
88
+ 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;
93
+ try {
94
+ await this.implicitWaitForCondition(async () => {
95
+ try {
96
+ els = /** @type {Element[]|undefined} */ (await this.proxyCommand(endpoint, method, body));
76
97
  }
77
- }
78
- if (strategy === 'xpath' && MAGIC_FIRST_VIS_CHILD_SEL.test(selector)) {
79
- return await this.getFirstVisibleChild(mult, context);
80
- }
81
- else if (strategy === 'xpath' && MAGIC_SCROLLABLE_SEL.test(selector)) {
82
- [strategy, selector] = rewriteMagicScrollable(mult, this.log);
83
- }
84
- else if (strategy === 'xpath') {
85
- // Replace UIA if it comes after a forward slash or is at the beginning of the string
86
- selector = selector.replace(/(^|\/)(UIA)([^[/]+)/g, (str, g1, g2, g3) => {
87
- rewroteSelector = true;
88
- return g1 + stripViewFromSelector(`XCUIElementType${g3}`);
89
- });
90
- }
91
- if (rewroteSelector) {
92
- this.log.info(`Rewrote incoming selector from '${initSelector}' to ` +
93
- `'${selector}' to match XCUI type. You should consider ` +
94
- `updating your tests to use the new selectors directly`);
95
- }
96
- return await this.doNativeFind(strategy, selector, mult, context);
97
- },
98
- /**
99
- * @this {XCUITestDriver}
100
- */
101
- async doNativeFind(strategy, selector, mult, context) {
102
- context = support_1.util.unwrapElement(context);
103
- let endpoint = `/element${context ? `/${context}/element` : ''}${mult ? 's' : ''}`;
104
- let body = {
105
- using: strategy,
106
- value: selector,
107
- };
108
- /** @type {import('./proxy-helper').AllowedHttpMethod} */
109
- const method = 'POST';
110
- // This is either an array is mult === true
111
- // or an object if mult === false
112
- /** @type {Element[]|undefined} */
113
- let els;
114
- try {
115
- await this.implicitWaitForCondition(async () => {
116
- try {
117
- els = /** @type {Element[]|undefined} */ (await this.proxyCommand(endpoint, method, body));
118
- }
119
- catch {
120
- els = [];
121
- }
122
- // we succeed if we get some elements
123
- return !lodash_1.default.isEmpty(els);
124
- });
125
- }
126
- catch (err) {
127
- if (err.message?.match(/Condition unmet/)) {
128
- // condition was not met setting res to empty array
98
+ catch {
129
99
  els = [];
130
100
  }
131
- else {
132
- throw err;
133
- }
134
- }
135
- if (mult) {
136
- return els;
101
+ // we succeed if we get some elements
102
+ return !lodash_1.default.isEmpty(els);
103
+ });
104
+ }
105
+ catch (err) {
106
+ if (err.message?.match(/Condition unmet/)) {
107
+ // condition was not met setting res to empty array
108
+ els = [];
137
109
  }
138
- if (lodash_1.default.isEmpty(els)) {
139
- throw new driver_1.errors.NoSuchElementError();
110
+ else {
111
+ throw err;
140
112
  }
113
+ }
114
+ if (mult) {
141
115
  return els;
142
- },
143
- /**
144
- * @this {XCUITestDriver}
145
- */
146
- async getFirstVisibleChild(mult, context) {
147
- this.log.info(`Getting first visible child`);
148
- if (mult) {
149
- throw new Error('Cannot get multiple first visible children!');
150
- }
151
- if (!context) {
152
- throw new Error('Cannot get first visible child without a context element');
153
- }
154
- let index = 1;
155
- // loop through children via class-chain finds, until we run out of children
156
- // or we find a visible one. This loop looks infinite but its not, because at
157
- // some point the call to doNativeFind will throw with an Element Not Found
158
- // error, when the index gets higher than the number of child elements. This
159
- // is what we want because that error will halt the loop and make it all the
160
- // way to the client.
161
- while (true) {
162
- const strategy = WDA_CLASS_CHAIN_STRATEGY;
163
- const selector = `*[${index}]`;
164
- const nthChild = await this.doNativeFind(strategy, selector, false, context);
165
- const visible = await this.getAttribute('visible', nthChild);
166
- if (visible === 'true') {
167
- this.log.info(`Found first visible child at position ${index}`);
168
- return nthChild;
169
- }
170
- index++;
171
- }
172
- },
173
- };
116
+ }
117
+ if (lodash_1.default.isEmpty(els)) {
118
+ throw new driver_1.errors.NoSuchElementError();
119
+ }
120
+ return els;
121
+ }
122
+ /**
123
+ * @this {XCUITestDriver}
124
+ */
125
+ async function getFirstVisibleChild(mult, context) {
126
+ this.log.info(`Getting first visible child`);
127
+ if (mult) {
128
+ throw new Error('Cannot get multiple first visible children!');
129
+ }
130
+ if (!context) {
131
+ throw new Error('Cannot get first visible child without a context element');
132
+ }
133
+ 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
+ while (true) {
141
+ const strategy = WDA_CLASS_CHAIN_STRATEGY;
142
+ const selector = `*[${index}]`;
143
+ const nthChild = await this.doNativeFind(strategy, selector, false, context);
144
+ const visible = await this.getAttribute('visible', nthChild);
145
+ if (visible === 'true') {
146
+ this.log.info(`Found first visible child at position ${index}`);
147
+ return nthChild;
148
+ }
149
+ index++;
150
+ }
151
+ }
152
+ // we override the xpath search for this first-visible-child selector, which
153
+ // looks like /*[@firstVisible="true"]
154
+ 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
+ const MAGIC_SCROLLABLE_SEL = /\/\/\*\[@scrollable\s*=\s*('|")true\1\]/;
158
+ 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
+ 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
+ const keepView = [
164
+ 'XCUIElementTypeScrollView',
165
+ 'XCUIElementTypeCollectionView',
166
+ 'XCUIElementTypeTextView',
167
+ 'XCUIElementTypeWebView',
168
+ ].includes(selector);
169
+ if (!keepView && selector.indexOf('View') === selector.length - 4) {
170
+ return selector.substr(0, selector.length - 4);
171
+ }
172
+ else {
173
+ return selector;
174
+ }
175
+ }
174
176
  /**
175
177
  *
176
178
  * @param {boolean} mult
@@ -1 +1 @@
1
- {"version":3,"file":"find.js","sourceRoot":"","sources":["../../../lib/commands/find.js"],"names":[],"mappings":";;;;;AAAA,oDAAuB;AACvB,qEAA4C;AAC5C,0CAAqC;AACrC,4CAAoC;AAEpC,4EAA4E;AAC5E,sCAAsC;AACtC,MAAM,yBAAyB,GAAG,yCAAyC,CAAC;AAE5E,0EAA0E;AAC1E,sBAAsB;AACtB,MAAM,oBAAoB,GAAG,yCAAyC,CAAC;AAEvE,MAAM,wBAAwB,GAAG,aAAa,CAAC;AAE/C,kBAAe;IACb;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO;QACjD,IAAI,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;YACrB,OAAO,MAAM,IAAI,CAAC,wBAAwB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAChF,CAAC;aAAM,CAAC;YACN,OAAO,MAAM,IAAI,CAAC,2BAA2B,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QACnF,CAAC;IACH,CAAC;IACD;;;;OAIG;IACH,KAAK,CAAC,2BAA2B,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO;QACjE,MAAM,YAAY,GAAG,QAAQ,CAAC;QAC9B,IAAI,eAAe,GAAG,KAAK,CAAC;QAC5B,IAAI,QAAQ,KAAK,uBAAuB,EAAE,CAAC;YAC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1D,yBAAyB,QAAQ,GAAG,CACvC,CAAC;IACF,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC9B,CAAC;AAED;;;GAGG"}
@@ -1,4 +1,127 @@
1
- export default commands;
1
+ /**
2
+ * @this {XCUITestDriver}
3
+ */
4
+ export function active(this: import("../driver").XCUITestDriver): Promise<any>;
5
+ /**
6
+ * Trigger a touch/fingerprint match or match failure
7
+ *
8
+ * @param {boolean} match - whether the match should be a success or failure
9
+ * @this {XCUITestDriver}
10
+ */
11
+ export function touchId(this: import("../driver").XCUITestDriver, match?: boolean): Promise<void>;
12
+ /**
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
16
+ *
17
+ * @this {XCUITestDriver}
18
+ */
19
+ export function toggleEnrollTouchId(this: import("../driver").XCUITestDriver, isEnabled?: boolean): Promise<void>;
20
+ /**
21
+ * Get the window size
22
+ * @this {XCUITestDriver}
23
+ * @returns {Promise<import('@appium/types').Size>}
24
+ */
25
+ export function getWindowSize(this: import("../driver").XCUITestDriver): Promise<import("@appium/types").Size>;
26
+ /**
27
+ * Retrieves the actual device time.
28
+ *
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}
32
+ */
33
+ export function getDeviceTime(this: import("../driver").XCUITestDriver, format?: string): Promise<string>;
34
+ /**
35
+ * Retrieves the current device time
36
+ *
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}
40
+ */
41
+ export function mobileGetDeviceTime(this: import("../driver").XCUITestDriver, format?: string): Promise<string>;
42
+ /**
43
+ * For W3C
44
+ * @this {XCUITestDriver}
45
+ * @return {Promise<import('@appium/types').Rect>}
46
+ */
47
+ export function getWindowRect(this: import("../driver").XCUITestDriver): Promise<import("@appium/types").Rect>;
48
+ /**
49
+ * @this {XCUITestDriver}
50
+ */
51
+ export function removeApp(this: import("../driver").XCUITestDriver, bundleId: any): Promise<boolean>;
52
+ /**
53
+ * @this {XCUITestDriver}
54
+ */
55
+ export function launchApp(this: import("../driver").XCUITestDriver): Promise<void>;
56
+ /**
57
+ * @this {XCUITestDriver}
58
+ */
59
+ export function closeApp(this: import("../driver").XCUITestDriver): Promise<void>;
60
+ /**
61
+ * @this {XCUITestDriver}
62
+ * @param {string} url
63
+ * @returns {Promise<void>}
64
+ */
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
+ }
75
+ /**
76
+ * Retrieves the viewport dimensions.
77
+ *
78
+ * 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}
81
+ */
82
+ export function getViewportRect(this: import("../driver").XCUITestDriver): Promise<import("./types").Viewport>;
83
+ /**
84
+ * Get information about the screen.
85
+ *
86
+ * @privateRemarks memoized in constructor
87
+ * @this {XCUITestDriver}
88
+ * @returns {Promise<ScreenInfo>}
89
+ */
90
+ export function getScreenInfo(this: import("../driver").XCUITestDriver): Promise<ScreenInfo>;
91
+ /**
92
+ * @this {XCUITestDriver}
93
+ */
94
+ export function getStatusBarHeight(this: import("../driver").XCUITestDriver): Promise<number>;
95
+ /**
96
+ * memoized in constructor
97
+ * @this {XCUITestDriver}
98
+ */
99
+ export function getDevicePixelRatio(this: import("../driver").XCUITestDriver): Promise<number>;
100
+ /**
101
+ * Emulates press action on the given physical device button.
102
+ *
103
+ * This executes different methods based on the platform:
104
+ *
105
+ * - iOS: [`pressButton:`](https://developer.apple.com/documentation/xctest/xcuidevice/1619052-pressbutton)
106
+ * - tvOS: [`pressButton:`](https://developer.apple.com/documentation/xctest/xcuiremote/1627475-pressbutton) or [`pressButton:forDuration:`](https://developer.apple.com/documentation/xctest/xcuiremote/1627476-pressbutton)
107
+ *
108
+ * Use {@linkcode mobilePerformIoHidEvent} to call a more universal API to perform a button press with duration on any supported device.
109
+ *
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}
113
+ */
114
+ export function mobilePressButton(this: import("../driver").XCUITestDriver, name: import("./types").ButtonName, durationSeconds?: number): Promise<unknown>;
115
+ /**
116
+ * Process a string as speech and send it to Siri.
117
+ *
118
+ * 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>;
2
125
  export type PressButtonOptions = {
3
126
  /**
4
127
  * - The name of the button to be pressed.
@@ -11,119 +134,4 @@ export type PressButtonOptions = {
11
134
  };
12
135
  export type XCUITestDriver = import("../driver").XCUITestDriver;
13
136
  export type ScreenInfo = import("./types").ScreenInfo;
14
- declare namespace commands {
15
- /**
16
- * @this {XCUITestDriver}
17
- */
18
- function active(this: import("../driver").XCUITestDriver): Promise<any>;
19
- /**
20
- * Trigger a touch/fingerprint match or match failure
21
- *
22
- * @param {boolean} match - whether the match should be a success or failure
23
- * @this {XCUITestDriver}
24
- */
25
- function touchId(this: import("../driver").XCUITestDriver, match?: boolean): Promise<void>;
26
- /**
27
- * Toggle whether the device is enrolled in the touch ID program
28
- *
29
- * @param {boolean} isEnabled - whether to enable or disable the touch ID program
30
- *
31
- * @this {XCUITestDriver}
32
- */
33
- function toggleEnrollTouchId(this: import("../driver").XCUITestDriver, isEnabled?: boolean): Promise<void>;
34
- /**
35
- * Get the window size
36
- * @this {XCUITestDriver}
37
- * @returns {Promise<import('@appium/types').Size>}
38
- */
39
- function getWindowSize(this: import("../driver").XCUITestDriver): Promise<import("@appium/types").Size>;
40
- /**
41
- * Retrieves the actual device time.
42
- *
43
- * @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.
44
- * @returns {Promise<string>} Formatted datetime string or the raw command output (if formatting fails)
45
- * @this {XCUITestDriver}
46
- */
47
- function getDeviceTime(this: import("../driver").XCUITestDriver, format?: string): Promise<string>;
48
- /**
49
- * Retrieves the current device time
50
- *
51
- * @param {string} format - See {@linkcode getDeviceTime.format}
52
- * @returns {Promise<string>} Formatted datetime string or the raw command output if formatting fails
53
- * @this {XCUITestDriver}
54
- */
55
- function mobileGetDeviceTime(this: import("../driver").XCUITestDriver, format?: string): Promise<string>;
56
- /**
57
- * For W3C
58
- * @this {XCUITestDriver}
59
- * @return {Promise<import('@appium/types').Rect>}
60
- */
61
- function getWindowRect(this: import("../driver").XCUITestDriver): Promise<import("@appium/types").Rect>;
62
- /**
63
- * @this {XCUITestDriver}
64
- */
65
- function removeApp(this: import("../driver").XCUITestDriver, bundleId: any): Promise<boolean>;
66
- /**
67
- * @this {XCUITestDriver}
68
- */
69
- function launchApp(this: import("../driver").XCUITestDriver): Promise<never>;
70
- /**
71
- * @this {XCUITestDriver}
72
- */
73
- function closeApp(this: import("../driver").XCUITestDriver): Promise<never>;
74
- /**
75
- * @this {XCUITestDriver}
76
- */
77
- function setUrl(this: import("../driver").XCUITestDriver, url: any): Promise<void>;
78
- /**
79
- * Retrieves the viewport dimensions.
80
- *
81
- * The viewport is the device's screen size with status bar size subtracted if the latter is present/visible.
82
- * @returns {Promise<import('./types').Viewport>}
83
- * @this {XCUITestDriver}
84
- */
85
- function getViewportRect(this: import("../driver").XCUITestDriver): Promise<import("./types").Viewport>;
86
- /**
87
- * Get information about the screen.
88
- *
89
- * @privateRemarks memoized in constructor
90
- * @this {XCUITestDriver}
91
- * @returns {Promise<ScreenInfo>}
92
- */
93
- function getScreenInfo(this: import("../driver").XCUITestDriver): Promise<ScreenInfo>;
94
- /**
95
- * @this {XCUITestDriver}
96
- */
97
- function getStatusBarHeight(this: import("../driver").XCUITestDriver): Promise<number>;
98
- /**
99
- * memoized in constructor
100
- * @this {XCUITestDriver}
101
- */
102
- function getDevicePixelRatio(this: import("../driver").XCUITestDriver): Promise<number>;
103
- /**
104
- * Emulates press action on the given physical device button.
105
- *
106
- * This executes different methods based on the platform:
107
- *
108
- * - iOS: [`pressButton:`](https://developer.apple.com/documentation/xctest/xcuidevice/1619052-pressbutton)
109
- * - tvOS: [`pressButton:`](https://developer.apple.com/documentation/xctest/xcuiremote/1627475-pressbutton) or [`pressButton:forDuration:`](https://developer.apple.com/documentation/xctest/xcuiremote/1627476-pressbutton)
110
- *
111
- * Use {@linkcode mobilePerformIoHidEvent} to call a more universal API to perform a button press with duration on any supported device.
112
- *
113
- * @param {import('./types').ButtonName} name - The name of the button to be pressed.
114
- * @param {number} [durationSeconds] - The duration of the button press in seconds (float).
115
- * @this {XCUITestDriver}
116
- */
117
- function mobilePressButton(this: import("../driver").XCUITestDriver, name: import("./types").ButtonName, durationSeconds?: number): Promise<unknown>;
118
- /**
119
- * Process a string as speech and send it to Siri.
120
- *
121
- * 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.
122
-
123
- * @param {string} text - Text to be sent to Siri
124
- * @returns {Promise<void>}
125
- * @this {XCUITestDriver}
126
- */
127
- function mobileSiriCommand(this: import("../driver").XCUITestDriver, text: string): Promise<void>;
128
- }
129
137
  //# sourceMappingURL=general.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../lib/commands/general.js"],"names":[],"mappings":";;;;;UAuQc,MAAM;;;;;;6BAKP,OAAO,WAAW,EAAE,cAAc;yBAClC,OAAO,SAAS,EAAE,UAAU;;IApQvC;;OAEG;IACH,wEAKC;IAED;;;;;OAKG;IACH,mEAHW,OAAO,iBAKjB;IACD;;;;;;OAMG;IACH,mFAJW,OAAO,iBAMjB;IACD;;;;OAIG;IACH,kEAFa,OAAO,CAAC,OAAO,eAAe,EAAE,IAAI,CAAC,CAKjD;IACD;;;;;;OAMG;IACH,0EAJW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAyC3B;IAED;;;;;;OAMG;IACH,gFAJW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAK3B;IAED;;;;OAIG;IACH,kEAFY,OAAO,CAAC,OAAO,eAAe,EAAE,IAAI,CAAC,CAgBhD;IACD;;OAEG;IACH,8FAEC;IACD;;OAEG;IACH,6EAKC;IACD;;OAEG;IACH,4EAKC;IACD;;OAEG;IACH,mFAgBC;IACD;;;;;;OAMG;IACH,oEAHa,OAAO,CAAC,OAAO,SAAS,EAAE,QAAQ,CAAC,CAiB/C;IAED;;;;;;OAMG;IACH,kEAFa,OAAO,CAAC,UAAU,CAAC,CAI/B;IACD;;OAEG;IACH,uFAGC;IAED;;;OAGG;IACH,wFAGC;IAED;;;;;;;;;;;;;OAaG;IACH,2EAJW,OAAO,SAAS,EAAE,UAAU,oBAC5B,MAAM,oBAWhB;IACD;;;;;;;;OAQG;IACH,2EAJW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAQzB"}
1
+ {"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../lib/commands/general.js"],"names":[],"mappings":"AAQA;;GAEG;AACH,+EAKC;AAED;;;;;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