appium-xcuitest-driver 10.14.0 → 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 +12 -0
- package/build/lib/commands/condition.d.ts +9 -72
- package/build/lib/commands/condition.d.ts.map +1 -1
- package/build/lib/commands/condition.js +5 -66
- package/build/lib/commands/condition.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/record-audio.d.ts +25 -53
- package/build/lib/commands/record-audio.d.ts.map +1 -1
- package/build/lib/commands/record-audio.js +17 -19
- package/build/lib/commands/record-audio.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/commands/types.d.ts +58 -0
- package/build/lib/commands/types.d.ts.map +1 -1
- package/build/lib/commands/xctest-record-screen.d.ts +17 -47
- package/build/lib/commands/xctest-record-screen.d.ts.map +1 -1
- package/build/lib/commands/xctest-record-screen.js +28 -59
- package/build/lib/commands/xctest-record-screen.js.map +1 -1
- package/build/lib/driver.d.ts +1 -1
- package/build/lib/driver.d.ts.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 -6
- package/build/lib/execute-method-map.js.map +1 -1
- package/lib/commands/{condition.js → condition.ts} +21 -77
- 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/{record-audio.js → record-audio.ts} +35 -33
- package/lib/commands/{screenshots.js → screenshots.ts} +24 -16
- package/lib/commands/{source.js → source.ts} +23 -20
- package/lib/commands/types.ts +63 -0
- package/lib/commands/{xctest-record-screen.js → xctest-record-screen.ts} +54 -71
- package/lib/driver.ts +2 -2
- package/lib/execute-method-map.ts +0 -6
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -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.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CAAC;YAChE,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,wEAAwE,CAAC,CAAC;YACzF,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAC7B,CAAC;QAED,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pcap.js","sourceRoot":"","sources":["../../../lib/commands/pcap.
|
|
1
|
+
{"version":3,"file":"pcap.js","sourceRoot":"","sources":["../../../lib/commands/pcap.ts"],"names":[],"mappings":";;;AAkFA,0CAiDC;AAaD,wCAsBC;AAtKD,iFAAmE;AACnE,4CAAiD;AACjD,oCAA8C;AAC9C,0CAAqC;AAIrC,MAAM,oBAAoB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAC1C,MAAM,WAAW,GAAG,OAAO,CAAC;AAE5B,MAAa,cAAc;IACjB,WAAW,GAAsB,IAAI,CAAC;IAC7B,IAAI,CAAS;IACb,GAAG,CAAM;IACT,UAAU,CAAS;IAEpC,YAAY,IAAY,EAAE,GAAQ,EAAE,UAAkB;QACpD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC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ClC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;QAC1B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,0EAA0E,CAAC,CAAC;QAC1F,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,UAAkB,CAAC;IACvB,IAAI,CAAC;QACH,UAAU,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC;QACjD,IAAI,CAAC,CAAC,MAAM,YAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAC/B,iDAAiD;gBAC/C,2CAA2C,UAAU,GAAG,CAC3D,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;QACrC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC5B,MAAM,CAAC,CAAC;IACV,CAAC;IACD,OAAO,MAAM,IAAA,4BAAoB,EAAC,UAAU,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -1,70 +1,42 @@
|
|
|
1
|
+
import type { XCUITestDriver } from '../driver';
|
|
2
|
+
import type { AudioRecorderOptions } from './types';
|
|
3
|
+
export declare class AudioRecorder {
|
|
4
|
+
private readonly input;
|
|
5
|
+
private readonly log;
|
|
6
|
+
private readonly audioPath;
|
|
7
|
+
private readonly opts;
|
|
8
|
+
private mainProcess;
|
|
9
|
+
constructor(input: string | number, log: any, audioPath: string, opts?: AudioRecorderOptions);
|
|
10
|
+
start(timeoutSeconds: number): Promise<void>;
|
|
11
|
+
isRecording(): boolean;
|
|
12
|
+
interrupt(force?: boolean): Promise<boolean>;
|
|
13
|
+
finish(): Promise<string>;
|
|
14
|
+
cleanup(): Promise<void>;
|
|
15
|
+
}
|
|
1
16
|
/**
|
|
2
17
|
* Records the given hardware audio input and saves it into an `.mp4` file.
|
|
3
18
|
*
|
|
4
19
|
* **To use this command, the `audio_record` security feature must be enabled _and_ [FFMpeg](https://ffmpeg.org/) must be installed on the Appium server.**
|
|
5
20
|
*
|
|
6
|
-
* @param
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
21
|
+
* @param audioInput - The name of the corresponding audio input device to use for the capture. The full list of capture devices could be shown by executing `ffmpeg -f avfoundation -list_devices true -i ""`
|
|
22
|
+
* @param timeLimit - The maximum recording time, in seconds.
|
|
23
|
+
* @param audioCodec - The name of the audio codec.
|
|
24
|
+
* @param audioBitrate - The bitrate of the resulting audio stream.
|
|
25
|
+
* @param audioChannels - The count of audio channels in the resulting stream. Setting it to `1` will create a single channel (mono) audio stream.
|
|
26
|
+
* @param audioRate - The sampling rate of the resulting audio stream (in Hz).
|
|
27
|
+
* @param forceRestart - Whether to restart audio capture process forcefully when `mobile: startRecordingAudio` is called (`true`) or ignore the call until the current audio recording is completed (`false`).
|
|
13
28
|
* @group Real Device Only
|
|
14
|
-
* @this {XCUITestDriver}
|
|
15
|
-
* @returns {Promise<void>}
|
|
16
|
-
* @privateRemarks Using string literals for the default parameters makes better documentation.
|
|
17
29
|
*/
|
|
18
|
-
export function startAudioRecording(this:
|
|
19
|
-
export class startAudioRecording {
|
|
20
|
-
/**
|
|
21
|
-
* Records the given hardware audio input and saves it into an `.mp4` file.
|
|
22
|
-
*
|
|
23
|
-
* **To use this command, the `audio_record` security feature must be enabled _and_ [FFMpeg](https://ffmpeg.org/) must be installed on the Appium server.**
|
|
24
|
-
*
|
|
25
|
-
* @param {string|number} audioInput - The name of the corresponding audio input device to use for the capture. The full list of capture devices could be shown by executing `ffmpeg -f avfoundation -list_devices true -i ""`
|
|
26
|
-
* @param {string|number} timeLimit - The maximum recording time, in seconds.
|
|
27
|
-
* @param {string} audioCodec - The name of the audio codec.
|
|
28
|
-
* @param {string} audioBitrate - The bitrate of the resulting audio stream.
|
|
29
|
-
* @param {string|number} audioChannels - The count of audio channels in the resulting stream. Setting it to `1` will create a single channel (mono) audio stream.
|
|
30
|
-
* @param {string|number} audioRate - The sampling rate of the resulting audio stream (in Hz).
|
|
31
|
-
* @param {boolean} forceRestart - Whether to restart audio capture process forcefully when `mobile: startRecordingAudio` is called (`true`) or ignore the call until the current audio recording is completed (`false`).
|
|
32
|
-
* @group Real Device Only
|
|
33
|
-
* @this {XCUITestDriver}
|
|
34
|
-
* @returns {Promise<void>}
|
|
35
|
-
* @privateRemarks Using string literals for the default parameters makes better documentation.
|
|
36
|
-
*/
|
|
37
|
-
constructor(this: import("../driver").XCUITestDriver, audioInput: string | number, timeLimit?: string | number, audioCodec?: string, audioBitrate?: string, audioChannels?: string | number, audioRate?: string | number, forceRestart?: boolean);
|
|
38
|
-
_audioRecorder: AudioRecorder;
|
|
39
|
-
}
|
|
30
|
+
export declare function startAudioRecording(this: XCUITestDriver, audioInput: string | number, timeLimit?: string | number, audioCodec?: string, audioBitrate?: string, audioChannels?: string | number, audioRate?: string | number, forceRestart?: boolean): Promise<void>;
|
|
40
31
|
/**
|
|
41
32
|
* Stop recording of the audio input. If no audio recording process is running then
|
|
42
33
|
* the endpoint will try to get the recently recorded file.
|
|
43
34
|
* If no previously recorded file is found and no active audio recording
|
|
44
35
|
* processes are running then the method returns an empty string.
|
|
45
36
|
*
|
|
46
|
-
* @returns
|
|
37
|
+
* @returns Base64-encoded content of the recorded media file or an
|
|
47
38
|
* empty string if no audio recording has been started before.
|
|
48
39
|
* @throws {Error} If there was an error while getting the recorded file.
|
|
49
|
-
* @this {XCUITestDriver}
|
|
50
40
|
*/
|
|
51
|
-
export function stopAudioRecording(this:
|
|
52
|
-
export class stopAudioRecording {
|
|
53
|
-
_audioRecorder: any;
|
|
54
|
-
}
|
|
55
|
-
export class AudioRecorder {
|
|
56
|
-
constructor(input: any, log: any, audioPath: any, opts?: {});
|
|
57
|
-
input: any;
|
|
58
|
-
log: any;
|
|
59
|
-
audioPath: any;
|
|
60
|
-
opts: {};
|
|
61
|
-
mainProcess: SubProcess<import("teen_process").SubProcessOptions> | null;
|
|
62
|
-
start(timeoutSeconds: any): Promise<void>;
|
|
63
|
-
isRecording(): boolean;
|
|
64
|
-
interrupt(force?: boolean): Promise<boolean>;
|
|
65
|
-
finish(): Promise<any>;
|
|
66
|
-
cleanup(): Promise<void>;
|
|
67
|
-
}
|
|
68
|
-
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
69
|
-
import { SubProcess } from 'teen_process';
|
|
41
|
+
export declare function stopAudioRecording(this: XCUITestDriver): Promise<string>;
|
|
70
42
|
//# sourceMappingURL=record-audio.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-audio.d.ts","sourceRoot":"","sources":["../../../lib/commands/record-audio.
|
|
1
|
+
{"version":3,"file":"record-audio.d.ts","sourceRoot":"","sources":["../../../lib/commands/record-audio.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,SAAS,CAAC;AAWlD,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAkB;IACxC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAM;IAC1B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAuB;IAC5C,OAAO,CAAC,WAAW,CAAoB;gBAE3B,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,GAAE,oBAAiD;IAQlH,KAAK,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgFlD,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;;;;;;;;;;;;;GAaG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,cAAc,EACpB,UAAU,EAAE,MAAM,GAAG,MAAM,EAC3B,SAAS,GAAE,MAAM,GAAG,MAAY,EAChC,UAAU,SAAQ,EAClB,YAAY,SAAS,EACrB,aAAa,GAAE,MAAM,GAAG,MAAU,EAClC,SAAS,GAAE,MAAM,GAAG,MAAc,EAClC,YAAY,UAAQ,GACnB,OAAO,CAAC,IAAI,CAAC,CA+Df;AAED;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAqB9E"}
|
|
@@ -15,6 +15,11 @@ const DEFAULT_EXT = '.mp4';
|
|
|
15
15
|
const FFMPEG_BINARY = 'ffmpeg';
|
|
16
16
|
const ffmpegLogger = support_1.logger.getLogger(FFMPEG_BINARY);
|
|
17
17
|
class AudioRecorder {
|
|
18
|
+
input;
|
|
19
|
+
log;
|
|
20
|
+
audioPath;
|
|
21
|
+
opts;
|
|
22
|
+
mainProcess;
|
|
18
23
|
constructor(input, log, audioPath, opts = {}) {
|
|
19
24
|
this.input = input;
|
|
20
25
|
this.log = log;
|
|
@@ -37,7 +42,7 @@ class AudioRecorder {
|
|
|
37
42
|
'-f',
|
|
38
43
|
audioSource,
|
|
39
44
|
'-i',
|
|
40
|
-
this.input,
|
|
45
|
+
String(this.input),
|
|
41
46
|
'-c:a',
|
|
42
47
|
audioCodec,
|
|
43
48
|
'-b:a',
|
|
@@ -83,7 +88,7 @@ class AudioRecorder {
|
|
|
83
88
|
])}'. ` + `Will timeout in ${timeoutSeconds}s`);
|
|
84
89
|
this.mainProcess.once('exit', (code, signal) => {
|
|
85
90
|
// ffmpeg returns code 255 if SIGINT arrives
|
|
86
|
-
if ([0, 255].includes(code)) {
|
|
91
|
+
if ([0, 255].includes(code ?? 0)) {
|
|
87
92
|
this.log.info(`The recording session on audio input '${this.input}' has been finished`);
|
|
88
93
|
}
|
|
89
94
|
else {
|
|
@@ -126,17 +131,14 @@ exports.AudioRecorder = AudioRecorder;
|
|
|
126
131
|
*
|
|
127
132
|
* **To use this command, the `audio_record` security feature must be enabled _and_ [FFMpeg](https://ffmpeg.org/) must be installed on the Appium server.**
|
|
128
133
|
*
|
|
129
|
-
* @param
|
|
130
|
-
* @param
|
|
131
|
-
* @param
|
|
132
|
-
* @param
|
|
133
|
-
* @param
|
|
134
|
-
* @param
|
|
135
|
-
* @param
|
|
134
|
+
* @param audioInput - The name of the corresponding audio input device to use for the capture. The full list of capture devices could be shown by executing `ffmpeg -f avfoundation -list_devices true -i ""`
|
|
135
|
+
* @param timeLimit - The maximum recording time, in seconds.
|
|
136
|
+
* @param audioCodec - The name of the audio codec.
|
|
137
|
+
* @param audioBitrate - The bitrate of the resulting audio stream.
|
|
138
|
+
* @param audioChannels - The count of audio channels in the resulting stream. Setting it to `1` will create a single channel (mono) audio stream.
|
|
139
|
+
* @param audioRate - The sampling rate of the resulting audio stream (in Hz).
|
|
140
|
+
* @param forceRestart - Whether to restart audio capture process forcefully when `mobile: startRecordingAudio` is called (`true`) or ignore the call until the current audio recording is completed (`false`).
|
|
136
141
|
* @group Real Device Only
|
|
137
|
-
* @this {XCUITestDriver}
|
|
138
|
-
* @returns {Promise<void>}
|
|
139
|
-
* @privateRemarks Using string literals for the default parameters makes better documentation.
|
|
140
142
|
*/
|
|
141
143
|
async function startAudioRecording(audioInput, timeLimit = 180, audioCodec = 'aac', audioBitrate = '128k', audioChannels = 2, audioRate = 44100, forceRestart = false) {
|
|
142
144
|
if (!this.isFeatureEnabled(AUDIO_RECORD_FEAT_NAME)) {
|
|
@@ -173,8 +175,8 @@ async function startAudioRecording(audioInput, timeLimit = 180, audioCodec = 'aa
|
|
|
173
175
|
audioSource: DEFAULT_SOURCE,
|
|
174
176
|
audioCodec,
|
|
175
177
|
audioBitrate,
|
|
176
|
-
audioChannels,
|
|
177
|
-
audioRate,
|
|
178
|
+
audioChannels: Number(audioChannels),
|
|
179
|
+
audioRate: Number(audioRate),
|
|
178
180
|
});
|
|
179
181
|
const timeoutSeconds = parseInt(String(timeLimit), 10);
|
|
180
182
|
if (isNaN(timeoutSeconds) || timeoutSeconds > MAX_RECORDING_TIME_SEC || timeoutSeconds <= 0) {
|
|
@@ -197,10 +199,9 @@ async function startAudioRecording(audioInput, timeLimit = 180, audioCodec = 'aa
|
|
|
197
199
|
* If no previously recorded file is found and no active audio recording
|
|
198
200
|
* processes are running then the method returns an empty string.
|
|
199
201
|
*
|
|
200
|
-
* @returns
|
|
202
|
+
* @returns Base64-encoded content of the recorded media file or an
|
|
201
203
|
* empty string if no audio recording has been started before.
|
|
202
204
|
* @throws {Error} If there was an error while getting the recorded file.
|
|
203
|
-
* @this {XCUITestDriver}
|
|
204
205
|
*/
|
|
205
206
|
async function stopAudioRecording() {
|
|
206
207
|
if (!this._audioRecorder) {
|
|
@@ -222,7 +223,4 @@ async function stopAudioRecording() {
|
|
|
222
223
|
}
|
|
223
224
|
return await (0, utils_1.encodeBase64OrUpload)(resultPath);
|
|
224
225
|
}
|
|
225
|
-
/**
|
|
226
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
227
|
-
*/
|
|
228
226
|
//# sourceMappingURL=record-audio.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-audio.js","sourceRoot":"","sources":["../../../lib/commands/record-audio.
|
|
1
|
+
{"version":3,"file":"record-audio.js","sourceRoot":"","sources":["../../../lib/commands/record-audio.ts"],"names":[],"mappings":";;;AA+JA,kDAwEC;AAYD,gDAqBC;AAxQD,4CAAyD;AACzD,+CAAwC;AACxC,oCAA8C;AAC9C,uCAA0C;AAI1C,MAAM,sBAAsB,GAAG,KAAK,CAAC;AACrC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AG,aAAa,CAAC;AACtC,CAAC;AAED;;;;;;;;;GASG;AACI,KAAK,UAAU,kBAAkB;IACtC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;QACzB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,gEAAgE,CAAC,CAAC;QAChF,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,UAAkB,CAAC;IACvB,IAAI,CAAC;QACH,UAAU,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;QAChD,IAAI,CAAC,CAAC,MAAM,YAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAC/B,GAAG,aAAa,cAAc,GAAG,2CAA2C,UAAU,GAAG,CAC1F,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC1C,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;QACpC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,MAAM,CAAC,CAAC;IACV,CAAC;IACD,OAAO,MAAM,IAAA,4BAAoB,EAAC,UAAU,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
+
import type { XCUITestDriver } from '../driver';
|
|
2
|
+
import type { Element } from '@appium/types';
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
+
* Takes a screenshot of the current screen.
|
|
5
|
+
*
|
|
6
|
+
* @returns Base64-encoded screenshot data
|
|
4
7
|
*/
|
|
5
|
-
export function getScreenshot(this:
|
|
8
|
+
export declare function getScreenshot(this: XCUITestDriver): Promise<string>;
|
|
6
9
|
/**
|
|
7
|
-
*
|
|
10
|
+
* Takes a screenshot of a specific element.
|
|
11
|
+
*
|
|
12
|
+
* @param el - Element to capture
|
|
13
|
+
* @returns Base64-encoded screenshot data
|
|
8
14
|
*/
|
|
9
|
-
export function getElementScreenshot(this:
|
|
15
|
+
export declare function getElementScreenshot(this: XCUITestDriver, el: Element<string> | string): Promise<string>;
|
|
10
16
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
17
|
+
* Takes a screenshot of the current viewport.
|
|
18
|
+
*
|
|
19
|
+
* @returns Base64-encoded screenshot data
|
|
13
20
|
*/
|
|
14
|
-
export function getViewportScreenshot(this:
|
|
15
|
-
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
21
|
+
export declare function getViewportScreenshot(this: XCUITestDriver): Promise<string>;
|
|
16
22
|
//# sourceMappingURL=screenshots.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshots.d.ts","sourceRoot":"","sources":["../../../lib/commands/screenshots.
|
|
1
|
+
{"version":3,"file":"screenshots.d.ts","sourceRoot":"","sources":["../../../lib/commands/screenshots.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAE9C,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AAE3C;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA8DzE;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,cAAc,EACpB,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,GAC3B,OAAO,CAAC,MAAM,CAAC,CAmBjB;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA6BjF"}
|