appium-xcuitest-driver 10.14.1 → 10.14.2
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 +6 -0
- 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/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/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/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/{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/{screenshots.js → screenshots.ts} +24 -16
- package/lib/commands/{source.js → source.ts} +23 -20
- package/lib/driver.ts +1 -1
- package/lib/execute-method-map.ts +0 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [10.14.2](https://github.com/appium/appium-xcuitest-driver/compare/v10.14.1...v10.14.2) (2026-01-01)
|
|
2
|
+
|
|
3
|
+
### Miscellaneous Chores
|
|
4
|
+
|
|
5
|
+
* 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))
|
|
6
|
+
|
|
1
7
|
## [10.14.1](https://github.com/appium/appium-xcuitest-driver/compare/v10.14.0...v10.14.1) (2025-12-31)
|
|
2
8
|
|
|
3
9
|
### Miscellaneous Chores
|
|
@@ -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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AC;QACvF,iBAAiB,CAAC,SAAS,GAAG,cAAI,CAAC,aAAa,CAC9C,iBAAiB,CAAC,SAAqC,CACxD,CAAC;IACJ,CAAC;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC"}
|
|
@@ -1,3 +1,6 @@
|
|
|
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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"location.js","sourceRoot":"","sources":["../../../lib/commands/location.
|
|
1
|
+
{"version":3,"file":"location.js","sourceRoot":"","sources":["../../../lib/commands/location.ts"],"names":[],"mappings":";;AA2BA,wCAkCC;AAUD,wCAgCC;AAQD,gEAsBC;AArID,yDAA2C;AAC3C,0CAAqC;AACrC,4CAAoC;AACpC,iCAA2C;AAC3C,oCAA0C;AAM1C;;;;;;;;;;;;;;;;GAgBG;AACI,KAAK,UAAU,cAAc;IAClC,oFAAoF;IACpF,mFAAmF;IACnF,IAAI,IAAA,sBAAc,EAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,MAAM,EAAC,QAAQ,EAAE,SAAS,EAAC,GAAG,MAAM,IAAI,CAAC,0BAA0B,EAAE,CAAC;QACtE,IAAI,QAAQ,IAAI,SAAS,EAAE,CAAC;YAC1B,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,yFAAyF;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AC,CAAC;IAC5E,IAAI,CAAC;QACH,OAAO,CAAC,aAAa,EAAE,CAAC;IAC1B,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,MAAM,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAC/B,yDAAyD,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK;YAC1E,mBAAmB,GAAG,CAAC,OAAO,EAAE,CACnC,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -1,44 +1,32 @@
|
|
|
1
|
+
import type { XCUITestDriver } from '../driver';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* Navigate back in the browser history or native app navigation.
|
|
3
4
|
*/
|
|
4
|
-
export function back(this:
|
|
5
|
+
export declare function back(this: XCUITestDriver): Promise<void>;
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
+
* Navigate forward in the browser history.
|
|
7
8
|
*/
|
|
8
|
-
export function forward(this:
|
|
9
|
+
export declare function forward(this: XCUITestDriver): Promise<void>;
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
+
* Closes the current window in a web context.
|
|
12
|
+
*
|
|
13
|
+
* @returns Promise that resolves when the window is closed
|
|
11
14
|
*/
|
|
12
|
-
export function closeWindow(this:
|
|
15
|
+
export declare function closeWindow(this: XCUITestDriver): Promise<any>;
|
|
13
16
|
/**
|
|
14
17
|
* Opens the given URL with the default application assigned to handle it based on the URL
|
|
15
18
|
* scheme, or the application provided as an optional parameter
|
|
16
19
|
*
|
|
17
20
|
* (Note: the version of Xcode must be 14.3+ and iOS must be 16.4+)
|
|
18
21
|
*
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
22
|
+
* @param url - the URL to be opened, e.g. `myscheme://yolo`
|
|
23
|
+
* @param bundleId - the application to open the given URL with. If not provided, then
|
|
21
24
|
* the application assigned by the operating system to handle URLs of the appropriate type
|
|
22
|
-
* @returns {Promise<void>}
|
|
23
25
|
* @since 4.17
|
|
24
|
-
* @this {XCUITestDriver}
|
|
25
26
|
*/
|
|
26
|
-
export function mobileDeepLink(this:
|
|
27
|
+
export declare function mobileDeepLink(this: XCUITestDriver, url: string, bundleId?: string): Promise<void>;
|
|
27
28
|
/**
|
|
28
|
-
*
|
|
29
|
+
* Navigate back in native app navigation by finding and clicking the back button.
|
|
29
30
|
*/
|
|
30
|
-
export function nativeBack(this:
|
|
31
|
-
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
32
|
-
export type DeepLinkOptions = {
|
|
33
|
-
/**
|
|
34
|
-
* The URL to be opened. This parameter is manadatory
|
|
35
|
-
*/
|
|
36
|
-
url: string;
|
|
37
|
-
/**
|
|
38
|
-
* The bundle identifier of an application to open the
|
|
39
|
-
* given url with. If not provided then the default application for the given url scheme
|
|
40
|
-
* is going to be used.
|
|
41
|
-
*/
|
|
42
|
-
bundleId: string | null;
|
|
43
|
-
};
|
|
31
|
+
export declare function nativeBack(this: XCUITestDriver): Promise<void>;
|
|
44
32
|
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../lib/commands/navigation.
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../lib/commands/navigation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAO9C;;GAEG;AACH,wBAAsB,IAAI,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAM9D;AAED;;GAEG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAMjE;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,CAsBpE;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,cAAc,EACpB,GAAG,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAKf;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAwCpE"}
|
|
@@ -12,7 +12,7 @@ const utils_1 = require("../utils");
|
|
|
12
12
|
const CLOSE_WINDOW_TIMEOUT = 5000;
|
|
13
13
|
const CLOSE_WINDOW_INTERVAL = 100;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Navigate back in the browser history or native app navigation.
|
|
16
16
|
*/
|
|
17
17
|
async function back() {
|
|
18
18
|
if (!this.isWebContext()) {
|
|
@@ -23,15 +23,19 @@ async function back() {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Navigate forward in the browser history.
|
|
27
27
|
*/
|
|
28
28
|
async function forward() {
|
|
29
29
|
if (!this.isWebContext()) {
|
|
30
|
+
// No-op for native context
|
|
31
|
+
return;
|
|
30
32
|
}
|
|
31
33
|
await this.mobileWebNav('forward');
|
|
32
34
|
}
|
|
33
35
|
/**
|
|
34
|
-
*
|
|
36
|
+
* Closes the current window in a web context.
|
|
37
|
+
*
|
|
38
|
+
* @returns Promise that resolves when the window is closed
|
|
35
39
|
*/
|
|
36
40
|
async function closeWindow() {
|
|
37
41
|
if (!this.isWebContext()) {
|
|
@@ -63,12 +67,10 @@ async function closeWindow() {
|
|
|
63
67
|
*
|
|
64
68
|
* (Note: the version of Xcode must be 14.3+ and iOS must be 16.4+)
|
|
65
69
|
*
|
|
66
|
-
* @param
|
|
67
|
-
* @param
|
|
70
|
+
* @param url - the URL to be opened, e.g. `myscheme://yolo`
|
|
71
|
+
* @param bundleId - the application to open the given URL with. If not provided, then
|
|
68
72
|
* the application assigned by the operating system to handle URLs of the appropriate type
|
|
69
|
-
* @returns {Promise<void>}
|
|
70
73
|
* @since 4.17
|
|
71
|
-
* @this {XCUITestDriver}
|
|
72
74
|
*/
|
|
73
75
|
async function mobileDeepLink(url, bundleId) {
|
|
74
76
|
return await this.proxyCommand('/url', 'POST', {
|
|
@@ -77,7 +79,7 @@ async function mobileDeepLink(url, bundleId) {
|
|
|
77
79
|
});
|
|
78
80
|
}
|
|
79
81
|
/**
|
|
80
|
-
*
|
|
82
|
+
* Navigate back in native app navigation by finding and clicking the back button.
|
|
81
83
|
*/
|
|
82
84
|
async function nativeBack() {
|
|
83
85
|
if ((0, utils_1.isTvOs)(this.opts.platformName)) {
|
|
@@ -106,14 +108,4 @@ async function nativeBack() {
|
|
|
106
108
|
this.log.error(`Unable to find navigation bar and back button: ${err.message}`);
|
|
107
109
|
}
|
|
108
110
|
}
|
|
109
|
-
/**
|
|
110
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
111
|
-
*/
|
|
112
|
-
/**
|
|
113
|
-
* @typedef {Object} DeepLinkOptions
|
|
114
|
-
* @property {string} url The URL to be opened. This parameter is manadatory
|
|
115
|
-
* @property {string?} bundleId The bundle identifier of an application to open the
|
|
116
|
-
* given url with. If not provided then the default application for the given url scheme
|
|
117
|
-
* is going to be used.
|
|
118
|
-
*/
|
|
119
111
|
//# sourceMappingURL=navigation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../../lib/commands/navigation.
|
|
1
|
+
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../../lib/commands/navigation.ts"],"names":[],"mappings":";;AAaA,oBAMC;AAKD,0BAMC;AAOD,kCAsBC;AAaD,wCASC;AAKD,gCAwCC;AA9HD,0CAAqC;AACrC,uCAA0C;AAC1C,oCAAkC;AAIlC,uDAAuD;AACvD,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAClC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAElC;;GAEG;AACI,KAAK,UAAU,IAAI;I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;QAClB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,kDAAkD,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IAClF,CAAC;AACH,CAAC"}
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
+
import type { XCUITestDriver } from '../driver';
|
|
2
|
+
export declare class TrafficCapture {
|
|
3
|
+
private mainProcess;
|
|
4
|
+
private readonly udid;
|
|
5
|
+
private readonly log;
|
|
6
|
+
private readonly resultPath;
|
|
7
|
+
constructor(udid: string, log: any, resultPath: string);
|
|
8
|
+
start(timeoutSeconds: number): Promise<void>;
|
|
9
|
+
isCapturing(): boolean;
|
|
10
|
+
interrupt(force?: boolean): Promise<boolean>;
|
|
11
|
+
finish(): Promise<string>;
|
|
12
|
+
cleanup(): Promise<void>;
|
|
13
|
+
}
|
|
1
14
|
/**
|
|
2
15
|
* Records the given network traffic capture into a .pcap file.
|
|
3
16
|
*
|
|
4
|
-
* @param
|
|
5
|
-
* @param
|
|
17
|
+
* @param timeLimitSec - The maximum recording time, in seconds. The maximum value is `43200` (12 hours).
|
|
18
|
+
* @param forceRestart - Whether to restart traffic capture process forcefully when startPcap is called (`true`) or ignore the call until the current traffic capture is completed (`false`, the default value).
|
|
6
19
|
* @throws {Error} If network traffic capture has failed to start.
|
|
7
|
-
* @returns {Promise<void>}
|
|
8
|
-
* @this {XCUITestDriver}
|
|
9
20
|
*/
|
|
10
|
-
export function mobileStartPcap(this:
|
|
11
|
-
export class mobileStartPcap {
|
|
12
|
-
/**
|
|
13
|
-
* Records the given network traffic capture into a .pcap file.
|
|
14
|
-
*
|
|
15
|
-
* @param {number} timeLimitSec - The maximum recording time, in seconds. The maximum value is `43200` (12 hours).
|
|
16
|
-
* @param {boolean} forceRestart - Whether to restart traffic capture process forcefully when startPcap is called (`true`) or ignore the call until the current traffic capture is completed (`false`, the default value).
|
|
17
|
-
* @throws {Error} If network traffic capture has failed to start.
|
|
18
|
-
* @returns {Promise<void>}
|
|
19
|
-
* @this {XCUITestDriver}
|
|
20
|
-
*/
|
|
21
|
-
constructor(this: import("../driver").XCUITestDriver, timeLimitSec?: number, forceRestart?: boolean);
|
|
22
|
-
_trafficCapture: TrafficCapture;
|
|
23
|
-
}
|
|
21
|
+
export declare function mobileStartPcap(this: XCUITestDriver, timeLimitSec?: number, forceRestart?: boolean): Promise<void>;
|
|
24
22
|
/**
|
|
25
23
|
* Stops network traffic capture.
|
|
26
24
|
*
|
|
@@ -29,26 +27,8 @@ export class mobileStartPcap {
|
|
|
29
27
|
* If no previously recorded file is found and no active traffic capture processes are running, then the method returns an empty string.
|
|
30
28
|
*
|
|
31
29
|
* @remarks Network capture files can be viewed in [Wireshark](https://www.wireshark.org/) and other similar applications.
|
|
32
|
-
* @returns
|
|
30
|
+
* @returns Base64-encoded content of the recorded pcap file or an empty string if no traffic capture has been started before.
|
|
33
31
|
* @throws {Error} If there was an error while getting the capture file.
|
|
34
|
-
* @this {XCUITestDriver}
|
|
35
32
|
*/
|
|
36
|
-
export function mobileStopPcap(this:
|
|
37
|
-
export class mobileStopPcap {
|
|
38
|
-
_trafficCapture: any;
|
|
39
|
-
}
|
|
40
|
-
export class TrafficCapture {
|
|
41
|
-
constructor(udid: any, log: any, resultPath: any);
|
|
42
|
-
/** @type {import('teen_process').SubProcess|null} */
|
|
43
|
-
mainProcess: import("teen_process").SubProcess | null;
|
|
44
|
-
udid: any;
|
|
45
|
-
log: any;
|
|
46
|
-
resultPath: any;
|
|
47
|
-
start(timeoutSeconds: any): Promise<void>;
|
|
48
|
-
isCapturing(): boolean;
|
|
49
|
-
interrupt(force?: boolean): Promise<boolean>;
|
|
50
|
-
finish(): Promise<any>;
|
|
51
|
-
cleanup(): Promise<void>;
|
|
52
|
-
}
|
|
53
|
-
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
33
|
+
export declare function mobileStopPcap(this: XCUITestDriver): Promise<string>;
|
|
54
34
|
//# sourceMappingURL=pcap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pcap.d.ts","sourceRoot":"","sources":["../../../lib/commands/pcap.
|
|
1
|
+
{"version":3,"file":"pcap.d.ts","sourceRoot":"","sources":["../../../lib/commands/pcap.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAM9C,qBAAa,cAAc;IACzB,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAM;IAC1B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;gBAExB,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM;IAMhD,KAAK,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBlD,WAAW,IAAI,OAAO;IAIhB,SAAS,CAAC,KAAK,UAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;IAkB1C,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;IAKzB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAK/B;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,cAAc,EACpB,YAAY,SAAM,EAClB,YAAY,UAAQ,GACnB,OAAO,CAAC,IAAI,CAAC,CA6Cf;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAsB1E"}
|
|
@@ -10,19 +10,20 @@ const driver_1 = require("appium/driver");
|
|
|
10
10
|
const MAX_CAPTURE_TIME_SEC = 60 * 60 * 12;
|
|
11
11
|
const DEFAULT_EXT = '.pcap';
|
|
12
12
|
class TrafficCapture {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
mainProcess = null;
|
|
14
|
+
udid;
|
|
15
|
+
log;
|
|
16
|
+
resultPath;
|
|
15
17
|
constructor(udid, log, resultPath) {
|
|
16
18
|
this.udid = udid;
|
|
17
19
|
this.log = log;
|
|
18
20
|
this.resultPath = resultPath;
|
|
19
|
-
this.mainProcess = null;
|
|
20
21
|
}
|
|
21
22
|
async start(timeoutSeconds) {
|
|
22
|
-
this.mainProcess =
|
|
23
|
+
this.mainProcess = await new py_ios_device_client_1.Pyidevice({
|
|
23
24
|
udid: this.udid,
|
|
24
25
|
log: this.log,
|
|
25
|
-
}).collectPcap(this.resultPath)
|
|
26
|
+
}).collectPcap(this.resultPath);
|
|
26
27
|
this.mainProcess.on('line-stderr', (line) => this.log.info(`[Pcap] ${line}`));
|
|
27
28
|
this.log.info(`Starting network traffic capture session on the device '${this.udid}'. ` +
|
|
28
29
|
`Will timeout in ${timeoutSeconds}s`);
|
|
@@ -64,11 +65,9 @@ exports.TrafficCapture = TrafficCapture;
|
|
|
64
65
|
/**
|
|
65
66
|
* Records the given network traffic capture into a .pcap file.
|
|
66
67
|
*
|
|
67
|
-
* @param
|
|
68
|
-
* @param
|
|
68
|
+
* @param timeLimitSec - The maximum recording time, in seconds. The maximum value is `43200` (12 hours).
|
|
69
|
+
* @param forceRestart - Whether to restart traffic capture process forcefully when startPcap is called (`true`) or ignore the call until the current traffic capture is completed (`false`, the default value).
|
|
69
70
|
* @throws {Error} If network traffic capture has failed to start.
|
|
70
|
-
* @returns {Promise<void>}
|
|
71
|
-
* @this {XCUITestDriver}
|
|
72
71
|
*/
|
|
73
72
|
async function mobileStartPcap(timeLimitSec = 180, forceRestart = false) {
|
|
74
73
|
if (this.isSimulator()) {
|
|
@@ -118,9 +117,8 @@ async function mobileStartPcap(timeLimitSec = 180, forceRestart = false) {
|
|
|
118
117
|
* If no previously recorded file is found and no active traffic capture processes are running, then the method returns an empty string.
|
|
119
118
|
*
|
|
120
119
|
* @remarks Network capture files can be viewed in [Wireshark](https://www.wireshark.org/) and other similar applications.
|
|
121
|
-
* @returns
|
|
120
|
+
* @returns Base64-encoded content of the recorded pcap file or an empty string if no traffic capture has been started before.
|
|
122
121
|
* @throws {Error} If there was an error while getting the capture file.
|
|
123
|
-
* @this {XCUITestDriver}
|
|
124
122
|
*/
|
|
125
123
|
async function mobileStopPcap() {
|
|
126
124
|
if (!this._trafficCapture) {
|
|
@@ -143,7 +141,4 @@ async function mobileStopPcap() {
|
|
|
143
141
|
}
|
|
144
142
|
return await (0, utils_1.encodeBase64OrUpload)(resultPath);
|
|
145
143
|
}
|
|
146
|
-
/**
|
|
147
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
148
|
-
*/
|
|
149
144
|
//# sourceMappingURL=pcap.js.map
|