appium-xcuitest-driver 10.14.3 → 10.14.4

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 (37) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/lib/commands/biometric.d.ts +12 -14
  3. package/build/lib/commands/biometric.d.ts.map +1 -1
  4. package/build/lib/commands/biometric.js +10 -19
  5. package/build/lib/commands/biometric.js.map +1 -1
  6. package/build/lib/commands/content-size.d.ts +16 -19
  7. package/build/lib/commands/content-size.d.ts.map +1 -1
  8. package/build/lib/commands/content-size.js +14 -22
  9. package/build/lib/commands/content-size.js.map +1 -1
  10. package/build/lib/commands/geolocation.d.ts +16 -36
  11. package/build/lib/commands/geolocation.d.ts.map +1 -1
  12. package/build/lib/commands/geolocation.js +8 -25
  13. package/build/lib/commands/geolocation.js.map +1 -1
  14. package/build/lib/commands/iohid.d.ts +6 -1359
  15. package/build/lib/commands/iohid.d.ts.map +1 -1
  16. package/build/lib/commands/iohid.js +5 -10
  17. package/build/lib/commands/iohid.js.map +1 -1
  18. package/build/lib/commands/keyboard.d.ts +16 -13
  19. package/build/lib/commands/keyboard.d.ts.map +1 -1
  20. package/build/lib/commands/keyboard.js +14 -18
  21. package/build/lib/commands/keyboard.js.map +1 -1
  22. package/build/lib/commands/notifications.d.ts +10 -10
  23. package/build/lib/commands/notifications.d.ts.map +1 -1
  24. package/build/lib/commands/notifications.js +8 -12
  25. package/build/lib/commands/notifications.js.map +1 -1
  26. package/lib/commands/biometric.ts +52 -0
  27. package/lib/commands/content-size.ts +67 -0
  28. package/lib/commands/geolocation.ts +55 -0
  29. package/lib/commands/{iohid.js → iohid.ts} +15 -13
  30. package/lib/commands/keyboard.ts +70 -0
  31. package/lib/commands/{notifications.js → notifications.ts} +22 -14
  32. package/npm-shrinkwrap.json +2 -2
  33. package/package.json +1 -1
  34. package/lib/commands/biometric.js +0 -52
  35. package/lib/commands/content-size.js +0 -68
  36. package/lib/commands/geolocation.js +0 -56
  37. package/lib/commands/keyboard.js +0 -62
@@ -1,5 +1,8 @@
1
1
  import {errors} from 'appium/driver';
2
2
  import _ from 'lodash';
3
+ import type {XCUITestDriver} from '../driver';
4
+ import type {PushPayload, NotificationType} from './types';
5
+ import type {Simulator} from 'appium-ios-simulator';
3
6
 
4
7
  /**
5
8
  * Simulates push notification delivery to a simulated device.
@@ -7,12 +10,16 @@ import _ from 'lodash';
7
10
  * **Only "remote" push notifications are supported.** VoIP, Complication, File Provider, and other types are unsupported.
8
11
  *
9
12
  * Supported in Xcode SDK 11.4+.
10
- * @param {string} bundleId - The bundle identifier of the target application
11
- * @param {import('./types').PushPayload} payload - Valid push payload.
13
+ *
14
+ * @param bundleId - The bundle identifier of the target application
15
+ * @param payload - Valid push payload.
12
16
  * @group Simulator Only
13
- * @this {XCUITestDriver}
14
17
  */
15
- export async function mobilePushNotification(bundleId, payload) {
18
+ export async function mobilePushNotification(
19
+ this: XCUITestDriver,
20
+ bundleId: string,
21
+ payload: PushPayload,
22
+ ): Promise<void> {
16
23
  if (!this.isSimulator()) {
17
24
  throw new Error('This extension only works on Simulator');
18
25
  }
@@ -34,7 +41,7 @@ export async function mobilePushNotification(bundleId, payload) {
34
41
  `Got ${JSON.stringify(payload.aps)} instead`,
35
42
  );
36
43
  }
37
- return await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).pushNotification({
44
+ await (this.device as Simulator).pushNotification({
38
45
  ...payload,
39
46
  'Simulator Target Bundle': bundleId,
40
47
  });
@@ -47,20 +54,21 @@ export async function mobilePushNotification(bundleId, payload) {
47
54
  * [`XCTNSNotificationExpectation`](https://developer.apple.com/documentation/xctest/xctnsnotificationexpectation?language=objc) and
48
55
  * [`XCTDarwinNotificationExpectation`](https://developer.apple.com/documentation/xctest/xctdarwinnotificationexpectation?language=objc) entities.
49
56
  *
50
- * @param {string} name - The name of the notification to expect
51
- * @param {import('./types').NotificationType} type - Which notification type to expect.
52
- * @param {number} timeoutSeconds - For how long to wait until the notification is delivered (in float seconds).
57
+ * @param name - The name of the notification to expect
58
+ * @param type - Which notification type to expect.
59
+ * @param timeoutSeconds - For how long to wait until the notification is delivered (in float seconds).
53
60
  * @throws A [`TimeoutError`](https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/lib/error_exports_TimeoutError.html) if the expected notification has not been delivered within the given timeout.
54
- * @this {XCUITestDriver}
55
61
  */
56
- export async function mobileExpectNotification(name, type = 'plain', timeoutSeconds = 60) {
57
- return await this.proxyCommand('/wda/expectNotification', 'POST', {
62
+ export async function mobileExpectNotification(
63
+ this: XCUITestDriver,
64
+ name: string,
65
+ type: NotificationType = 'plain',
66
+ timeoutSeconds: number = 60,
67
+ ): Promise<void> {
68
+ await this.proxyCommand('/wda/expectNotification', 'POST', {
58
69
  name,
59
70
  type,
60
71
  timeout: timeoutSeconds,
61
72
  });
62
73
  }
63
74
 
64
- /**
65
- * @typedef {import('../driver').XCUITestDriver} XCUITestDriver
66
- */
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "appium-xcuitest-driver",
3
- "version": "10.14.3",
3
+ "version": "10.14.4",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "appium-xcuitest-driver",
9
- "version": "10.14.3",
9
+ "version": "10.14.4",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@appium/strongbox": "^1.0.0-rc.1",
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "xcuitest",
9
9
  "xctest"
10
10
  ],
11
- "version": "10.14.3",
11
+ "version": "10.14.4",
12
12
  "author": "Appium Contributors",
13
13
  "license": "Apache-2.0",
14
14
  "repository": {
@@ -1,52 +0,0 @@
1
- import {assertSimulator as _assertSimulator} from '../utils';
2
-
3
- const assertSimulator = (driver) => _assertSimulator.call(driver, 'Biometric enrollment');
4
-
5
- /**
6
- * Enrolls biometric authentication on a simulated device.
7
- *
8
- * @param {boolean} isEnabled - Whether to enable/disable biometric enrollment.
9
- * @throws {Error} If enrollment fails or the device is not a Simulator.
10
- * @group Simulator Only
11
- * @this {XCUITestDriver}
12
- */
13
- export async function mobileEnrollBiometric(isEnabled = true) {
14
- assertSimulator(this);
15
-
16
- await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).enrollBiometric(isEnabled);
17
- }
18
-
19
- /**
20
- * Emulates biometric match or non-match event on a simulated device.
21
- *
22
- * The biometric feature is expected to be already enrolled via {@linkcode mobileEnrollBiometric|mobile: enrollBiometric} before executing this.
23
- *
24
- * @param {import('./types').BiometricFeature} type - The biometric feature name.
25
- * @param {boolean} match - If `true`, simulate biometic match. If `false`, simulate biometric non-match.
26
- * @throws {Error} If matching fails or the device is not a Simulator.
27
- * @group Simulator Only
28
- * @this {XCUITestDriver}
29
- */
30
- export async function mobileSendBiometricMatch(type = 'touchId', match = true) {
31
- assertSimulator(this);
32
-
33
- await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).sendBiometricMatch(match, type);
34
- }
35
-
36
- /**
37
- * Checks whether the biometric feature is currently enrolled on a simulated device.
38
- *
39
- * @returns {Promise<boolean>} `true` if biometric is enrolled.
40
- * @throws {Error} If the detection fails or the device is not a Simulator.
41
- * @group Simulator Only
42
- * @this {XCUITestDriver}
43
- */
44
- export async function mobileIsBiometricEnrolled() {
45
- assertSimulator(this);
46
-
47
- return await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).isBiometricEnrolled();
48
- }
49
-
50
- /**
51
- * @typedef {import('../driver').XCUITestDriver} XCUITestDriver
52
- */
@@ -1,68 +0,0 @@
1
- import _ from 'lodash';
2
- import {assertSimulator as _assertSimulator} from '../utils';
3
- import { errors } from 'appium/driver';
4
-
5
- const assertSimulator = (driver) => _assertSimulator.call(driver, 'Content size ui command');
6
-
7
- const CONTENT_SIZE = [
8
- 'extra-small',
9
- 'small',
10
- 'medium',
11
- 'large',
12
- 'extra-large',
13
- 'extra-extra-large',
14
- 'extra-extra-extra-large',
15
- 'accessibility-medium',
16
- 'accessibility-large',
17
- 'accessibility-extra-large',
18
- 'accessibility-extra-extra-large',
19
- 'accessibility-extra-extra-extra-large',
20
- 'increment',
21
- 'decrement'
22
- ];
23
-
24
- /**
25
- * Sets content size for the given simulator.
26
- *
27
- * @since Xcode 15 (but lower xcode could have this command)
28
- * @param {ContentSizeAction} size - The content size action to set. Acceptable value is
29
- * extra-small, small, medium, large, extra-large, extra-extra-large,
30
- * extra-extra-extra-large, accessibility-medium, accessibility-large,
31
- * accessibility-extra-large, accessibility-extra-extra-large,
32
- * accessibility-extra-extra-extra-large with Xcode 16.2.
33
- * @throws {Error} if the current platform does not support content size appearance changes
34
- * @this {XCUITestDriver}
35
- */
36
- export async function mobileSetContentSize(size) {
37
- const simulator = assertSimulator(this);
38
-
39
- if (!CONTENT_SIZE.includes(_.lowerCase(size))) {
40
- throw new errors.InvalidArgumentError(
41
- `The 'size' value is expected to be one of ${CONTENT_SIZE.join(',')}`
42
- );
43
- }
44
-
45
- await simulator.setContentSize(size);
46
- }
47
-
48
- /**
49
- * Retrieves the current content size value from the given simulator.
50
- *
51
- * @since Xcode 15 (but lower xcode could have this command)
52
- * @returns {Promise<ContentSizeResult>} the content size value. Possible return value is
53
- * extra-small, small, medium, large, extra-large, extra-extra-large,
54
- * extra-extra-extra-large, accessibility-medium, accessibility-large,
55
- * accessibility-extra-large, accessibility-extra-extra-large,
56
- * accessibility-extra-extra-extra-large,
57
- * unknown or unsupported with Xcode 16.2.
58
- * @this {XCUITestDriver}
59
- */
60
- export async function mobileGetContentSize() {
61
- return /** @type {ContentSizeResult} */ (await assertSimulator(this).getContentSize());
62
- }
63
-
64
- /**
65
- * @typedef {import('../driver').XCUITestDriver} XCUITestDriver
66
- * @typedef {import('./types').ContentSizeAction} ContentSizeAction
67
- * @typedef {import('./types').ContentSizeResult} ContentSizeResult
68
- */
@@ -1,56 +0,0 @@
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
- /**
12
- * Retrieves the simulated geolocation value.
13
- * Only works since Xcode 14.3/iOS 16.4
14
- *
15
- * @returns {Promise<GeolocationInfo>}
16
- * @throws {Error} If the device under test does not support gelolocation simulation.
17
- * @since 4.18
18
- * @this {XCUITestDriver}
19
- */
20
- export async function mobileGetSimulatedLocation() {
21
- return await this.proxyCommand('/wda/simulatedLocation', 'GET');
22
- }
23
-
24
- /**
25
- * Sets simulated geolocation value.
26
- * Only works since Xcode 14.3/iOS 16.4
27
- *
28
- * @param {number} latitude
29
- * @param {number} longitude
30
- * @returns {Promise<void>}
31
- * @throws {Error} If the device under test does not support gelolocation simulation.
32
- * @since 4.18
33
- * @this {XCUITestDriver}
34
- */
35
- export async function mobileSetSimulatedLocation(latitude, longitude) {
36
- return await this.proxyCommand('/wda/simulatedLocation', 'POST', {latitude, longitude});
37
- }
38
-
39
- /**
40
- * Resets simulated geolocation value.
41
- * Only works since Xcode 14.3/iOS 16.4.
42
- * ! Do not forget to reset the simulated geolocation value after your automated test is finished.
43
- * ! If the value is not reset explicitly then the simulated one will remain until the next device restart.
44
- *
45
- * @returns {Promise<void>}
46
- * @throws {Error} If the device under test does not support gelolocation simulation.
47
- * @since 4.18
48
- * @this {XCUITestDriver}
49
- */
50
- export async function mobileResetSimulatedLocation() {
51
- return await this.proxyCommand('/wda/simulatedLocation', 'DELETE');
52
- }
53
-
54
- /**
55
- * @typedef {import('../driver').XCUITestDriver} XCUITestDriver
56
- */
@@ -1,62 +0,0 @@
1
- import _ from 'lodash';
2
-
3
- /**
4
- * @this {XCUITestDriver}
5
- * @deprecated
6
- */
7
- export async function hideKeyboard(strategy, ...possibleKeys) {
8
- // last parameter is the session id
9
- const keyNames = _.compact(possibleKeys.slice(0, -1)).map((x) => `${x}`);
10
- await this.mobileHideKeyboard(keyNames);
11
- return true;
12
- }
13
-
14
- /**
15
- * @this {XCUITestDriver}
16
- * @param {string[]} keys
17
- */
18
- export async function mobileHideKeyboard(keys = []) {
19
- if (!keys.includes('done')) {
20
- keys.push('done');
21
- }
22
- await this.proxyCommand('/wda/keyboard/dismiss', 'POST', {keyNames: keys});
23
- }
24
-
25
- /**
26
- * @this {XCUITestDriver}
27
- */
28
- export async function isKeyboardShown() {
29
- try {
30
- await this.findNativeElementOrElements('class name', 'XCUIElementTypeKeyboard', false);
31
- return true;
32
- } catch {
33
- return false;
34
- }
35
- }
36
-
37
- /**
38
- * Send keys to the given element or to the application under test.
39
- * This API is not supported on tvOS
40
- *
41
- * @since Xcode 15/iOS 17
42
- * @this {import('../driver').XCUITestDriver}
43
- * @param {(Key|string)[]} keys Array of keys to type.
44
- * Each item could either be a string, that represents a key itself (see
45
- * https://developer.apple.com/documentation/xctest/xcuielement/1500604-typekey?language=objc
46
- * and https://developer.apple.com/documentation/xctest/xcuikeyboardkey?language=objc)
47
- * or a dictionary, if the key should also be entered with modifiers.
48
- * @param {string?} [elementId=null] uuid of the element to send keys to.
49
- * If the element is not provided then the keys will be sent to the current application.
50
- */
51
- export async function mobileKeys(keys, elementId = null) {
52
- const url = `/wda/element/${elementId || 0}/keyboardInput`;
53
- return await this.proxyCommand(url, 'POST', { keys });
54
- }
55
-
56
- /**
57
- * @typedef {import('../driver').XCUITestDriver} XCUITestDriver
58
- */
59
-
60
- /**
61
- * @typedef {import('./types').KeyboardKey} Key
62
- */