appium-xcuitest-driver 10.14.1 → 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.
- package/CHANGELOG.md +12 -0
- package/build/lib/commands/alert.d.ts +26 -31
- package/build/lib/commands/alert.d.ts.map +1 -1
- package/build/lib/commands/alert.js +20 -29
- package/build/lib/commands/alert.js.map +1 -1
- package/build/lib/commands/appearance.d.ts +7 -9
- package/build/lib/commands/appearance.d.ts.map +1 -1
- package/build/lib/commands/appearance.js +13 -19
- package/build/lib/commands/appearance.js.map +1 -1
- package/build/lib/commands/execute.d.ts +10 -22
- package/build/lib/commands/execute.d.ts.map +1 -1
- package/build/lib/commands/execute.js +12 -28
- package/build/lib/commands/execute.js.map +1 -1
- package/build/lib/commands/location.d.ts +8 -11
- package/build/lib/commands/location.d.ts.map +1 -1
- package/build/lib/commands/location.js +7 -15
- package/build/lib/commands/location.js.map +1 -1
- package/build/lib/commands/navigation.d.ts +14 -26
- package/build/lib/commands/navigation.d.ts.map +1 -1
- package/build/lib/commands/navigation.js +10 -18
- package/build/lib/commands/navigation.js.map +1 -1
- package/build/lib/commands/pcap.d.ts +18 -38
- package/build/lib/commands/pcap.d.ts.map +1 -1
- package/build/lib/commands/pcap.js +9 -14
- package/build/lib/commands/pcap.js.map +1 -1
- package/build/lib/commands/permissions.d.ts +15 -17
- package/build/lib/commands/permissions.d.ts.map +1 -1
- package/build/lib/commands/permissions.js +12 -18
- package/build/lib/commands/permissions.js.map +1 -1
- package/build/lib/commands/proxy-helper.d.ts +11 -11
- package/build/lib/commands/proxy-helper.d.ts.map +1 -1
- package/build/lib/commands/proxy-helper.js +15 -24
- package/build/lib/commands/proxy-helper.js.map +1 -1
- package/build/lib/commands/screenshots.d.ts +15 -9
- package/build/lib/commands/screenshots.d.ts.map +1 -1
- package/build/lib/commands/screenshots.js +13 -11
- package/build/lib/commands/screenshots.js.map +1 -1
- package/build/lib/commands/simctl.d.ts +16 -22
- package/build/lib/commands/simctl.d.ts.map +1 -1
- package/build/lib/commands/simctl.js +8 -17
- package/build/lib/commands/simctl.js.map +1 -1
- package/build/lib/commands/source.d.ts +10 -8
- package/build/lib/commands/source.d.ts.map +1 -1
- package/build/lib/commands/source.js +11 -14
- package/build/lib/commands/source.js.map +1 -1
- package/build/lib/commands/timeouts.d.ts +25 -32
- package/build/lib/commands/timeouts.d.ts.map +1 -1
- package/build/lib/commands/timeouts.js +18 -14
- package/build/lib/commands/timeouts.js.map +1 -1
- package/build/lib/driver.js +1 -1
- package/build/lib/driver.js.map +1 -1
- package/build/lib/execute-method-map.d.ts.map +1 -1
- package/build/lib/execute-method-map.js +0 -2
- package/build/lib/execute-method-map.js.map +1 -1
- package/lib/commands/alert.ts +98 -0
- package/lib/commands/appearance.ts +70 -0
- package/lib/commands/{execute.js → execute.ts} +41 -37
- package/lib/commands/{location.js → location.ts} +19 -22
- package/lib/commands/{navigation.js → navigation.ts} +23 -26
- package/lib/commands/{pcap.js → pcap.ts} +28 -28
- package/lib/commands/permissions.ts +90 -0
- package/lib/commands/{proxy-helper.js → proxy-helper.ts} +26 -26
- package/lib/commands/{screenshots.js → screenshots.ts} +24 -16
- package/lib/commands/{simctl.js → simctl.ts} +27 -21
- package/lib/commands/{source.js → source.ts} +23 -20
- package/lib/commands/timeouts.ts +95 -0
- package/lib/driver.ts +1 -1
- package/lib/execute-method-map.ts +0 -2
- package/npm-shrinkwrap.json +5 -5
- package/package.json +1 -1
- package/lib/commands/alert.js +0 -88
- package/lib/commands/appearance.js +0 -71
- package/lib/commands/permissions.js +0 -85
- package/lib/commands/timeouts.js +0 -68
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
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
|
+
|
|
7
|
+
## [10.14.2](https://github.com/appium/appium-xcuitest-driver/compare/v10.14.1...v10.14.2) (2026-01-01)
|
|
8
|
+
|
|
9
|
+
### Miscellaneous Chores
|
|
10
|
+
|
|
11
|
+
* Migrate various command modules to typescript (part 6) ([#2692](https://github.com/appium/appium-xcuitest-driver/issues/2692)) ([3736824](https://github.com/appium/appium-xcuitest-driver/commit/37368246181f2e4096ce80ae76e3d458ea39c711))
|
|
12
|
+
|
|
1
13
|
## [10.14.1](https://github.com/appium/appium-xcuitest-driver/compare/v10.14.0...v10.14.1) (2025-12-31)
|
|
2
14
|
|
|
3
15
|
### Miscellaneous Chores
|
|
@@ -1,45 +1,40 @@
|
|
|
1
|
+
import type { XCUITestDriver } from '../driver';
|
|
2
|
+
export type AlertAction = 'accept' | 'dismiss' | 'getButtons';
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
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
|
|
8
|
+
export declare function getAlertText(this: XCUITestDriver): Promise<string | null>;
|
|
11
9
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* @
|
|
10
|
+
* Sets the text in an alert input field.
|
|
11
|
+
*
|
|
12
|
+
* @param value - The text to set
|
|
15
13
|
*/
|
|
16
|
-
export function
|
|
17
|
-
buttonLabel?: string;
|
|
18
|
-
}): Promise<void>;
|
|
14
|
+
export declare function setAlertText(this: XCUITestDriver, value: string): Promise<void>;
|
|
19
15
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* @
|
|
16
|
+
* Accepts the currently displayed alert.
|
|
17
|
+
*
|
|
18
|
+
* @param opts - Options including optional button label
|
|
23
19
|
*/
|
|
24
|
-
export function
|
|
25
|
-
buttonLabel?: string;
|
|
26
|
-
}): Promise<void>;
|
|
20
|
+
export declare function postAcceptAlert(this: XCUITestDriver, opts?: AlertOptions): Promise<void>;
|
|
27
21
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* @
|
|
22
|
+
* Dismisses the currently displayed alert.
|
|
23
|
+
*
|
|
24
|
+
* @param opts - Options including optional button label
|
|
31
25
|
*/
|
|
32
|
-
export function
|
|
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
|
|
37
|
-
* @param
|
|
38
|
-
* @returns
|
|
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:
|
|
43
|
-
|
|
44
|
-
|
|
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.
|
|
1
|
+
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../lib/commands/alert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAE9C,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,YAAY,CAAC;AAE9D;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAE/E;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAEf;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,cAAc,EACpB,IAAI,GAAE,YAAiB,GACtB,OAAO,CAAC,IAAI,CAAC,CAEf;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,cAAc,EACpB,IAAI,GAAE,YAAiB,GACtB,OAAO,CAAC,IAAI,CAAC,CAEf;AAYD;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,WAAW,EACnB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,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
|
-
*
|
|
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
|
|
15
|
+
return await this.proxyCommand('/alert/text', 'GET');
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* @
|
|
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
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* @
|
|
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
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* @
|
|
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
|
|
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
|
|
51
|
-
* @param
|
|
52
|
-
* @returns
|
|
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.
|
|
1
|
+
{"version":3,"file":"alert.js","sourceRoot":"","sources":["../../../lib/commands/alert.ts"],"names":[],"mappings":";;AASA,oCAEC;AAOD,oCAKC;AAOD,0CAKC;AAOD,4CAKC;AAQD,0CAEC;AAUD,8CAkBC;AAjFD;;;;GAIG;AACI,KAAK,UAAU,YAAY;IAChC,OAAO,MAAM,IAAI,CAAC,YAAY,CAAqB,aAAa,EAAE,KAAK,CAAC,CAAC;AAC3E,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,YAAY,CAEhC,KAAa;IAEb,MAAM,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,EAAE,EAAC,KAAK,EAAC,CAAC,CAAC;AAC1D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
|
|
1
3
|
/**
|
|
2
4
|
* Set the device's UI appearance style
|
|
3
5
|
*
|
|
4
6
|
* @since iOS 12.0
|
|
5
|
-
* @param
|
|
6
|
-
* @throws
|
|
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:
|
|
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
|
|
15
|
-
* @this {XCUITestDriver}
|
|
15
|
+
* @returns The current appearance style
|
|
16
16
|
*/
|
|
17
|
-
export function mobileGetAppearance(this:
|
|
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.
|
|
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
|
|
15
|
-
* @throws
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
47
|
-
* @this {XCUITestDriver}
|
|
47
|
+
* @returns The current appearance style
|
|
48
48
|
*/
|
|
49
49
|
async function mobileGetAppearance() {
|
|
50
|
-
if (support_1.util.compareVersions(
|
|
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 =
|
|
56
|
+
style = await this.device.getAppearance();
|
|
58
57
|
}
|
|
59
58
|
catch { }
|
|
60
59
|
}
|
|
61
60
|
if (!style) {
|
|
62
|
-
|
|
63
|
-
|
|
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":["../../../lib/commands/appearance.
|
|
1
|
+
{"version":3,"file":"appearance.js","sourceRoot":"","sources":["../../../lib/commands/appearance.ts"],"names":[],"mappings":";;;;;AAaA,kDA2BC;AAQD,kDAoBC;AApED,oDAAuB;AACvB,4CAAoC;AAKpC;;;;;;GAMG;AACI,KAAK,UAAU,mBAAmB,CAEvC,KAAuB;IAEvB,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,gBAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAC;IACrF,CAAC;IACD,IAAI,cAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,eAAyB,EAAE,GAAG,EAAE,MAAM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C;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,33 +1,21 @@
|
|
|
1
|
+
import { XCUITestDriver } from '../driver';
|
|
2
|
+
import type { StringRecord } from '@appium/types';
|
|
1
3
|
/**
|
|
2
4
|
* Collect the response of an async script execution
|
|
3
|
-
* @this {XCUITestDriver}
|
|
4
5
|
* @deprecated
|
|
5
6
|
* @privateRemarks It's unclear what this is for. Don't use it.
|
|
6
7
|
*/
|
|
7
|
-
export function receiveAsyncResponse(this: XCUITestDriver, status:
|
|
8
|
+
export declare function receiveAsyncResponse(this: XCUITestDriver, status: number | null | undefined, value: any): Promise<void>;
|
|
8
9
|
/**
|
|
9
|
-
* @template
|
|
10
|
-
* @
|
|
11
|
-
* @param
|
|
12
|
-
* @param {TArgs} [args]
|
|
13
|
-
* @this {XCUITestDriver}
|
|
14
|
-
* @returns {Promise<TReturn>}
|
|
10
|
+
* @template TReturn
|
|
11
|
+
* @param script - Either a script to run, or in the case of an Execute Method, the name of the script to execute.
|
|
12
|
+
* @param args
|
|
15
13
|
*/
|
|
16
|
-
export function execute<
|
|
14
|
+
export declare function execute<TReturn = unknown>(this: XCUITestDriver, script: string, args?: ExecuteMethodArgs): Promise<TReturn>;
|
|
17
15
|
/**
|
|
18
|
-
* @this {XCUITestDriver}
|
|
19
16
|
* @group Mobile Web Only
|
|
20
17
|
*/
|
|
21
|
-
export function executeAsync(this: XCUITestDriver, script:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
* @this {XCUITestDriver}
|
|
25
|
-
* @group Mobile Web Only
|
|
26
|
-
*/
|
|
27
|
-
constructor(this: XCUITestDriver, script: any, args: any);
|
|
28
|
-
asyncWaitMs: number;
|
|
29
|
-
}
|
|
30
|
-
export type StringRecord<T = any> = import("@appium/types").StringRecord<T>;
|
|
31
|
-
export type ExecuteMethodArgs = readonly any[] | readonly [StringRecord] | Readonly<StringRecord>;
|
|
32
|
-
import { XCUITestDriver } from '../driver';
|
|
18
|
+
export declare function executeAsync(this: XCUITestDriver, script: string, args?: readonly any[]): Promise<any>;
|
|
19
|
+
type ExecuteMethodArgs = readonly any[] | readonly [StringRecord<unknown>] | Readonly<StringRecord<unknown>>;
|
|
20
|
+
export {};
|
|
33
21
|
//# sourceMappingURL=execute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../lib/commands/execute.
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../lib/commands/execute.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAGzC,OAAO,KAAK,EAAU,YAAY,EAAC,MAAM,eAAe,CAAC;AAEzD;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACjC,KAAK,EAAE,GAAG,GACT,OAAO,CAAC,IAAI,CAAC,CAqBf;AAED;;;;GAIG;AACH,wBAAsB,OAAO,CAAC,OAAO,GAAG,OAAO,EAC7C,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,iBAAiB,GACvB,OAAO,CAAC,OAAO,CAAC,CAalB;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,SAAS,GAAG,EAAE,GACpB,OAAO,CAAC,GAAG,CAAC,CAad;AA0ED,KAAK,iBAAiB,GAAG,SAAS,GAAG,EAAE,GAAG,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC"}
|
|
@@ -12,7 +12,6 @@ const driver_2 = require("appium/driver");
|
|
|
12
12
|
const support_1 = require("appium/support");
|
|
13
13
|
/**
|
|
14
14
|
* Collect the response of an async script execution
|
|
15
|
-
* @this {XCUITestDriver}
|
|
16
15
|
* @deprecated
|
|
17
16
|
* @privateRemarks It's unclear what this is for. Don't use it.
|
|
18
17
|
*/
|
|
@@ -34,12 +33,9 @@ async function receiveAsyncResponse(status, value) {
|
|
|
34
33
|
return this.asyncPromise.resolve(value);
|
|
35
34
|
}
|
|
36
35
|
/**
|
|
37
|
-
* @template
|
|
38
|
-
* @
|
|
39
|
-
* @param
|
|
40
|
-
* @param {TArgs} [args]
|
|
41
|
-
* @this {XCUITestDriver}
|
|
42
|
-
* @returns {Promise<TReturn>}
|
|
36
|
+
* @template TReturn
|
|
37
|
+
* @param script - Either a script to run, or in the case of an Execute Method, the name of the script to execute.
|
|
38
|
+
* @param args
|
|
43
39
|
*/
|
|
44
40
|
async function execute(script, args) {
|
|
45
41
|
// TODO: create a type that converts args to the parameters of the associated method using the `command` prop of `executeMethodMap`
|
|
@@ -49,7 +45,7 @@ async function execute(script, args) {
|
|
|
49
45
|
return await this.executeMethod(script, [executeMethodArgs]);
|
|
50
46
|
}
|
|
51
47
|
else if (this.isWebContext()) {
|
|
52
|
-
const atomsArgs = this.convertElementsForAtoms(
|
|
48
|
+
const atomsArgs = this.convertElementsForAtoms(args);
|
|
53
49
|
const result = await this.executeAtom('execute_script', [script, atomsArgs]);
|
|
54
50
|
return this.cacheWebElements(result);
|
|
55
51
|
}
|
|
@@ -58,7 +54,6 @@ async function execute(script, args) {
|
|
|
58
54
|
}
|
|
59
55
|
}
|
|
60
56
|
/**
|
|
61
|
-
* @this {XCUITestDriver}
|
|
62
57
|
* @group Mobile Web Only
|
|
63
58
|
*/
|
|
64
59
|
async function executeAsync(script, args) {
|
|
@@ -72,15 +67,13 @@ async function executeAsync(script, args) {
|
|
|
72
67
|
}
|
|
73
68
|
/**
|
|
74
69
|
* Checks if script expects a particular parameter (either optional or required).
|
|
75
|
-
* @template
|
|
76
|
-
* @param
|
|
77
|
-
* @param
|
|
70
|
+
* @template Script
|
|
71
|
+
* @param script - Script name
|
|
72
|
+
* @param param - Parameter name
|
|
78
73
|
* @returns {boolean}
|
|
79
74
|
*/
|
|
80
75
|
function executeMethodExpectsParam(script, param) {
|
|
81
|
-
/** @type {ReadonlyArray<string>|undefined} */
|
|
82
76
|
let required;
|
|
83
|
-
/** @type {ReadonlyArray<string>|undefined} */
|
|
84
77
|
let optional;
|
|
85
78
|
const execMethodDef = driver_1.XCUITestDriver.executeMethodMap[script];
|
|
86
79
|
if ('params' in execMethodDef) {
|
|
@@ -95,7 +88,7 @@ function executeMethodExpectsParam(script, param) {
|
|
|
95
88
|
return allParams.has(param);
|
|
96
89
|
}
|
|
97
90
|
/**
|
|
98
|
-
* @param
|
|
91
|
+
* @param script
|
|
99
92
|
* @returns {script is keyof XCUITestDriver.executeMethodMap}
|
|
100
93
|
*/
|
|
101
94
|
function isExecuteMethod(script) {
|
|
@@ -103,15 +96,14 @@ function isExecuteMethod(script) {
|
|
|
103
96
|
}
|
|
104
97
|
/**
|
|
105
98
|
* Massages the arguments going into an execute method.
|
|
106
|
-
* @param
|
|
107
|
-
* @param
|
|
108
|
-
* @returns {StringRecord<unknown>}
|
|
99
|
+
* @param script
|
|
100
|
+
* @param args
|
|
109
101
|
*/
|
|
110
102
|
function preprocessExecuteMethodArgs(script, args) {
|
|
111
103
|
if (lodash_1.default.isArray(args)) {
|
|
112
104
|
args = lodash_1.default.first(args);
|
|
113
105
|
}
|
|
114
|
-
const executeMethodArgs =
|
|
106
|
+
const executeMethodArgs = (args ?? {});
|
|
115
107
|
/**
|
|
116
108
|
* Renames the deprecated `element` key to `elementId`. Historically,
|
|
117
109
|
* all of the pre-Execute-Method-Map execute methods accepted an `element` _or_ and `elementId` param.
|
|
@@ -127,16 +119,8 @@ function preprocessExecuteMethodArgs(script, args) {
|
|
|
127
119
|
* Most of these Execute Methods (typically beginning with `mobile*`) will accept an `Element|string` for `elementId`, in practice they will only ever get a `string`. `Element|string` in the method's docstring is simply for documentation purposes.
|
|
128
120
|
*/
|
|
129
121
|
if ('elementId' in executeMethodArgs && executeMethodExpectsParam(script, 'elementId')) {
|
|
130
|
-
executeMethodArgs.elementId = support_1.util.unwrapElement(
|
|
131
|
-
/** @type {import('@appium/types').Element|string} */ (executeMethodArgs.elementId));
|
|
122
|
+
executeMethodArgs.elementId = support_1.util.unwrapElement(executeMethodArgs.elementId);
|
|
132
123
|
}
|
|
133
124
|
return executeMethodArgs;
|
|
134
125
|
}
|
|
135
|
-
/**
|
|
136
|
-
* @template [T=any]
|
|
137
|
-
* @typedef {import('@appium/types').StringRecord<T>} StringRecord
|
|
138
|
-
*/
|
|
139
|
-
/**
|
|
140
|
-
* @typedef {readonly any[] | readonly [StringRecord] | Readonly<StringRecord>} ExecuteMethodArgs
|
|
141
|
-
*/
|
|
142
126
|
//# sourceMappingURL=execute.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../lib/commands/execute.
|
|
1
|
+
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../lib/commands/execute.ts"],"names":[],"mappings":";;;;;AAWA,oDAyBC;AAOD,0BAiBC;AAKD,oCAiBC;AAlFD,oDAAuB;AACvB,sCAAyC;AACzC,0CAA0E;AAC1E,4CAAoC;AAGpC;;;;GAIG;AACI,KAAK,UAAU,oBAAoB,CAExC,MAAiC,EACjC,KAAU;IAEV,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,4BAA4B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACpE,IAAI,CAAC,cAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE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
1
|
+
import type { XCUITestDriver } from '../driver';
|
|
2
|
+
import type { Location } from '@appium/types';
|
|
3
|
+
import type { LocationWithAltitude } from './types';
|
|
1
4
|
/**
|
|
2
5
|
* Returns location of the device under test.
|
|
3
6
|
* The device under test must allow the location services for WDA
|
|
@@ -11,31 +14,25 @@
|
|
|
11
14
|
* "mobile:getSimulatedLocation" if the simulated location has been previously set
|
|
12
15
|
* "mobile:setSimulatedLocation" already.
|
|
13
16
|
*
|
|
14
|
-
* @returns
|
|
17
|
+
* @returns Location with altitude
|
|
15
18
|
* @throws {Error} If the device under test returns an error message.
|
|
16
19
|
* i.e.: tvOS returns unsupported error
|
|
17
|
-
* @this {XCUITestDriver}
|
|
18
20
|
*/
|
|
19
|
-
export function getGeoLocation(this:
|
|
21
|
+
export declare function getGeoLocation(this: XCUITestDriver): Promise<LocationWithAltitude>;
|
|
20
22
|
/**
|
|
21
23
|
* Set location of the device under test.
|
|
22
24
|
*
|
|
23
25
|
* iOS 17+ real device environment will be via "mobile:setSimulatedLocation" as
|
|
24
26
|
* setting simulated location for XCTest session.
|
|
25
27
|
*
|
|
26
|
-
* @param
|
|
27
|
-
* @this {XCUITestDriver}
|
|
28
|
+
* @param location - Location with latitude and longitude
|
|
28
29
|
*/
|
|
29
|
-
export function setGeoLocation(this:
|
|
30
|
+
export declare function setGeoLocation(this: XCUITestDriver, location: Partial<Location>): Promise<Location>;
|
|
30
31
|
/**
|
|
31
32
|
* Reset the location service on real device.
|
|
32
33
|
*
|
|
33
34
|
* @throws {Error} If the device is simulator and iOS version is below 17,
|
|
34
35
|
* or 'resetLocation' raises an error.
|
|
35
|
-
* @this {XCUITestDriver}
|
|
36
36
|
*/
|
|
37
|
-
export function mobileResetLocationService(this:
|
|
38
|
-
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
39
|
-
export type WDALocationInfo = import("./types").WDALocationInfo;
|
|
40
|
-
export type Location = import("@appium/types").Location;
|
|
37
|
+
export declare function mobileResetLocationService(this: XCUITestDriver): Promise<void>;
|
|
41
38
|
//# sourceMappingURL=location.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../../lib/commands/location.
|
|
1
|
+
{"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../../lib/commands/location.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAC,oBAAoB,EAAkB,MAAM,SAAS,CAAC;AAGnE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAkCxF;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,GAC1B,OAAO,CAAC,QAAQ,CAAC,CA6BnB;AAED;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBpF"}
|
|
@@ -21,10 +21,9 @@ const utils_1 = require("../utils");
|
|
|
21
21
|
* "mobile:getSimulatedLocation" if the simulated location has been previously set
|
|
22
22
|
* "mobile:setSimulatedLocation" already.
|
|
23
23
|
*
|
|
24
|
-
* @returns
|
|
24
|
+
* @returns Location with altitude
|
|
25
25
|
* @throws {Error} If the device under test returns an error message.
|
|
26
26
|
* i.e.: tvOS returns unsupported error
|
|
27
|
-
* @this {XCUITestDriver}
|
|
28
27
|
*/
|
|
29
28
|
async function getGeoLocation() {
|
|
30
29
|
// Currently we proxy the setGeoLocation to mobile:setSimulatedLocation for iOS 17+.
|
|
@@ -43,7 +42,7 @@ async function getGeoLocation() {
|
|
|
43
42
|
// '/wda/device/location' returns current device location information,
|
|
44
43
|
// but '/wda/simulatedLocation' returns `null` values until the WDA process
|
|
45
44
|
// sets a simulated location. After setting the value, both returns the same values.
|
|
46
|
-
const { authorizationStatus, latitude, longitude, altitude } =
|
|
45
|
+
const { authorizationStatus, latitude, longitude, altitude } = await this.proxyCommand('/wda/device/location', 'GET');
|
|
47
46
|
// '3' is 'Always' in the privacy
|
|
48
47
|
// https://developer.apple.com/documentation/corelocation/clauthorizationstatus
|
|
49
48
|
if (authorizationStatus !== enum_1.AuthorizationStatus.authorizedAlways) {
|
|
@@ -61,17 +60,16 @@ async function getGeoLocation() {
|
|
|
61
60
|
* iOS 17+ real device environment will be via "mobile:setSimulatedLocation" as
|
|
62
61
|
* setting simulated location for XCTest session.
|
|
63
62
|
*
|
|
64
|
-
* @param
|
|
65
|
-
* @this {XCUITestDriver}
|
|
63
|
+
* @param location - Location with latitude and longitude
|
|
66
64
|
*/
|
|
67
65
|
async function setGeoLocation(location) {
|
|
68
|
-
|
|
66
|
+
const { latitude, longitude } = location;
|
|
69
67
|
if (!support_1.util.hasValue(latitude) || !support_1.util.hasValue(longitude)) {
|
|
70
68
|
throw new driver_1.errors.InvalidArgumentError(`Both latitude and longitude should be set`);
|
|
71
69
|
}
|
|
72
70
|
if (this.isSimulator()) {
|
|
73
|
-
await
|
|
74
|
-
return
|
|
71
|
+
await this.device.setGeolocation(`${latitude}`, `${longitude}`);
|
|
72
|
+
return { latitude, longitude, altitude: 0 };
|
|
75
73
|
}
|
|
76
74
|
if ((0, utils_1.isIos17OrNewer)(this.opts)) {
|
|
77
75
|
this.log.info(`Proxying to mobile:setSimulatedLocation method for iOS 17+`);
|
|
@@ -89,14 +87,13 @@ async function setGeoLocation(location) {
|
|
|
89
87
|
service.close();
|
|
90
88
|
}
|
|
91
89
|
}
|
|
92
|
-
return
|
|
90
|
+
return { latitude, longitude, altitude: 0 };
|
|
93
91
|
}
|
|
94
92
|
/**
|
|
95
93
|
* Reset the location service on real device.
|
|
96
94
|
*
|
|
97
95
|
* @throws {Error} If the device is simulator and iOS version is below 17,
|
|
98
96
|
* or 'resetLocation' raises an error.
|
|
99
|
-
* @this {XCUITestDriver}
|
|
100
97
|
*/
|
|
101
98
|
async function mobileResetLocationService() {
|
|
102
99
|
if ((0, utils_1.isIos17OrNewer)(this.opts)) {
|
|
@@ -119,9 +116,4 @@ async function mobileResetLocationService() {
|
|
|
119
116
|
service.close();
|
|
120
117
|
}
|
|
121
118
|
}
|
|
122
|
-
/**
|
|
123
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
124
|
-
* @typedef {import('./types').WDALocationInfo} WDALocationInfo
|
|
125
|
-
* @typedef {import('@appium/types').Location} Location
|
|
126
|
-
*/
|
|
127
119
|
//# sourceMappingURL=location.js.map
|