appium-xcuitest-driver 10.3.0 → 10.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/lib/commands/active-app-info.d.ts +9 -0
  3. package/build/lib/commands/active-app-info.d.ts.map +1 -0
  4. package/build/lib/commands/active-app-info.js +14 -0
  5. package/build/lib/commands/active-app-info.js.map +1 -0
  6. package/build/lib/commands/alert.d.ts +42 -45
  7. package/build/lib/commands/alert.d.ts.map +1 -1
  8. package/build/lib/commands/alert.js +66 -62
  9. package/build/lib/commands/alert.js.map +1 -1
  10. package/build/lib/commands/app-management.d.ts +150 -153
  11. package/build/lib/commands/app-management.d.ts.map +1 -1
  12. package/build/lib/commands/app-management.js +300 -286
  13. package/build/lib/commands/app-management.js.map +1 -1
  14. package/build/lib/commands/app-strings.d.ts +14 -17
  15. package/build/lib/commands/app-strings.d.ts.map +1 -1
  16. package/build/lib/commands/app-strings.js +23 -24
  17. package/build/lib/commands/app-strings.js.map +1 -1
  18. package/build/lib/commands/appearance.d.ts +19 -22
  19. package/build/lib/commands/appearance.d.ts.map +1 -1
  20. package/build/lib/commands/appearance.js +56 -56
  21. package/build/lib/commands/appearance.js.map +1 -1
  22. package/build/lib/commands/audit.d.ts +22 -17
  23. package/build/lib/commands/audit.d.ts.map +1 -1
  24. package/build/lib/commands/audit.js +17 -18
  25. package/build/lib/commands/audit.js.map +1 -1
  26. package/build/lib/commands/battery.d.ts +11 -14
  27. package/build/lib/commands/battery.d.ts.map +1 -1
  28. package/build/lib/commands/battery.js +36 -37
  29. package/build/lib/commands/battery.js.map +1 -1
  30. package/build/lib/commands/biometric.d.ts +30 -33
  31. package/build/lib/commands/biometric.d.ts.map +1 -1
  32. package/build/lib/commands/biometric.js +42 -41
  33. package/build/lib/commands/biometric.js.map +1 -1
  34. package/build/lib/commands/certificate.d.ts +48 -45
  35. package/build/lib/commands/certificate.d.ts.map +1 -1
  36. package/build/lib/commands/certificate.js +218 -205
  37. package/build/lib/commands/certificate.js.map +1 -1
  38. package/build/lib/commands/clipboard.d.ts +19 -22
  39. package/build/lib/commands/clipboard.d.ts.map +1 -1
  40. package/build/lib/commands/clipboard.js +30 -30
  41. package/build/lib/commands/clipboard.js.map +1 -1
  42. package/build/lib/commands/condition.d.ts +49 -26
  43. package/build/lib/commands/condition.d.ts.map +1 -1
  44. package/build/lib/commands/condition.js +87 -86
  45. package/build/lib/commands/condition.js.map +1 -1
  46. package/build/lib/commands/content-size.d.ts +26 -29
  47. package/build/lib/commands/content-size.d.ts.map +1 -1
  48. package/build/lib/commands/content-size.js +36 -36
  49. package/build/lib/commands/content-size.js.map +1 -1
  50. package/build/lib/commands/context.d.ts +161 -108
  51. package/build/lib/commands/context.d.ts.map +1 -1
  52. package/build/lib/commands/context.js +530 -517
  53. package/build/lib/commands/context.js.map +1 -1
  54. package/build/lib/commands/deviceInfo.d.ts +9 -12
  55. package/build/lib/commands/deviceInfo.d.ts.map +1 -1
  56. package/build/lib/commands/deviceInfo.js +17 -18
  57. package/build/lib/commands/deviceInfo.js.map +1 -1
  58. package/build/lib/commands/element.d.ts +102 -105
  59. package/build/lib/commands/element.d.ts.map +1 -1
  60. package/build/lib/commands/element.js +337 -323
  61. package/build/lib/commands/element.js.map +1 -1
  62. package/build/lib/commands/execute.d.ts +24 -19
  63. package/build/lib/commands/execute.d.ts.map +1 -1
  64. package/build/lib/commands/execute.js +63 -62
  65. package/build/lib/commands/execute.js.map +1 -1
  66. package/build/lib/commands/file-movement.d.ts +77 -80
  67. package/build/lib/commands/file-movement.d.ts.map +1 -1
  68. package/build/lib/commands/file-movement.js +130 -124
  69. package/build/lib/commands/file-movement.js.map +1 -1
  70. package/build/lib/commands/find.d.ts +18 -21
  71. package/build/lib/commands/find.d.ts.map +1 -1
  72. package/build/lib/commands/find.js +158 -156
  73. package/build/lib/commands/find.js.map +1 -1
  74. package/build/lib/commands/general.d.ts +124 -116
  75. package/build/lib/commands/general.d.ts.map +1 -1
  76. package/build/lib/commands/general.js +248 -232
  77. package/build/lib/commands/general.js.map +1 -1
  78. package/build/lib/commands/geolocation.d.ts +43 -46
  79. package/build/lib/commands/geolocation.d.ts.map +1 -1
  80. package/build/lib/commands/geolocation.js +10 -11
  81. package/build/lib/commands/geolocation.js.map +1 -1
  82. package/build/lib/commands/gesture.d.ts +273 -276
  83. package/build/lib/commands/gesture.d.ts.map +1 -1
  84. package/build/lib/commands/gesture.js +506 -492
  85. package/build/lib/commands/gesture.js.map +1 -1
  86. package/build/lib/commands/increase-contrast.d.ts +20 -23
  87. package/build/lib/commands/increase-contrast.d.ts.map +1 -1
  88. package/build/lib/commands/increase-contrast.js +30 -30
  89. package/build/lib/commands/increase-contrast.js.map +1 -1
  90. package/build/lib/commands/iohid.d.ts +1370 -1373
  91. package/build/lib/commands/iohid.d.ts.map +1 -1
  92. package/build/lib/commands/iohid.js +30 -31
  93. package/build/lib/commands/iohid.js.map +1 -1
  94. package/build/lib/commands/keyboard.d.ts +29 -32
  95. package/build/lib/commands/keyboard.d.ts.map +1 -1
  96. package/build/lib/commands/keyboard.js +53 -51
  97. package/build/lib/commands/keyboard.js.map +1 -1
  98. package/build/lib/commands/keychains.d.ts +9 -12
  99. package/build/lib/commands/keychains.d.ts.map +1 -1
  100. package/build/lib/commands/keychains.js +13 -14
  101. package/build/lib/commands/keychains.js.map +1 -1
  102. package/build/lib/commands/localization.d.ts +16 -19
  103. package/build/lib/commands/localization.d.ts.map +1 -1
  104. package/build/lib/commands/localization.js +25 -26
  105. package/build/lib/commands/localization.js.map +1 -1
  106. package/build/lib/commands/location.d.ts +36 -39
  107. package/build/lib/commands/location.d.ts.map +1 -1
  108. package/build/lib/commands/location.js +99 -98
  109. package/build/lib/commands/location.js.map +1 -1
  110. package/build/lib/commands/lock.d.ts +21 -24
  111. package/build/lib/commands/lock.d.ts.map +1 -1
  112. package/build/lib/commands/lock.js +39 -38
  113. package/build/lib/commands/lock.js.map +1 -1
  114. package/build/lib/commands/log.d.ts +43 -37
  115. package/build/lib/commands/log.d.ts.map +1 -1
  116. package/build/lib/commands/log.js +174 -171
  117. package/build/lib/commands/log.js.map +1 -1
  118. package/build/lib/commands/memory.d.ts +9 -12
  119. package/build/lib/commands/memory.d.ts.map +1 -1
  120. package/build/lib/commands/memory.js +37 -38
  121. package/build/lib/commands/memory.js.map +1 -1
  122. package/build/lib/commands/navigation.d.ts +30 -33
  123. package/build/lib/commands/navigation.d.ts.map +1 -1
  124. package/build/lib/commands/navigation.js +92 -92
  125. package/build/lib/commands/navigation.js.map +1 -1
  126. package/build/lib/commands/notifications.d.ts +26 -29
  127. package/build/lib/commands/notifications.d.ts.map +1 -1
  128. package/build/lib/commands/notifications.js +53 -53
  129. package/build/lib/commands/notifications.js.map +1 -1
  130. package/build/lib/commands/pasteboard.d.ts +21 -24
  131. package/build/lib/commands/pasteboard.d.ts.map +1 -1
  132. package/build/lib/commands/pasteboard.js +37 -37
  133. package/build/lib/commands/pasteboard.js.map +1 -1
  134. package/build/lib/commands/pcap.d.ts +39 -26
  135. package/build/lib/commands/pcap.d.ts.map +1 -1
  136. package/build/lib/commands/pcap.js +81 -81
  137. package/build/lib/commands/pcap.js.map +1 -1
  138. package/build/lib/commands/performance.d.ts +63 -44
  139. package/build/lib/commands/performance.d.ts.map +1 -1
  140. package/build/lib/commands/performance.js +105 -105
  141. package/build/lib/commands/performance.js.map +1 -1
  142. package/build/lib/commands/permissions.d.ts +33 -36
  143. package/build/lib/commands/permissions.d.ts.map +1 -1
  144. package/build/lib/commands/permissions.js +66 -65
  145. package/build/lib/commands/permissions.js.map +1 -1
  146. package/build/lib/commands/proxy-helper.d.ts +12 -15
  147. package/build/lib/commands/proxy-helper.d.ts.map +1 -1
  148. package/build/lib/commands/proxy-helper.js +53 -54
  149. package/build/lib/commands/proxy-helper.js.map +1 -1
  150. package/build/lib/commands/record-audio.d.ts +49 -29
  151. package/build/lib/commands/record-audio.d.ts.map +1 -1
  152. package/build/lib/commands/record-audio.js +100 -104
  153. package/build/lib/commands/record-audio.js.map +1 -1
  154. package/build/lib/commands/recordscreen.d.ts +54 -18
  155. package/build/lib/commands/recordscreen.d.ts.map +1 -1
  156. package/build/lib/commands/recordscreen.js +127 -129
  157. package/build/lib/commands/recordscreen.js.map +1 -1
  158. package/build/lib/commands/screenshots.d.ts +14 -17
  159. package/build/lib/commands/screenshots.d.ts.map +1 -1
  160. package/build/lib/commands/screenshots.js +108 -107
  161. package/build/lib/commands/screenshots.js.map +1 -1
  162. package/build/lib/commands/simctl.d.ts +11 -14
  163. package/build/lib/commands/simctl.d.ts.map +1 -1
  164. package/build/lib/commands/simctl.js +23 -26
  165. package/build/lib/commands/simctl.js.map +1 -1
  166. package/build/lib/commands/source.d.ts +14 -17
  167. package/build/lib/commands/source.d.ts.map +1 -1
  168. package/build/lib/commands/source.js +40 -43
  169. package/build/lib/commands/source.js.map +1 -1
  170. package/build/lib/commands/timeouts.d.ts +44 -33
  171. package/build/lib/commands/timeouts.d.ts.map +1 -1
  172. package/build/lib/commands/timeouts.js +65 -63
  173. package/build/lib/commands/timeouts.js.map +1 -1
  174. package/build/lib/commands/web.d.ts +275 -197
  175. package/build/lib/commands/web.d.ts.map +1 -1
  176. package/build/lib/commands/web.js +866 -785
  177. package/build/lib/commands/web.js.map +1 -1
  178. package/build/lib/commands/xctest-record-screen.d.ts +63 -66
  179. package/build/lib/commands/xctest-record-screen.d.ts.map +1 -1
  180. package/build/lib/commands/xctest-record-screen.js +103 -102
  181. package/build/lib/commands/xctest-record-screen.js.map +1 -1
  182. package/build/lib/commands/xctest.d.ts +55 -51
  183. package/build/lib/commands/xctest.d.ts.map +1 -1
  184. package/build/lib/commands/xctest.js +116 -117
  185. package/build/lib/commands/xctest.js.map +1 -1
  186. package/build/lib/driver.d.ts +277 -1597
  187. package/build/lib/driver.d.ts.map +1 -1
  188. package/build/lib/driver.js +318 -235
  189. package/build/lib/driver.js.map +1 -1
  190. package/build/lib/execute-method-map.d.ts.map +1 -1
  191. package/build/lib/execute-method-map.js +9 -0
  192. package/build/lib/execute-method-map.js.map +1 -1
  193. package/lib/commands/active-app-info.js +12 -0
  194. package/lib/commands/alert.js +68 -65
  195. package/lib/commands/app-management.js +308 -301
  196. package/lib/commands/app-strings.js +24 -26
  197. package/lib/commands/appearance.js +54 -56
  198. package/lib/commands/audit.js +18 -20
  199. package/lib/commands/battery.js +35 -37
  200. package/lib/commands/biometric.js +44 -46
  201. package/lib/commands/certificate.js +226 -215
  202. package/lib/commands/clipboard.js +30 -32
  203. package/lib/commands/condition.js +98 -100
  204. package/lib/commands/content-size.js +36 -38
  205. package/lib/commands/context.js +495 -490
  206. package/lib/commands/deviceInfo.js +19 -20
  207. package/lib/commands/element.js +367 -357
  208. package/lib/commands/execute.js +72 -72
  209. package/lib/commands/file-movement.js +132 -134
  210. package/lib/commands/find.js +160 -159
  211. package/lib/commands/general.js +238 -231
  212. package/lib/commands/geolocation.js +6 -14
  213. package/lib/commands/gesture.js +525 -515
  214. package/lib/commands/increase-contrast.js +30 -32
  215. package/lib/commands/iohid.js +32 -34
  216. package/lib/commands/keyboard.js +49 -51
  217. package/lib/commands/keychains.js +12 -14
  218. package/lib/commands/localization.js +24 -26
  219. package/lib/commands/location.js +102 -104
  220. package/lib/commands/lock.js +38 -38
  221. package/lib/commands/log.js +197 -198
  222. package/lib/commands/memory.js +40 -42
  223. package/lib/commands/navigation.js +96 -100
  224. package/lib/commands/notifications.js +57 -59
  225. package/lib/commands/pasteboard.js +37 -39
  226. package/lib/commands/pcap.js +84 -86
  227. package/lib/commands/performance.js +132 -133
  228. package/lib/commands/permissions.js +67 -69
  229. package/lib/commands/proxy-helper.js +60 -61
  230. package/lib/commands/record-audio.js +115 -120
  231. package/lib/commands/recordscreen.js +145 -149
  232. package/lib/commands/screenshots.js +116 -116
  233. package/lib/commands/simctl.js +25 -29
  234. package/lib/commands/source.js +42 -46
  235. package/lib/commands/timeouts.js +59 -63
  236. package/lib/commands/web.js +932 -859
  237. package/lib/commands/xctest-record-screen.js +103 -105
  238. package/lib/commands/xctest.js +134 -139
  239. package/lib/driver.js +286 -235
  240. package/lib/execute-method-map.ts +9 -0
  241. package/npm-shrinkwrap.json +8 -8
  242. package/package.json +1 -1
  243. package/build/lib/commands/activeAppInfo.d.ts +0 -12
  244. package/build/lib/commands/activeAppInfo.d.ts.map +0 -1
  245. package/build/lib/commands/activeAppInfo.js +0 -15
  246. package/build/lib/commands/activeAppInfo.js.map +0 -1
  247. package/build/lib/commands/index.d.ts +0 -96
  248. package/build/lib/commands/index.d.ts.map +0 -1
  249. package/build/lib/commands/index.js +0 -100
  250. package/build/lib/commands/index.js.map +0 -1
  251. package/build/lib/cookies.d.ts +0 -15
  252. package/build/lib/cookies.d.ts.map +0 -1
  253. package/build/lib/cookies.js +0 -84
  254. package/build/lib/cookies.js.map +0 -1
  255. package/lib/commands/activeAppInfo.js +0 -14
  256. package/lib/commands/index.js +0 -95
  257. package/lib/cookies.js +0 -92
@@ -3,245 +3,261 @@ 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.active = active;
7
+ exports.touchId = touchId;
8
+ exports.toggleEnrollTouchId = toggleEnrollTouchId;
9
+ exports.getWindowSize = getWindowSize;
10
+ exports.getDeviceTime = getDeviceTime;
11
+ exports.mobileGetDeviceTime = mobileGetDeviceTime;
12
+ exports.getWindowRect = getWindowRect;
13
+ exports.removeApp = removeApp;
14
+ exports.launchApp = launchApp;
15
+ exports.closeApp = closeApp;
16
+ exports.setUrl = setUrl;
17
+ exports.getViewportRect = getViewportRect;
18
+ exports.getScreenInfo = getScreenInfo;
19
+ exports.getStatusBarHeight = getStatusBarHeight;
20
+ exports.getDevicePixelRatio = getDevicePixelRatio;
21
+ exports.mobilePressButton = mobilePressButton;
22
+ exports.mobileSiriCommand = mobileSiriCommand;
6
23
  const lodash_1 = __importDefault(require("lodash"));
7
24
  const driver_1 = require("appium/driver");
8
25
  const moment_timezone_1 = __importDefault(require("moment-timezone"));
9
26
  const appium_ios_device_1 = require("appium-ios-device");
10
27
  const teen_process_1 = require("teen_process");
11
28
  const MOMENT_FORMAT_ISO8601 = 'YYYY-MM-DDTHH:mm:ssZ';
12
- const commands = {
13
- /**
14
- * @this {XCUITestDriver}
15
- */
16
- async active() {
17
- if (this.isWebContext()) {
18
- return this.cacheWebElements(await this.executeAtom('active_element', []));
19
- }
20
- return await this.proxyCommand(`/element/active`, 'GET');
21
- },
22
- /**
23
- * Trigger a touch/fingerprint match or match failure
24
- *
25
- * @param {boolean} match - whether the match should be a success or failure
26
- * @this {XCUITestDriver}
27
- */
28
- async touchId(match = true) {
29
- await this.mobileSendBiometricMatch('touchId', match);
30
- },
31
- /**
32
- * Toggle whether the device is enrolled in the touch ID program
33
- *
34
- * @param {boolean} isEnabled - whether to enable or disable the touch ID program
35
- *
36
- * @this {XCUITestDriver}
37
- */
38
- async toggleEnrollTouchId(isEnabled = true) {
39
- await this.mobileEnrollBiometric(isEnabled);
40
- },
41
- /**
42
- * Get the window size
43
- * @this {XCUITestDriver}
44
- * @returns {Promise<import('@appium/types').Size>}
45
- */
46
- async getWindowSize() {
47
- const { width, height } = await this.getWindowRect();
48
- return { width, height };
49
- },
50
- /**
51
- * Retrieves the actual device time.
52
- *
53
- * @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.
54
- * @returns {Promise<string>} Formatted datetime string or the raw command output (if formatting fails)
55
- * @this {XCUITestDriver}
56
- */
57
- async getDeviceTime(format = MOMENT_FORMAT_ISO8601) {
58
- this.log.info('Attempting to capture iOS device date and time');
59
- if (!this.isRealDevice()) {
60
- this.log.info('On simulator. Assuming device time is the same as host time');
61
- const cmd = 'date';
62
- const args = ['+%Y-%m-%dT%H:%M:%S%z'];
63
- const inputFormat = 'YYYY-MM-DDTHH:mm:ssZZ';
64
- const stdout = (await (0, teen_process_1.exec)(cmd, args)).stdout.trim();
65
- this.log.debug(`Got the following output out of '${cmd} ${args.join(' ')}': ${stdout}`);
66
- const parsedTimestamp = moment_timezone_1.default.utc(stdout, inputFormat);
67
- if (!parsedTimestamp.isValid()) {
68
- this.log.warn(`Cannot parse the timestamp '${stdout}' returned by '${cmd}' command. Returning it as is`);
69
- return stdout;
70
- }
71
- // @ts-expect-error This internal prop of moment is evidently a private API
72
- return parsedTimestamp.utcOffset(parsedTimestamp._tzm || 0).format(format);
73
- }
74
- const { timestamp, utcOffset, timeZone } = await appium_ios_device_1.utilities.getDeviceTime(this.opts.udid);
75
- this.log.debug(`timestamp: ${timestamp}, utcOffset: ${utcOffset}, timeZone: ${timeZone}`);
76
- const utc = moment_timezone_1.default.unix(timestamp).utc();
77
- // at some point of time Apple started to return timestamps
78
- // in utcOffset instead of actual UTC offsets
79
- if (Math.abs(utcOffset) <= 12 * 60) {
80
- return utc.utcOffset(utcOffset).format(format);
81
- }
82
- // timeZone could either be a time zone name or
83
- // an UTC offset in seconds
84
- if (lodash_1.default.includes(timeZone, '/')) {
85
- return utc.tz(timeZone).format(format);
86
- }
87
- if (Math.abs(timeZone) <= 12 * 60 * 60) {
88
- return utc.utcOffset(timeZone / 60).format(format);
89
- }
90
- this.log.warn('Did not know how to apply the UTC offset. Returning the timestamp without it');
91
- return utc.format(format);
92
- },
93
- /**
94
- * Retrieves the current device time
95
- *
96
- * @param {string} format - See {@linkcode getDeviceTime.format}
97
- * @returns {Promise<string>} Formatted datetime string or the raw command output if formatting fails
98
- * @this {XCUITestDriver}
99
- */
100
- async mobileGetDeviceTime(format = MOMENT_FORMAT_ISO8601) {
101
- return await this.getDeviceTime(format);
102
- },
103
- /**
104
- * For W3C
105
- * @this {XCUITestDriver}
106
- * @return {Promise<import('@appium/types').Rect>}
107
- */
108
- async getWindowRect() {
109
- if (this.isWebContext()) {
110
- const script = 'return {' +
111
- 'x: window.screenX || 0,' +
112
- 'y: window.screenY || 0,' +
113
- 'width: window.innerWidth,' +
114
- 'height: window.innerHeight' +
115
- '}';
116
- return await this.executeAtom('execute_script', [script]);
117
- }
118
- return /** @type {import('@appium/types').Rect} */ (await this.proxyCommand('/window/rect', 'GET'));
119
- },
120
- /**
121
- * @this {XCUITestDriver}
122
- */
123
- async removeApp(bundleId) {
124
- return await this.mobileRemoveApp(bundleId);
125
- },
126
- /**
127
- * @this {XCUITestDriver}
128
- */
129
- async launchApp() {
130
- throw new Error(`The launchApp API has been deprecated and is not supported anymore. ` +
131
- `Consider using corresponding 'mobile:' extensions to manage the state of the app under test.`);
132
- },
133
- /**
134
- * @this {XCUITestDriver}
135
- */
136
- async closeApp() {
137
- throw new Error(`The closeApp API has been deprecated and is not supported anymore. ` +
138
- `Consider using corresponding 'mobile:' extensions to manage the state of the app under test.`);
139
- },
140
- /**
141
- * @this {XCUITestDriver}
142
- */
143
- async setUrl(url) {
144
- this.log.debug(`Attempting to set url '${url}'`);
145
- if (this.isWebContext()) {
146
- this.setCurrentUrl(url);
147
- // make sure to clear out any leftover web frames
148
- this.curWebFrames = [];
149
- await ( /** @type {import('appium-remote-debugger').RemoteDebugger} */(this.remote)).navToUrl(url);
150
- return;
151
- }
152
- if (this.isRealDevice()) {
153
- await this.proxyCommand('/url', 'POST', { url });
154
- }
155
- else {
156
- await /** @type {import('../driver').Simulator} */ (this.device).simctl.openUrl(url);
157
- }
158
- },
159
- /**
160
- * Retrieves the viewport dimensions.
161
- *
162
- * The viewport is the device's screen size with status bar size subtracted if the latter is present/visible.
163
- * @returns {Promise<import('./types').Viewport>}
164
- * @this {XCUITestDriver}
165
- */
166
- async getViewportRect() {
167
- const scale = await this.getDevicePixelRatio();
168
- // status bar height comes in unscaled, so scale it
169
- const statusBarHeight = Math.trunc((await this.getStatusBarHeight()) * scale);
170
- const windowSize = await this.getWindowRect();
171
- // ios returns coordinates/dimensions in logical pixels, not device pixels,
172
- // so scale up to device pixels. status bar height is already scaled.
173
- return {
174
- left: 0,
175
- top: statusBarHeight,
176
- width: Math.trunc(windowSize.width * scale),
177
- height: Math.trunc(windowSize.height * scale) - statusBarHeight,
178
- };
179
- },
180
- /**
181
- * Get information about the screen.
182
- *
183
- * @privateRemarks memoized in constructor
184
- * @this {XCUITestDriver}
185
- * @returns {Promise<ScreenInfo>}
186
- */
187
- async getScreenInfo() {
188
- return /** @type {ScreenInfo} */ (await this.proxyCommand('/wda/screen', 'GET'));
189
- },
190
- /**
191
- * @this {XCUITestDriver}
192
- */
193
- async getStatusBarHeight() {
194
- const { statusBarSize } = await this.getScreenInfo();
195
- return statusBarSize.height;
196
- },
197
- /**
198
- * memoized in constructor
199
- * @this {XCUITestDriver}
200
- */
201
- async getDevicePixelRatio() {
202
- const { scale } = await this.getScreenInfo();
203
- return scale;
204
- },
205
- /**
206
- * Emulates press action on the given physical device button.
207
- *
208
- * This executes different methods based on the platform:
209
- *
210
- * - iOS: [`pressButton:`](https://developer.apple.com/documentation/xctest/xcuidevice/1619052-pressbutton)
211
- * - tvOS: [`pressButton:`](https://developer.apple.com/documentation/xctest/xcuiremote/1627475-pressbutton) or [`pressButton:forDuration:`](https://developer.apple.com/documentation/xctest/xcuiremote/1627476-pressbutton)
212
- *
213
- * Use {@linkcode mobilePerformIoHidEvent} to call a more universal API to perform a button press with duration on any supported device.
214
- *
215
- * @param {import('./types').ButtonName} name - The name of the button to be pressed.
216
- * @param {number} [durationSeconds] - The duration of the button press in seconds (float).
217
- * @this {XCUITestDriver}
218
- */
219
- async mobilePressButton(name, durationSeconds) {
220
- if (!name) {
221
- throw new driver_1.errors.InvalidArgumentError('Button name is mandatory');
222
- }
223
- if (!lodash_1.default.isNil(durationSeconds) && !lodash_1.default.isNumber(durationSeconds)) {
224
- throw new driver_1.errors.InvalidArgumentError('durationSeconds should be a number');
225
- }
226
- return await this.proxyCommand('/wda/pressButton', 'POST', { name, duration: durationSeconds });
227
- },
228
- /**
229
- * Process a string as speech and send it to Siri.
230
- *
231
- * 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.
232
-
233
- * @param {string} text - Text to be sent to Siri
234
- * @returns {Promise<void>}
235
- * @this {XCUITestDriver}
236
- */
237
- async mobileSiriCommand(text) {
238
- if (!text) {
239
- throw new driver_1.errors.InvalidArgumentError('"text" argument is mandatory');
29
+ /**
30
+ * @this {XCUITestDriver}
31
+ */
32
+ async function active() {
33
+ if (this.isWebContext()) {
34
+ return this.cacheWebElements(await this.executeAtom('active_element', []));
35
+ }
36
+ return await this.proxyCommand(`/element/active`, 'GET');
37
+ }
38
+ /**
39
+ * Trigger a touch/fingerprint match or match failure
40
+ *
41
+ * @param {boolean} match - whether the match should be a success or failure
42
+ * @this {XCUITestDriver}
43
+ */
44
+ async function touchId(match = true) {
45
+ await this.mobileSendBiometricMatch('touchId', match);
46
+ }
47
+ /**
48
+ * Toggle whether the device is enrolled in the touch ID program
49
+ *
50
+ * @param {boolean} isEnabled - whether to enable or disable the touch ID program
51
+ *
52
+ * @this {XCUITestDriver}
53
+ */
54
+ async function toggleEnrollTouchId(isEnabled = true) {
55
+ await this.mobileEnrollBiometric(isEnabled);
56
+ }
57
+ /**
58
+ * Get the window size
59
+ * @this {XCUITestDriver}
60
+ * @returns {Promise<import('@appium/types').Size>}
61
+ */
62
+ async function getWindowSize() {
63
+ const { width, height } = await this.getWindowRect();
64
+ return { width, height };
65
+ }
66
+ /**
67
+ * Retrieves the actual device time.
68
+ *
69
+ * @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.
70
+ * @returns {Promise<string>} Formatted datetime string or the raw command output (if formatting fails)
71
+ * @this {XCUITestDriver}
72
+ */
73
+ async function getDeviceTime(format = MOMENT_FORMAT_ISO8601) {
74
+ this.log.info('Attempting to capture iOS device date and time');
75
+ if (!this.isRealDevice()) {
76
+ this.log.info('On simulator. Assuming device time is the same as host time');
77
+ const cmd = 'date';
78
+ const args = ['+%Y-%m-%dT%H:%M:%S%z'];
79
+ const inputFormat = 'YYYY-MM-DDTHH:mm:ssZZ';
80
+ const stdout = (await (0, teen_process_1.exec)(cmd, args)).stdout.trim();
81
+ this.log.debug(`Got the following output out of '${cmd} ${args.join(' ')}': ${stdout}`);
82
+ const parsedTimestamp = moment_timezone_1.default.utc(stdout, inputFormat);
83
+ if (!parsedTimestamp.isValid()) {
84
+ this.log.warn(`Cannot parse the timestamp '${stdout}' returned by '${cmd}' command. Returning it as is`);
85
+ return stdout;
240
86
  }
241
- await this.proxyCommand('/wda/siri/activate', 'POST', { text });
242
- },
243
- };
244
- exports.default = commands;
87
+ // @ts-expect-error This internal prop of moment is evidently a private API
88
+ return parsedTimestamp.utcOffset(parsedTimestamp._tzm || 0).format(format);
89
+ }
90
+ const { timestamp, utcOffset, timeZone } = await appium_ios_device_1.utilities.getDeviceTime(this.opts.udid);
91
+ this.log.debug(`timestamp: ${timestamp}, utcOffset: ${utcOffset}, timeZone: ${timeZone}`);
92
+ const utc = moment_timezone_1.default.unix(timestamp).utc();
93
+ // at some point of time Apple started to return timestamps
94
+ // in utcOffset instead of actual UTC offsets
95
+ if (Math.abs(utcOffset) <= 12 * 60) {
96
+ return utc.utcOffset(utcOffset).format(format);
97
+ }
98
+ // timeZone could either be a time zone name or
99
+ // an UTC offset in seconds
100
+ if (lodash_1.default.includes(timeZone, '/')) {
101
+ return utc.tz(timeZone).format(format);
102
+ }
103
+ if (Math.abs(timeZone) <= 12 * 60 * 60) {
104
+ return utc.utcOffset(timeZone / 60).format(format);
105
+ }
106
+ this.log.warn('Did not know how to apply the UTC offset. Returning the timestamp without it');
107
+ return utc.format(format);
108
+ }
109
+ /**
110
+ * Retrieves the current device time
111
+ *
112
+ * @param {string} format - See {@linkcode getDeviceTime.format}
113
+ * @returns {Promise<string>} Formatted datetime string or the raw command output if formatting fails
114
+ * @this {XCUITestDriver}
115
+ */
116
+ async function mobileGetDeviceTime(format = MOMENT_FORMAT_ISO8601) {
117
+ return await this.getDeviceTime(format);
118
+ }
119
+ /**
120
+ * For W3C
121
+ * @this {XCUITestDriver}
122
+ * @return {Promise<import('@appium/types').Rect>}
123
+ */
124
+ async function getWindowRect() {
125
+ if (this.isWebContext()) {
126
+ const script = 'return {' +
127
+ 'x: window.screenX || 0,' +
128
+ 'y: window.screenY || 0,' +
129
+ 'width: window.innerWidth,' +
130
+ 'height: window.innerHeight' +
131
+ '}';
132
+ return await this.executeAtom('execute_script', [script]);
133
+ }
134
+ return /** @type {import('@appium/types').Rect} */ (await this.proxyCommand('/window/rect', 'GET'));
135
+ }
136
+ /**
137
+ * @this {XCUITestDriver}
138
+ */
139
+ async function removeApp(bundleId) {
140
+ return await this.mobileRemoveApp(bundleId);
141
+ }
142
+ /**
143
+ * @this {XCUITestDriver}
144
+ */
145
+ async function launchApp() {
146
+ throw new Error(`The launchApp API has been deprecated and is not supported anymore. ` +
147
+ `Consider using corresponding 'mobile:' extensions to manage the state of the app under test.`);
148
+ }
149
+ /**
150
+ * @this {XCUITestDriver}
151
+ */
152
+ async function closeApp() {
153
+ throw new Error(`The closeApp API has been deprecated and is not supported anymore. ` +
154
+ `Consider using corresponding 'mobile:' extensions to manage the state of the app under test.`);
155
+ }
156
+ /**
157
+ * @this {XCUITestDriver}
158
+ * @param {string} url
159
+ * @returns {Promise<void>}
160
+ */
161
+ async function setUrl(url) {
162
+ this.log.debug(`Attempting to set url '${url}'`);
163
+ if (this.isWebContext()) {
164
+ this.setCurrentUrl(url);
165
+ // make sure to clear out any leftover web frames
166
+ this.curWebFrames = [];
167
+ await ( /** @type {import('appium-remote-debugger').RemoteDebugger} */(this.remote)).navToUrl(url);
168
+ return;
169
+ }
170
+ if (this.isRealDevice()) {
171
+ await this.proxyCommand('/url', 'POST', { url });
172
+ }
173
+ else {
174
+ await /** @type {import('../driver').Simulator} */ (this.device).simctl.openUrl(url);
175
+ }
176
+ }
177
+ /**
178
+ * Retrieves the viewport dimensions.
179
+ *
180
+ * The viewport is the device's screen size with status bar size subtracted if the latter is present/visible.
181
+ * @returns {Promise<import('./types').Viewport>}
182
+ * @this {XCUITestDriver}
183
+ */
184
+ async function getViewportRect() {
185
+ const scale = await this.getDevicePixelRatio();
186
+ // status bar height comes in unscaled, so scale it
187
+ const statusBarHeight = Math.trunc((await this.getStatusBarHeight()) * scale);
188
+ const windowSize = await this.getWindowRect();
189
+ // ios returns coordinates/dimensions in logical pixels, not device pixels,
190
+ // so scale up to device pixels. status bar height is already scaled.
191
+ return {
192
+ left: 0,
193
+ top: statusBarHeight,
194
+ width: Math.trunc(windowSize.width * scale),
195
+ height: Math.trunc(windowSize.height * scale) - statusBarHeight,
196
+ };
197
+ }
198
+ /**
199
+ * Get information about the screen.
200
+ *
201
+ * @privateRemarks memoized in constructor
202
+ * @this {XCUITestDriver}
203
+ * @returns {Promise<ScreenInfo>}
204
+ */
205
+ async function getScreenInfo() {
206
+ return /** @type {ScreenInfo} */ (await this.proxyCommand('/wda/screen', 'GET'));
207
+ }
208
+ /**
209
+ * @this {XCUITestDriver}
210
+ */
211
+ async function getStatusBarHeight() {
212
+ const { statusBarSize } = await this.getScreenInfo();
213
+ return statusBarSize.height;
214
+ }
215
+ /**
216
+ * memoized in constructor
217
+ * @this {XCUITestDriver}
218
+ */
219
+ async function getDevicePixelRatio() {
220
+ const { scale } = await this.getScreenInfo();
221
+ return scale;
222
+ }
223
+ /**
224
+ * Emulates press action on the given physical device button.
225
+ *
226
+ * This executes different methods based on the platform:
227
+ *
228
+ * - iOS: [`pressButton:`](https://developer.apple.com/documentation/xctest/xcuidevice/1619052-pressbutton)
229
+ * - tvOS: [`pressButton:`](https://developer.apple.com/documentation/xctest/xcuiremote/1627475-pressbutton) or [`pressButton:forDuration:`](https://developer.apple.com/documentation/xctest/xcuiremote/1627476-pressbutton)
230
+ *
231
+ * Use {@linkcode mobilePerformIoHidEvent} to call a more universal API to perform a button press with duration on any supported device.
232
+ *
233
+ * @param {import('./types').ButtonName} name - The name of the button to be pressed.
234
+ * @param {number} [durationSeconds] - The duration of the button press in seconds (float).
235
+ * @this {XCUITestDriver}
236
+ */
237
+ async function mobilePressButton(name, durationSeconds) {
238
+ if (!name) {
239
+ throw new driver_1.errors.InvalidArgumentError('Button name is mandatory');
240
+ }
241
+ if (!lodash_1.default.isNil(durationSeconds) && !lodash_1.default.isNumber(durationSeconds)) {
242
+ throw new driver_1.errors.InvalidArgumentError('durationSeconds should be a number');
243
+ }
244
+ return await this.proxyCommand('/wda/pressButton', 'POST', { name, duration: durationSeconds });
245
+ }
246
+ /**
247
+ * Process a string as speech and send it to Siri.
248
+ *
249
+ * 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.
250
+
251
+ * @param {string} text - Text to be sent to Siri
252
+ * @returns {Promise<void>}
253
+ * @this {XCUITestDriver}
254
+ */
255
+ async function mobileSiriCommand(text) {
256
+ if (!text) {
257
+ throw new driver_1.errors.InvalidArgumentError('"text" argument is mandatory');
258
+ }
259
+ await this.proxyCommand('/wda/siri/activate', 'POST', { text });
260
+ }
245
261
  /**
246
262
  * @typedef {Object} PressButtonOptions
247
263
  * @property {string} name - The name of the button to be pressed.
@@ -1 +1 @@
1
- {"version":3,"file":"general.js","sourceRoot":"","sources":["../../../lib/commands/general.js"],"names":[],"mappings":";;;;;AAAA,oDAAuB;AACvB,0CAAqC;AACrC,sEAAqC;AACrC,yDAA4C;AAC5C,+CAAkC;AAElC,MAAM,qBAAqB,GAAG,sBAAsB,CAAC;AAErD,MAAM,QAAQ,GAAG;IACf;;OAEG;IACH,KAAK,CAAC,MAAM;QACV,IAAI,IAAI,CAAC,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CAAC;IACD,IAAI,CAAC,gBAAC,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,gBAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;QAC9D,MAAM,IAAI,eAAM,CAAC,oBAAoB,CAAC,oCAAoC,CAAC,CAAC;IAC9E,CAAC;IACD,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,eAAe,EAAC,CAAC,CAAC;AAChG,CAAC;AAED;;;;;;;;GAQG;AACI,KAAK,UAAU,iBAAiB,CAAC,IAAI;IAC1C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,eAAM,CAAC,oBAAoB,CAAC,8BAA8B,CAAC,CAAC;IACxE,CAAC;IACD,MAAM,IAAI,CAAC,YAAY,CAAC,oBAAoB,EAAE,MAAM,EAAE,EAAC,IAAI,EAAC,CAAC,CAAC;AAChE,CAAC;AAED;;;;GAIG;AAEH;;;GAGG"}
@@ -1,4 +1,46 @@
1
- export default commands;
1
+ /**
2
+ * @typedef {Object} GeolocationInfo
3
+ * @property {number|null} latitude Measurement of distance north or south of the Equator, or
4
+ * `null` if {@linkcode XCUITestDriver.mobileSetSimulatedLocation} has not been called or {@linkcode
5
+ * resetSimulatedLocation} has been called.
6
+ * @property {number|null} longitude Measurement of distance east or west of the prime meridian, or
7
+ * `null` if {@linkcode XCUITestDriver.mobileSetSimulatedLocation} has not been called or {@linkcode
8
+ * resetSimulatedLocation} has been called.
9
+ */
10
+ /**
11
+ * Retrieves the simulated geolocation value.
12
+ * Only works since Xcode 14.3/iOS 16.4
13
+ *
14
+ * @returns {Promise<GeolocationInfo>}
15
+ * @throws {Error} If the device under test does not support gelolocation simulation.
16
+ * @since 4.18
17
+ * @this {XCUITestDriver}
18
+ */
19
+ export function mobileGetSimulatedLocation(this: import("../driver").XCUITestDriver): Promise<GeolocationInfo>;
20
+ /**
21
+ * Sets simulated geolocation value.
22
+ * Only works since Xcode 14.3/iOS 16.4
23
+ *
24
+ * @param {number} latitude
25
+ * @param {number} longitude
26
+ * @returns {Promise<void>}
27
+ * @throws {Error} If the device under test does not support gelolocation simulation.
28
+ * @since 4.18
29
+ * @this {XCUITestDriver}
30
+ */
31
+ export function mobileSetSimulatedLocation(this: import("../driver").XCUITestDriver, latitude: number, longitude: number): Promise<void>;
32
+ /**
33
+ * Resets simulated geolocation value.
34
+ * Only works since Xcode 14.3/iOS 16.4.
35
+ * ! Do not forget to reset the simulated geolocation value after your automated test is finished.
36
+ * ! If the value is not reset explicitly then the simulated one will remain until the next device restart.
37
+ *
38
+ * @returns {Promise<void>}
39
+ * @throws {Error} If the device under test does not support gelolocation simulation.
40
+ * @since 4.18
41
+ * @this {XCUITestDriver}
42
+ */
43
+ export function mobileResetSimulatedLocation(this: import("../driver").XCUITestDriver): Promise<void>;
2
44
  export type GeolocationInfo = {
3
45
  /**
4
46
  * Measurement of distance north or south of the Equator, or
@@ -12,49 +54,4 @@ export type GeolocationInfo = {
12
54
  longitude: number | null;
13
55
  };
14
56
  export type XCUITestDriver = import("../driver").XCUITestDriver;
15
- export namespace commands {
16
- /**
17
- * @typedef {Object} GeolocationInfo
18
- * @property {number|null} latitude Measurement of distance north or south of the Equator, or
19
- * `null` if {@linkcode XCUITestDriver.mobileSetSimulatedLocation} has not been called or {@linkcode
20
- * resetSimulatedLocation} has been called.
21
- * @property {number|null} longitude Measurement of distance east or west of the prime meridian, or
22
- * `null` if {@linkcode XCUITestDriver.mobileSetSimulatedLocation} has not been called or {@linkcode
23
- * resetSimulatedLocation} has been called.
24
- */
25
- /**
26
- * Retrieves the simulated geolocation value.
27
- * Only works since Xcode 14.3/iOS 16.4
28
- *
29
- * @returns {Promise<GeolocationInfo>}
30
- * @throws {Error} If the device under test does not support gelolocation simulation.
31
- * @since 4.18
32
- * @this {XCUITestDriver}
33
- */
34
- function mobileGetSimulatedLocation(this: import("../driver").XCUITestDriver): Promise<GeolocationInfo>;
35
- /**
36
- * Sets simulated geolocation value.
37
- * Only works since Xcode 14.3/iOS 16.4
38
- *
39
- * @param {number} latitude
40
- * @param {number} longitude
41
- * @returns {Promise<void>}
42
- * @throws {Error} If the device under test does not support gelolocation simulation.
43
- * @since 4.18
44
- * @this {XCUITestDriver}
45
- */
46
- function mobileSetSimulatedLocation(this: import("../driver").XCUITestDriver, latitude: number, longitude: number): Promise<void>;
47
- /**
48
- * Resets simulated geolocation value.
49
- * Only works since Xcode 14.3/iOS 16.4.
50
- * ! Do not forget to reset the simulated geolocation value after your automated test is finished.
51
- * ! If the value is not reset explicitly then the simulated one will remain until the next device restart.
52
- *
53
- * @returns {Promise<void>}
54
- * @throws {Error} If the device under test does not support gelolocation simulation.
55
- * @since 4.18
56
- * @this {XCUITestDriver}
57
- */
58
- function mobileResetSimulatedLocation(this: import("../driver").XCUITestDriver): Promise<void>;
59
- }
60
57
  //# sourceMappingURL=geolocation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"geolocation.d.ts","sourceRoot":"","sources":["../../../lib/commands/geolocation.js"],"names":[],"mappings":";;;;;;cAIc,MAAM,GAAC,IAAI;;;;;eAGX,MAAM,GAAC,IAAI;;6BAuDZ,OAAO,WAAW,EAAE,cAAc;;IA5D/C;;;;;;;;OAQG;IAEH;;;;;;;;OAQG;IACH,+EALa,OAAO,CAAC,eAAe,CAAC,CAOpC;IAED;;;;;;;;;;OAUG;IACH,wFAPW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAUzB;IAED;;;;;;;;;;OAUG;IACH,iFALa,OAAO,CAAC,IAAI,CAAC,CAOzB"}
1
+ {"version":3,"file":"geolocation.d.ts","sourceRoot":"","sources":["../../../lib/commands/geolocation.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;GAQG;AACH,sFALa,OAAO,CAAC,eAAe,CAAC,CAOpC;AAED;;;;;;;;;;GAUG;AACH,+FAPW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAOzB;AAED;;;;;;;;;;GAUG;AACH,wFALa,OAAO,CAAC,IAAI,CAAC,CAOzB;;;;;;cAjDa,MAAM,GAAC,IAAI;;;;;eAGX,MAAM,GAAC,IAAI;;6BAiDZ,OAAO,WAAW,EAAE,cAAc"}