appium-xcuitest-driver 10.14.2 → 10.14.3

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/alert.d.ts +26 -31
  3. package/build/lib/commands/alert.d.ts.map +1 -1
  4. package/build/lib/commands/alert.js +20 -29
  5. package/build/lib/commands/alert.js.map +1 -1
  6. package/build/lib/commands/appearance.d.ts +7 -9
  7. package/build/lib/commands/appearance.d.ts.map +1 -1
  8. package/build/lib/commands/appearance.js +13 -19
  9. package/build/lib/commands/appearance.js.map +1 -1
  10. package/build/lib/commands/permissions.d.ts +15 -17
  11. package/build/lib/commands/permissions.d.ts.map +1 -1
  12. package/build/lib/commands/permissions.js +12 -18
  13. package/build/lib/commands/permissions.js.map +1 -1
  14. package/build/lib/commands/proxy-helper.d.ts +11 -11
  15. package/build/lib/commands/proxy-helper.d.ts.map +1 -1
  16. package/build/lib/commands/proxy-helper.js +15 -24
  17. package/build/lib/commands/proxy-helper.js.map +1 -1
  18. package/build/lib/commands/simctl.d.ts +16 -22
  19. package/build/lib/commands/simctl.d.ts.map +1 -1
  20. package/build/lib/commands/simctl.js +8 -17
  21. package/build/lib/commands/simctl.js.map +1 -1
  22. package/build/lib/commands/timeouts.d.ts +25 -32
  23. package/build/lib/commands/timeouts.d.ts.map +1 -1
  24. package/build/lib/commands/timeouts.js +18 -14
  25. package/build/lib/commands/timeouts.js.map +1 -1
  26. package/lib/commands/alert.ts +98 -0
  27. package/lib/commands/appearance.ts +70 -0
  28. package/lib/commands/permissions.ts +90 -0
  29. package/lib/commands/{proxy-helper.js → proxy-helper.ts} +26 -26
  30. package/lib/commands/{simctl.js → simctl.ts} +27 -21
  31. package/lib/commands/timeouts.ts +95 -0
  32. package/npm-shrinkwrap.json +5 -5
  33. package/package.json +1 -1
  34. package/lib/commands/alert.js +0 -88
  35. package/lib/commands/appearance.js +0 -71
  36. package/lib/commands/permissions.js +0 -85
  37. package/lib/commands/timeouts.js +0 -68
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [10.14.3](https://github.com/appium/appium-xcuitest-driver/compare/v10.14.2...v10.14.3) (2026-01-04)
2
+
3
+ ### Miscellaneous Chores
4
+
5
+ * Migrate various command modules to typescript (part 7) ([#2693](https://github.com/appium/appium-xcuitest-driver/issues/2693)) ([1286364](https://github.com/appium/appium-xcuitest-driver/commit/128636475c1eac6ea5c73da3dcebb2eb9d539c4d))
6
+
1
7
  ## [10.14.2](https://github.com/appium/appium-xcuitest-driver/compare/v10.14.1...v10.14.2) (2026-01-01)
2
8
 
3
9
  ### Miscellaneous Chores
@@ -1,45 +1,40 @@
1
+ import type { XCUITestDriver } from '../driver';
2
+ export type AlertAction = 'accept' | 'dismiss' | 'getButtons';
1
3
  /**
2
- * @this {XCUITestDriver}
3
- */
4
- export function getAlertText(this: import("../driver").XCUITestDriver): Promise<string | null>;
5
- /**
6
- * @param {string} value
7
- * @this {XCUITestDriver}
8
- * @returns {Promise<void>}
4
+ * Gets the text of the currently displayed alert.
5
+ *
6
+ * @returns The alert text, or null if no alert is displayed
9
7
  */
10
- export function setAlertText(this: import("../driver").XCUITestDriver, value: string): Promise<void>;
8
+ export declare function getAlertText(this: XCUITestDriver): Promise<string | null>;
11
9
  /**
12
- * @param { {buttonLabel?: string} } opts
13
- * @returns {Promise<void>}
14
- * @this {XCUITestDriver}
10
+ * Sets the text in an alert input field.
11
+ *
12
+ * @param value - The text to set
15
13
  */
16
- export function postAcceptAlert(this: import("../driver").XCUITestDriver, opts?: {
17
- buttonLabel?: string;
18
- }): Promise<void>;
14
+ export declare function setAlertText(this: XCUITestDriver, value: string): Promise<void>;
19
15
  /**
20
- * @param { {buttonLabel?: string} } opts
21
- * @returns {Promise<void>}
22
- * @this {XCUITestDriver}
16
+ * Accepts the currently displayed alert.
17
+ *
18
+ * @param opts - Options including optional button label
23
19
  */
24
- export function postDismissAlert(this: import("../driver").XCUITestDriver, opts?: {
25
- buttonLabel?: string;
26
- }): Promise<void>;
20
+ export declare function postAcceptAlert(this: XCUITestDriver, opts?: AlertOptions): Promise<void>;
27
21
  /**
28
- * @internal
29
- * @this {XCUITestDriver}
30
- * @returns {Promise<string[]>} The list of button labels
22
+ * Dismisses the currently displayed alert.
23
+ *
24
+ * @param opts - Options including optional button label
31
25
  */
32
- export function getAlertButtons(this: import("../driver").XCUITestDriver): Promise<string[]>;
26
+ export declare function postDismissAlert(this: XCUITestDriver, opts?: AlertOptions): Promise<void>;
33
27
  /**
34
28
  * Tries to apply the given action to the currently visible alert.
35
29
  *
36
- * @param {AlertAction} action - The actual action to apply.
37
- * @param {string} [buttonLabel] - The name of the button used to perform the chosen alert action. Only makes sense if the action is `accept` or `dismiss`.
38
- * @returns {Promise<string[]|void>} If `action` is `getButtons`, a list of alert button labelsp; otherwise nothing.
30
+ * @param action - The actual action to apply
31
+ * @param buttonLabel - The name of the button used to perform the chosen alert action. Only makes sense if the action is `accept` or `dismiss`
32
+ * @returns If `action` is `getButtons`, a list of alert button labels; otherwise nothing
39
33
  * @remarks This should really be separate commands.
40
- * @this {XCUITestDriver}
41
34
  */
42
- export function mobileHandleAlert(this: import("../driver").XCUITestDriver, action: AlertAction, buttonLabel?: string): Promise<string[] | void>;
43
- export type AlertAction = "accept" | "dismiss" | "getButtons";
44
- export type XCUITestDriver = import("../driver").XCUITestDriver;
35
+ export declare function mobileHandleAlert(this: XCUITestDriver, action: AlertAction, buttonLabel?: string): Promise<string[] | void>;
36
+ interface AlertOptions {
37
+ buttonLabel?: string;
38
+ }
39
+ export {};
45
40
  //# sourceMappingURL=alert.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../lib/commands/alert.js"],"names":[],"mappings":"AAAA;;GAEG;AACH,+FAEC;AAED;;;;GAIG;AACH,8EAJW,MAAM,GAEJ,OAAO,CAAC,IAAI,CAAC,CAIzB;AAED;;;;GAIG;AAC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O,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAc1B;AAUD,UAAU,YAAY;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -7,51 +7,53 @@ exports.postDismissAlert = postDismissAlert;
7
7
  exports.getAlertButtons = getAlertButtons;
8
8
  exports.mobileHandleAlert = mobileHandleAlert;
9
9
  /**
10
- * @this {XCUITestDriver}
10
+ * Gets the text of the currently displayed alert.
11
+ *
12
+ * @returns The alert text, or null if no alert is displayed
11
13
  */
12
14
  async function getAlertText() {
13
- return /** @type {string|null} */ (await this.proxyCommand('/alert/text', 'GET'));
15
+ return await this.proxyCommand('/alert/text', 'GET');
14
16
  }
15
17
  /**
16
- * @param {string} value
17
- * @this {XCUITestDriver}
18
- * @returns {Promise<void>}
18
+ * Sets the text in an alert input field.
19
+ *
20
+ * @param value - The text to set
19
21
  */
20
22
  async function setAlertText(value) {
21
23
  await this.proxyCommand('/alert/text', 'POST', { value });
22
24
  }
23
25
  /**
24
- * @param { {buttonLabel?: string} } opts
25
- * @returns {Promise<void>}
26
- * @this {XCUITestDriver}
26
+ * Accepts the currently displayed alert.
27
+ *
28
+ * @param opts - Options including optional button label
27
29
  */
28
30
  async function postAcceptAlert(opts = {}) {
29
31
  await this.proxyCommand('/alert/accept', 'POST', toAlertParams(opts));
30
32
  }
31
33
  /**
32
- * @param { {buttonLabel?: string} } opts
33
- * @returns {Promise<void>}
34
- * @this {XCUITestDriver}
34
+ * Dismisses the currently displayed alert.
35
+ *
36
+ * @param opts - Options including optional button label
35
37
  */
36
38
  async function postDismissAlert(opts = {}) {
37
39
  await this.proxyCommand('/alert/dismiss', 'POST', toAlertParams(opts));
38
40
  }
39
41
  /**
42
+ * Gets the list of button labels from the currently displayed alert.
43
+ *
44
+ * @returns The list of button labels
40
45
  * @internal
41
- * @this {XCUITestDriver}
42
- * @returns {Promise<string[]>} The list of button labels
43
46
  */
44
47
  async function getAlertButtons() {
45
- return /** @type {string[]} */ (await this.proxyCommand('/wda/alert/buttons', 'GET'));
48
+ return await this.proxyCommand('/wda/alert/buttons', 'GET');
46
49
  }
47
50
  /**
48
51
  * Tries to apply the given action to the currently visible alert.
49
52
  *
50
- * @param {AlertAction} action - The actual action to apply.
51
- * @param {string} [buttonLabel] - The name of the button used to perform the chosen alert action. Only makes sense if the action is `accept` or `dismiss`.
52
- * @returns {Promise<string[]|void>} If `action` is `getButtons`, a list of alert button labelsp; otherwise nothing.
53
+ * @param action - The actual action to apply
54
+ * @param buttonLabel - The name of the button used to perform the chosen alert action. Only makes sense if the action is `accept` or `dismiss`
55
+ * @returns If `action` is `getButtons`, a list of alert button labels; otherwise nothing
53
56
  * @remarks This should really be separate commands.
54
- * @this {XCUITestDriver}
55
57
  */
56
58
  async function mobileHandleAlert(action, buttonLabel) {
57
59
  switch (action) {
@@ -66,11 +68,6 @@ async function mobileHandleAlert(action, buttonLabel) {
66
68
  `'${action}' is provided instead.`);
67
69
  }
68
70
  }
69
- /**
70
- *
71
- * @param { {buttonLabel?: string} } opts
72
- * @returns { {name?: string} }
73
- */
74
71
  function toAlertParams(opts = {}) {
75
72
  const params = {};
76
73
  if (opts.buttonLabel) {
@@ -78,10 +75,4 @@ function toAlertParams(opts = {}) {
78
75
  }
79
76
  return params;
80
77
  }
81
- /**
82
- * @typedef {'accept'|'dismiss'|'getButtons'} AlertAction
83
- */
84
- /**
85
- * @typedef {import('../driver').XCUITestDriver} XCUITestDriver
86
- */
87
78
  //# sourceMappingURL=alert.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"alert.js","sourceRoot":"","sources":["../../../lib/commands/alert.js"],"names":[],"mappings":";;AAGA,oCAEC;AAOD,oCAEC;AAOD,0CAEC;AAOD,4CAEC;AAOD,0CAEC;AAWD,8CAcC;AAlED;;GAEG;AACI,KAAK,UAAU,YAAY;IAChC,OAAO,0BAA0B,CAAC,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC;AACpF,CAAC;A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SAAS;YACZ,OAAO,MAAM,IAAI,CAAC,gBAAgB,CAAC,EAAC,WAAW,EAAC,CAAC,CAAC;QACpD,KAAK,YAAY;YACf,OAAO,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QACtC;YACE,MAAM,IAAI,KAAK,CACb,2EAA2E;gBACzE,IAAI,MAAM,wBAAwB,CACrC,CAAC;IACN,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,OAAqB,EAAE;IAC5C,MAAM,MAAM,GAAoB,EAAE,CAAC;IACnC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC;IACjC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,22 +1,20 @@
1
+ import type { XCUITestDriver } from '../driver';
2
+ import type { Style } from './types';
1
3
  /**
2
4
  * Set the device's UI appearance style
3
5
  *
4
6
  * @since iOS 12.0
5
- * @param {'dark'|'light'} style - The appearance style to set
6
- * @throws {Error} if the current platform does not support UI appearance changes
7
- * @this {XCUITestDriver}
7
+ * @param style - The appearance style to set
8
+ * @throws If the current platform does not support UI appearance changes
8
9
  */
9
- export function mobileSetAppearance(this: import("../driver").XCUITestDriver, style: "dark" | "light"): Promise<undefined>;
10
+ export declare function mobileSetAppearance(this: XCUITestDriver, style: 'dark' | 'light'): Promise<void>;
10
11
  /**
11
12
  * Get the device's UI appearance style.
12
13
  *
13
14
  * @since Xcode SDK 11
14
- * @returns {Promise<{style: Style}>}
15
- * @this {XCUITestDriver}
15
+ * @returns The current appearance style
16
16
  */
17
- export function mobileGetAppearance(this: import("../driver").XCUITestDriver): Promise<{
17
+ export declare function mobileGetAppearance(this: XCUITestDriver): Promise<{
18
18
  style: Style;
19
19
  }>;
20
- export type XCUITestDriver = import("../driver").XCUITestDriver;
21
- export type Style = import("./types").Style;
22
20
  //# sourceMappingURL=appearance.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"appearance.d.ts","sourceRoot":"","sources":["../../../lib/commands/appearance.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,qFAJW,MAAM,GAAC,OAAO,sBA0BxB;AAED;;;;;;GAMG;AACH,+EAHa,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAC,CAAC,CA0BnC;6BAGY,OAAO,WAAW,EAAE,cAAc;oBAClC,OAAO,SAAS,EAAE,KAAK"}
1
+ {"version":3,"file":"appearance.d.ts","sourceRoot":"","sources":["../../../lib/commands/appearance.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAGnC;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,MAAM,GAAG,OAAO,GACtB,OAAO,CAAC,IAAI,CAAC,CAwBf;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAC,CAAC,CAkBzB"}
@@ -11,27 +11,28 @@ const support_1 = require("appium/support");
11
11
  * Set the device's UI appearance style
12
12
  *
13
13
  * @since iOS 12.0
14
- * @param {'dark'|'light'} style - The appearance style to set
15
- * @throws {Error} if the current platform does not support UI appearance changes
16
- * @this {XCUITestDriver}
14
+ * @param style - The appearance style to set
15
+ * @throws If the current platform does not support UI appearance changes
17
16
  */
18
17
  async function mobileSetAppearance(style) {
19
18
  if (!['light', 'dark'].includes(lodash_1.default.toLower(style))) {
20
19
  throw new Error(`The 'style' value is expected to equal either 'light' or 'dark'`);
21
20
  }
22
- if (support_1.util.compareVersions(/** @type {string} */ (this.opts.platformVersion), '<', '12.0')) {
21
+ if (support_1.util.compareVersions(this.opts.platformVersion, '<', '12.0')) {
23
22
  throw new Error('Changing appearance is only supported since iOS 12');
24
23
  }
25
24
  if (this.isSimulator()) {
26
25
  try {
27
- return void (await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).setAppearance(style));
26
+ await this.device.setAppearance(style);
27
+ return;
28
28
  }
29
29
  catch (e) {
30
30
  this.log.debug(e.stack);
31
31
  }
32
32
  }
33
33
  try {
34
- return void (await this.proxyCommand('/wda/device/appearance', 'POST', { name: style }, false));
34
+ await this.proxyCommand('/wda/device/appearance', 'POST', { name: style }, false);
35
+ return;
35
36
  }
36
37
  catch (e) {
37
38
  this.log.debug(e.stack);
@@ -43,32 +44,25 @@ async function mobileSetAppearance(style) {
43
44
  * Get the device's UI appearance style.
44
45
  *
45
46
  * @since Xcode SDK 11
46
- * @returns {Promise<{style: Style}>}
47
- * @this {XCUITestDriver}
47
+ * @returns The current appearance style
48
48
  */
49
49
  async function mobileGetAppearance() {
50
- if (support_1.util.compareVersions(/** @type {string} */ (this.opts.platformVersion), '<', '12.0')) {
50
+ if (support_1.util.compareVersions(this.opts.platformVersion, '<', '12.0')) {
51
51
  return { style: 'unsupported' };
52
52
  }
53
- /** @type {Style|undefined} */
54
53
  let style;
55
54
  if (this.isSimulator()) {
56
55
  try {
57
- style = /** @type {Style} */ (await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).getAppearance());
56
+ style = await this.device.getAppearance();
58
57
  }
59
58
  catch { }
60
59
  }
61
60
  if (!style) {
62
- style = /** @type {Style} */ (
63
- /** @type {any} */ (await this.proxyCommand('/wda/device/info', 'GET'))
64
- ?.userInterfaceStyle ?? 'unknown');
61
+ const deviceInfo = await this.proxyCommand('/wda/device/info', 'GET');
62
+ style = (deviceInfo?.userInterfaceStyle ?? 'unknown');
65
63
  }
66
64
  return {
67
- style,
65
+ style: style,
68
66
  };
69
67
  }
70
- /**
71
- * @typedef {import('../driver').XCUITestDriver} XCUITestDriver
72
- * @typedef {import('./types').Style} Style
73
- */
74
68
  //# sourceMappingURL=appearance.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"appearance.js","sourceRoot":"","sources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IAAI,CAAC;YACH,KAAK,GAAG,MAAO,IAAI,CAAC,MAAoB,CAAC,aAAa,EAAW,CAAC;QACpE,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;IACZ,CAAC;IACD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,YAAY,CAAqC,kBAAkB,EAAE,KAAK,CAAC,CAAC;QAC1G,KAAK,GAAG,CAAC,UAAU,EAAE,kBAAkB,IAAI,SAAS,CAAU,CAAC;IACjE,CAAC;IACD,OAAO;QACL,KAAK,EAAE,KAAc;KACtB,CAAC;AACJ,CAAC"}
@@ -1,36 +1,34 @@
1
+ import { PermissionService } from './enum';
2
+ import type { XCUITestDriver } from '../driver';
3
+ import type { PermissionState } from './types';
1
4
  /**
2
5
  * Resets the given permission for the active application under test.
3
6
  * Works for both Simulator and real devices using Xcode SDK 11.4+
4
7
  *
5
- * @param {PermissionService|number} service - One of the available service names. This could also be an integer protected resource identifier; see [this list](https://developer.apple.com/documentation/xctest/xcuiprotectedresource?language=objc)
6
- * @throws {Error} If permission reset fails on the device.
7
- * @this {XCUITestDriver}
8
+ * @param service - One of the available service names. This could also be an integer protected resource identifier; see [this list](https://developer.apple.com/documentation/xctest/xcuiprotectedresource?language=objc)
9
+ * @throws If permission reset fails on the device.
8
10
  */
9
- export function mobileResetPermission(this: import("../driver").XCUITestDriver, service: PermissionService | number): Promise<void>;
11
+ export declare function mobileResetPermission(this: XCUITestDriver, service: PermissionService | number): Promise<void>;
10
12
  /**
11
13
  * Gets application permission state on a simulated device.
12
14
  *
13
15
  * **This method requires [WIX applesimutils](https://github.com/wix/AppleSimulatorUtils) to be installed on the Appium server host.**
14
16
  *
15
- * @param {string} bundleId - Bundle identifier of the target application
16
- * @param {import('./enum').PermissionService} service - Service name
17
- * @returns {Promise<import('./types').PermissionState>} Either 'yes', 'no', 'unset' or 'limited'
18
- * @throws {Error} If permission getting fails or the device is not a Simulator.
19
- * @this {XCUITestDriver}
17
+ * @param bundleId - Bundle identifier of the target application
18
+ * @param service - Service name
19
+ * @returns Either 'yes', 'no', 'unset' or 'limited'
20
+ * @throws If permission getting fails or the device is not a Simulator.
20
21
  * @group Simulator Only
21
22
  */
22
- export function mobileGetPermission(this: import("../driver").XCUITestDriver, bundleId: string, service: import("./enum").PermissionService): Promise<import("./types").PermissionState>;
23
+ export declare function mobileGetPermission(this: XCUITestDriver, bundleId: string, service: PermissionService): Promise<PermissionState>;
23
24
  /**
24
25
  * Set application permission state on Simulator.
25
26
  *
26
- * @param {Record<Partial<import('./types').AccessRule>, import('./types').PermissionState>} access - One or more access rules to set.
27
- * @param {string} bundleId - Bundle identifier of the target application
27
+ * @param access - One or more access rules to set.
28
+ * @param bundleId - Bundle identifier of the target application
28
29
  * @since Xcode SDK 11.4
29
- * @throws {Error} If permission setting fails or the device is not a Simulator.
30
+ * @throws If permission setting fails or the device is not a Simulator.
30
31
  * @group Simulator Only
31
- * @this {XCUITestDriver}
32
32
  */
33
- export function mobileSetPermissions(this: import("../driver").XCUITestDriver, access: Record<Partial<import("./types").AccessRule>, import("./types").PermissionState>, bundleId: string): Promise<void>;
34
- export type XCUITestDriver = import("../driver").XCUITestDriver;
35
- import { PermissionService } from './enum';
33
+ export declare function mobileSetPermissions(this: XCUITestDriver, access: Record<string, PermissionState>, bundleId: string): Promise<void>;
36
34
  //# sourceMappingURL=permissions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../lib/commands/permissions.js"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH,yFAJW,iBAAiB,GAAC,MAAM,iBA0BlC;AAED;;;;;;;;;;;GAWG;AACH,wFAPW,MAAM,WACN,OAAO,QAAQ,EAAE,iBAAiB,GAChC,OAAO,CAAC,OAAO,SAAS,EAAE,eAAe,CAAC,CAgBtD;AAED;;;;;;;;;GASG;AACH,uFAPW,MAAM,CAAC,OAAO,CAAC,OAAO,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,SAAS,EAAE,eAAe,CAAC,YAChF,MAAM,iBAahB;6BAGY,OAAO,WAAW,EAAE,cAAc;kCAlFf,QAAQ"}
1
+ {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../lib/commands/permissions.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,iBAAiB,EAAC,MAAM,QAAQ,CAAC;AAEzC,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AAG7C;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,iBAAiB,GAAG,MAAM,GAClC,OAAO,CAAC,IAAI,CAAC,CAsBf;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,eAAe,CAAC,CAS1B;AAED;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,EACvC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAOf"}
@@ -9,14 +9,12 @@ exports.mobileSetPermissions = mobileSetPermissions;
9
9
  const lodash_1 = __importDefault(require("lodash"));
10
10
  const enum_1 = require("./enum");
11
11
  const utils_1 = require("../utils");
12
- const assertSimulator = (driver) => utils_1.assertSimulator.call(driver, 'Permission-related operations');
13
12
  /**
14
13
  * Resets the given permission for the active application under test.
15
14
  * Works for both Simulator and real devices using Xcode SDK 11.4+
16
15
  *
17
- * @param {PermissionService|number} service - One of the available service names. This could also be an integer protected resource identifier; see [this list](https://developer.apple.com/documentation/xctest/xcuiprotectedresource?language=objc)
18
- * @throws {Error} If permission reset fails on the device.
19
- * @this {XCUITestDriver}
16
+ * @param service - One of the available service names. This could also be an integer protected resource identifier; see [this list](https://developer.apple.com/documentation/xctest/xcuiprotectedresource?language=objc)
17
+ * @throws If permission reset fails on the device.
20
18
  */
21
19
  async function mobileResetPermission(service) {
22
20
  if (!service) {
@@ -43,11 +41,10 @@ async function mobileResetPermission(service) {
43
41
  *
44
42
  * **This method requires [WIX applesimutils](https://github.com/wix/AppleSimulatorUtils) to be installed on the Appium server host.**
45
43
  *
46
- * @param {string} bundleId - Bundle identifier of the target application
47
- * @param {import('./enum').PermissionService} service - Service name
48
- * @returns {Promise<import('./types').PermissionState>} Either 'yes', 'no', 'unset' or 'limited'
49
- * @throws {Error} If permission getting fails or the device is not a Simulator.
50
- * @this {XCUITestDriver}
44
+ * @param bundleId - Bundle identifier of the target application
45
+ * @param service - Service name
46
+ * @returns Either 'yes', 'no', 'unset' or 'limited'
47
+ * @throws If permission getting fails or the device is not a Simulator.
51
48
  * @group Simulator Only
52
49
  */
53
50
  async function mobileGetPermission(bundleId, service) {
@@ -55,26 +52,23 @@ async function mobileGetPermission(bundleId, service) {
55
52
  throw new Error(`The 'service' option is expected to be present`);
56
53
  }
57
54
  assertSimulator(this);
58
- return /** @type {import('./types').PermissionState} */ (await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).getPermission(bundleId, String(service)));
55
+ return await this.device.getPermission(bundleId, String(service));
59
56
  }
60
57
  /**
61
58
  * Set application permission state on Simulator.
62
59
  *
63
- * @param {Record<Partial<import('./types').AccessRule>, import('./types').PermissionState>} access - One or more access rules to set.
64
- * @param {string} bundleId - Bundle identifier of the target application
60
+ * @param access - One or more access rules to set.
61
+ * @param bundleId - Bundle identifier of the target application
65
62
  * @since Xcode SDK 11.4
66
- * @throws {Error} If permission setting fails or the device is not a Simulator.
63
+ * @throws If permission setting fails or the device is not a Simulator.
67
64
  * @group Simulator Only
68
- * @this {XCUITestDriver}
69
65
  */
70
66
  async function mobileSetPermissions(access, bundleId) {
71
67
  if (!lodash_1.default.isPlainObject(access)) {
72
68
  throw new Error(`The 'access' option is expected to be a map`);
73
69
  }
74
70
  assertSimulator(this);
75
- await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).setPermissions(bundleId, access);
71
+ await this.device.setPermissions(bundleId, access);
76
72
  }
77
- /**
78
- * @typedef {import('../driver').XCUITestDriver} XCUITestDriver
79
- */
73
+ const assertSimulator = (driver) => utils_1.assertSimulator.call(driver, 'Permission-related operations');
80
74
  //# sourceMappingURL=permissions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../../lib/commands/permissions.js"],"names":[],"mappings":";;;;;AAcA,sDAsBC;AAcD,kDAWC;AAYD,oDAOC;AAhFD,oDAAuB;AACvB,iCAAyC;AACzC,oCAA6D;AAE7D,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,uBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,+BAA+B,CAAC,CAAC;AAEnG;;;;;;;GAOG;AACI,KAAK,UAAU,qBAAqB,CAAC,OAAO;IACjD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IACD,IAAI,QAAQ,CAAC;IACb,IAAI,gBAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACxB,QAAQ,GAAG,wBAAiB,CAAC,gBAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QACjD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CACb,qCAAqC,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,gBAAC,CAAC,IAAI,CAAC,wBAAiB,CAAC,CAAC,EAAE,CACvF,CAAC;QACJ,CAAC;IACH,CAAC;SAAM,IAAI,gBAAC,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;QAChC,QAAQ,GAAG,OAAO,CAAC;IACrB,CAAC;SAAM,CAAC;QACN,MAAM,I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AAC,IAAI,CAAC,CAAC;IAEtB,MAAO,IAAI,CAAC,MAAoB,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,eAAe,GAAG,CAAC,MAAsB,EAAE,EAAE,CAAC,uBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,+BAA+B,CAAC,CAAC"}
@@ -1,15 +1,15 @@
1
+ import type { XCUITestDriver } from '../driver';
2
+ export type AllowedHttpMethod = 'GET' | 'POST' | 'DELETE';
1
3
  /**
2
4
  * Proxies a command to WebDriverAgent
3
- * @template [TReq=any]
4
- * @template [TRes=unknown]
5
- * @param {string} url
6
- * @param {AllowedHttpMethod} method
7
- * @param {TReq} [body]
8
- * @param {boolean} isSessionCommand
9
- * @this {import('../driver').XCUITestDriver}
10
- * @returns {Promise<TRes>}
5
+ *
6
+ * @template TReq - Request body type
7
+ * @template TRes - Response type
8
+ * @param url - The endpoint URL
9
+ * @param method - HTTP method to use
10
+ * @param body - Optional request body
11
+ * @param isSessionCommand - Whether this is a session command (default: true)
12
+ * @returns Promise resolving to the response
11
13
  */
12
- export function proxyCommand<TReq = any, TRes = unknown>(this: import("../driver").XCUITestDriver, url: string, method: AllowedHttpMethod, body?: TReq, isSessionCommand?: boolean): Promise<TRes>;
13
- export type XCUITestDriver = import("../driver").XCUITestDriver;
14
- export type AllowedHttpMethod = "GET" | "POST" | "DELETE";
14
+ export declare function proxyCommand<TReq = any, TRes = unknown>(this: XCUITestDriver, url: string, method: AllowedHttpMethod, body?: TReq, isSessionCommand?: boolean): Promise<TRes>;
15
15
  //# sourceMappingURL=proxy-helper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"proxy-helper.d.ts","sourceRoot":"","sources":["../../../lib/commands/proxy-helper.js"],"names":[],"mappings":"AA+CA;;;;;;;;;;GAUG;AACH,6BATc,IAAI,QACJ,IAAI,2DACP,MAAM,UACN,iBAAiB,SACjB,IAAI,qBACJ,OAAO,GAEL,OAAO,CAAC,IAAI,CAAC,CA8CzB;6BAcY,OAAO,WAAW,EAAE,cAAc;gCAClC,KAAK,GAAC,MAAM,GAAC,QAAQ"}
1
+ {"version":3,"file":"proxy-helper.d.ts","sourceRoot":"","sources":["../../../lib/commands/proxy-helper.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AA8C9C,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE1D;;;;;;;;;;GAUG;AACH,wBAAsB,YAAY,CAAC,IAAI,GAAG,GAAG,EAAE,IAAI,GAAG,OAAO,EAC3D,IAAI,EAAE,cAAc,EACpB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,iBAAiB,EACzB,IAAI,CAAC,EAAE,IAAI,EACX,gBAAgB,GAAE,OAAc,GAC/B,OAAO,CAAC,IAAI,CAAC,CA4Cf"}
@@ -9,8 +9,8 @@ const bluebird_1 = __importDefault(require("bluebird"));
9
9
  const GET = 'GET';
10
10
  const POST = 'POST';
11
11
  const DELETE = 'DELETE';
12
- const SUPPORTED_METHODS = Object.freeze(new Set(/** @type {const} */ ([GET, POST, DELETE])));
13
- const WDA_ROUTES = /** @type {const} */ ({
12
+ const SUPPORTED_METHODS = Object.freeze(new Set([GET, POST, DELETE]));
13
+ const WDA_ROUTES = {
14
14
  '/wda/screen': {
15
15
  GET: 'getScreenInfo',
16
16
  },
@@ -47,21 +47,21 @@ const WDA_ROUTES = /** @type {const} */ ({
47
47
  '/wda/locked': {
48
48
  GET: 'isLocked',
49
49
  },
50
- });
50
+ };
51
51
  /**
52
52
  * Proxies a command to WebDriverAgent
53
- * @template [TReq=any]
54
- * @template [TRes=unknown]
55
- * @param {string} url
56
- * @param {AllowedHttpMethod} method
57
- * @param {TReq} [body]
58
- * @param {boolean} isSessionCommand
59
- * @this {import('../driver').XCUITestDriver}
60
- * @returns {Promise<TRes>}
53
+ *
54
+ * @template TReq - Request body type
55
+ * @template TRes - Response type
56
+ * @param url - The endpoint URL
57
+ * @param method - HTTP method to use
58
+ * @param body - Optional request body
59
+ * @param isSessionCommand - Whether this is a session command (default: true)
60
+ * @returns Promise resolving to the response
61
61
  */
62
62
  async function proxyCommand(url, method, body, isSessionCommand = true) {
63
63
  if (this.shutdownUnexpectedly) {
64
- return /** @type {TRes} */ (undefined);
64
+ return undefined;
65
65
  }
66
66
  if (!url) {
67
67
  throw this.log.errorWithException('Proxying requires an endpoint');
@@ -81,11 +81,11 @@ async function proxyCommand(url, method, body, isSessionCommand = true) {
81
81
  this.log.info(`Proxying to WDA with an unknown route: ${method} ${url}`);
82
82
  }
83
83
  if (!timeout) {
84
- return /** @type {TRes} */ (await proxy.command(url, method, body));
84
+ return await proxy.command(url, method, body);
85
85
  }
86
86
  this.log.debug(`Setting custom timeout to ${timeout} ms for '${cmdName}' command`);
87
87
  try {
88
- return /** @type {TRes} */ (await bluebird_1.default.resolve(proxy.command(url, method, body)).timeout(timeout));
88
+ return await bluebird_1.default.resolve(proxy.command(url, method, body)).timeout(timeout);
89
89
  }
90
90
  catch (e) {
91
91
  if (!(e instanceof bluebird_1.default.Promise.TimeoutError)) {
@@ -97,18 +97,9 @@ async function proxyCommand(url, method, body, isSessionCommand = true) {
97
97
  throw error;
98
98
  }
99
99
  }
100
- /**
101
- * @param {string} endpoint
102
- * @param {AllowedHttpMethod} method
103
- * @returns {string|undefined}
104
- */
105
100
  function wdaRouteToCommandName(endpoint, method) {
106
101
  if (endpoint in WDA_ROUTES) {
107
- return WDA_ROUTES[endpoint][method];
102
+ return WDA_ROUTES[endpoint]?.[method];
108
103
  }
109
104
  }
110
- /**
111
- * @typedef {import('../driver').XCUITestDriver} XCUITestDriver
112
- * @typedef {'GET'|'POST'|'DELETE'} AllowedHttpMethod
113
- */
114
105
  //# sourceMappingURL=proxy-helper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"proxy-helper.js","sourceRoot":"","sources":["../../../lib/commands/proxy-helper.js"],"names":[],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