appium-adb 14.1.2 → 14.1.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 +6 -0
- package/build/lib/tools/aab-utils.d.ts +5 -4
- package/build/lib/tools/aab-utils.d.ts.map +1 -1
- package/build/lib/tools/aab-utils.js +13 -11
- package/build/lib/tools/aab-utils.js.map +1 -1
- package/build/lib/tools/android-manifest.d.ts +26 -30
- package/build/lib/tools/android-manifest.d.ts.map +1 -1
- package/build/lib/tools/android-manifest.js +33 -47
- package/build/lib/tools/android-manifest.js.map +1 -1
- package/build/lib/tools/apks-utils.d.ts +25 -29
- package/build/lib/tools/apks-utils.d.ts.map +1 -1
- package/build/lib/tools/apks-utils.js +41 -52
- package/build/lib/tools/apks-utils.js.map +1 -1
- package/build/lib/tools/fs-commands.d.ts +25 -30
- package/build/lib/tools/fs-commands.d.ts.map +1 -1
- package/build/lib/tools/fs-commands.js +19 -26
- package/build/lib/tools/fs-commands.js.map +1 -1
- package/build/lib/tools/general-commands.d.ts +36 -58
- package/build/lib/tools/general-commands.d.ts.map +1 -1
- package/build/lib/tools/general-commands.js +41 -47
- package/build/lib/tools/general-commands.js.map +1 -1
- package/build/lib/tools/keyboard-commands.d.ts +27 -36
- package/build/lib/tools/keyboard-commands.d.ts.map +1 -1
- package/build/lib/tools/keyboard-commands.js +24 -34
- package/build/lib/tools/keyboard-commands.js.map +1 -1
- package/build/lib/tools/lockmgmt.d.ts +25 -36
- package/build/lib/tools/lockmgmt.d.ts.map +1 -1
- package/build/lib/tools/lockmgmt.js +34 -38
- package/build/lib/tools/lockmgmt.js.map +1 -1
- package/build/lib/tools/logcat-commands.d.ts +11 -30
- package/build/lib/tools/logcat-commands.d.ts.map +1 -1
- package/build/lib/tools/logcat-commands.js +16 -17
- package/build/lib/tools/logcat-commands.js.map +1 -1
- package/build/lib/tools/network-commands.d.ts +24 -31
- package/build/lib/tools/network-commands.d.ts.map +1 -1
- package/build/lib/tools/network-commands.js +14 -24
- package/build/lib/tools/network-commands.js.map +1 -1
- package/lib/tools/{aab-utils.js → aab-utils.ts} +24 -15
- package/lib/tools/{android-manifest.js → android-manifest.ts} +66 -59
- package/lib/tools/{apks-utils.js → apks-utils.ts} +76 -68
- package/lib/tools/{fs-commands.js → fs-commands.ts} +41 -35
- package/lib/tools/{general-commands.js → general-commands.ts} +71 -68
- package/lib/tools/{keyboard-commands.js → keyboard-commands.ts} +42 -49
- package/lib/tools/{lockmgmt.js → lockmgmt.ts} +71 -56
- package/lib/tools/{logcat-commands.js → logcat-commands.ts} +24 -22
- package/lib/tools/{network-commands.js → network-commands.ts} +42 -34
- package/package.json +1 -1
|
@@ -1,58 +1,39 @@
|
|
|
1
|
+
import type { ADB } from '../adb.js';
|
|
2
|
+
import type { LogcatOpts, LogEntry, LogcatListener } from './types.js';
|
|
1
3
|
/**
|
|
2
4
|
* Start the logcat process to gather logs.
|
|
3
5
|
*
|
|
4
|
-
* @
|
|
5
|
-
* @param {import('./types').LogcatOpts} [opts={}]
|
|
6
|
+
* @param opts - Logcat options
|
|
6
7
|
* @throws {Error} If restart fails.
|
|
7
8
|
*/
|
|
8
|
-
export function startLogcat(this:
|
|
9
|
-
export class startLogcat {
|
|
10
|
-
/**
|
|
11
|
-
* Start the logcat process to gather logs.
|
|
12
|
-
*
|
|
13
|
-
* @this {import('../adb.js').ADB}
|
|
14
|
-
* @param {import('./types').LogcatOpts} [opts={}]
|
|
15
|
-
* @throws {Error} If restart fails.
|
|
16
|
-
*/
|
|
17
|
-
constructor(this: import("../adb.js").ADB, opts?: import("./types").LogcatOpts);
|
|
18
|
-
logcat: Logcat;
|
|
19
|
-
_logcatStartupParams: import("./types").LogcatOpts;
|
|
20
|
-
}
|
|
9
|
+
export declare function startLogcat(this: ADB, opts?: LogcatOpts): Promise<void>;
|
|
21
10
|
/**
|
|
22
11
|
* Stop the active logcat process which gathers logs.
|
|
23
12
|
* The call will be ignored if no logcat process is running.
|
|
24
|
-
* @this {import('../adb.js').ADB}
|
|
25
13
|
*/
|
|
26
|
-
export function stopLogcat(this:
|
|
27
|
-
export class stopLogcat {
|
|
28
|
-
logcat: any;
|
|
29
|
-
}
|
|
14
|
+
export declare function stopLogcat(this: ADB): Promise<void>;
|
|
30
15
|
/**
|
|
31
16
|
* Retrieve the output from the currently running logcat process.
|
|
32
17
|
* The logcat process should be executed by {2link #startLogcat} method.
|
|
33
18
|
*
|
|
34
|
-
* @
|
|
35
|
-
* @return {import('./types').LogEntry[]} The collected logcat output.
|
|
19
|
+
* @return The collected logcat output.
|
|
36
20
|
* @throws {Error} If logcat process is not running.
|
|
37
21
|
*/
|
|
38
|
-
export function getLogcatLogs(this:
|
|
22
|
+
export declare function getLogcatLogs(this: ADB): LogEntry[];
|
|
39
23
|
/**
|
|
40
24
|
* Set the callback for the logcat output event.
|
|
41
25
|
*
|
|
42
|
-
* @
|
|
43
|
-
* @param {import('./types').LogcatListener} listener - Listener function
|
|
26
|
+
* @param listener - Listener function
|
|
44
27
|
* @throws {Error} If logcat process is not running.
|
|
45
28
|
*/
|
|
46
|
-
export function setLogcatListener(this:
|
|
29
|
+
export declare function setLogcatListener(this: ADB, listener: LogcatListener): void;
|
|
47
30
|
/**
|
|
48
31
|
* Removes the previously set callback for the logcat output event.
|
|
49
32
|
*
|
|
50
|
-
* @
|
|
51
|
-
* @param {import('./types').LogcatListener} listener
|
|
33
|
+
* @param listener
|
|
52
34
|
* The listener function, which has been previously
|
|
53
35
|
* passed to `setLogcatListener`
|
|
54
36
|
* @throws {Error} If logcat process is not running.
|
|
55
37
|
*/
|
|
56
|
-
export function removeLogcatListener(this:
|
|
57
|
-
import { Logcat } from '../logcat';
|
|
38
|
+
export declare function removeLogcatListener(this: ADB, listener: LogcatListener): void;
|
|
58
39
|
//# sourceMappingURL=logcat-commands.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logcat-commands.d.ts","sourceRoot":"","sources":["../../../lib/tools/logcat-commands.
|
|
1
|
+
{"version":3,"file":"logcat-commands.d.ts","sourceRoot":"","sources":["../../../lib/tools/logcat-commands.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAC,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AAErE;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,GAAE,UAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAajF;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAUzD;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,GAAG,GAAG,QAAQ,EAAE,CAMnD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,GAAG,IAAI,CAM3E;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,GAAG,IAAI,CAM9E"}
|
|
@@ -13,8 +13,7 @@ const logcat_1 = require("../logcat");
|
|
|
13
13
|
/**
|
|
14
14
|
* Start the logcat process to gather logs.
|
|
15
15
|
*
|
|
16
|
-
* @
|
|
17
|
-
* @param {import('./types').LogcatOpts} [opts={}]
|
|
16
|
+
* @param opts - Logcat options
|
|
18
17
|
* @throws {Error} If restart fails.
|
|
19
18
|
*/
|
|
20
19
|
async function startLogcat(opts = {}) {
|
|
@@ -33,14 +32,14 @@ async function startLogcat(opts = {}) {
|
|
|
33
32
|
/**
|
|
34
33
|
* Stop the active logcat process which gathers logs.
|
|
35
34
|
* The call will be ignored if no logcat process is running.
|
|
36
|
-
* @this {import('../adb.js').ADB}
|
|
37
35
|
*/
|
|
38
36
|
async function stopLogcat() {
|
|
39
|
-
|
|
37
|
+
const logcat = this.logcat;
|
|
38
|
+
if (!logcat || lodash_1.default.isEmpty(this.logcat)) {
|
|
40
39
|
return;
|
|
41
40
|
}
|
|
42
41
|
try {
|
|
43
|
-
await
|
|
42
|
+
await logcat.stopCapture();
|
|
44
43
|
}
|
|
45
44
|
finally {
|
|
46
45
|
this.logcat = undefined;
|
|
@@ -50,42 +49,42 @@ async function stopLogcat() {
|
|
|
50
49
|
* Retrieve the output from the currently running logcat process.
|
|
51
50
|
* The logcat process should be executed by {2link #startLogcat} method.
|
|
52
51
|
*
|
|
53
|
-
* @
|
|
54
|
-
* @return {import('./types').LogEntry[]} The collected logcat output.
|
|
52
|
+
* @return The collected logcat output.
|
|
55
53
|
* @throws {Error} If logcat process is not running.
|
|
56
54
|
*/
|
|
57
55
|
function getLogcatLogs() {
|
|
58
|
-
|
|
56
|
+
const logcat = this.logcat;
|
|
57
|
+
if (!logcat || lodash_1.default.isEmpty(this.logcat)) {
|
|
59
58
|
throw new Error(`Can't get logcat logs since logcat hasn't started`);
|
|
60
59
|
}
|
|
61
|
-
return
|
|
60
|
+
return logcat.getLogs();
|
|
62
61
|
}
|
|
63
62
|
/**
|
|
64
63
|
* Set the callback for the logcat output event.
|
|
65
64
|
*
|
|
66
|
-
* @
|
|
67
|
-
* @param {import('./types').LogcatListener} listener - Listener function
|
|
65
|
+
* @param listener - Listener function
|
|
68
66
|
* @throws {Error} If logcat process is not running.
|
|
69
67
|
*/
|
|
70
68
|
function setLogcatListener(listener) {
|
|
71
|
-
|
|
69
|
+
const logcat = this.logcat;
|
|
70
|
+
if (!logcat || lodash_1.default.isEmpty(this.logcat)) {
|
|
72
71
|
throw new Error("Logcat process hasn't been started");
|
|
73
72
|
}
|
|
74
|
-
|
|
73
|
+
logcat.on('output', listener);
|
|
75
74
|
}
|
|
76
75
|
/**
|
|
77
76
|
* Removes the previously set callback for the logcat output event.
|
|
78
77
|
*
|
|
79
|
-
* @
|
|
80
|
-
* @param {import('./types').LogcatListener} listener
|
|
78
|
+
* @param listener
|
|
81
79
|
* The listener function, which has been previously
|
|
82
80
|
* passed to `setLogcatListener`
|
|
83
81
|
* @throws {Error} If logcat process is not running.
|
|
84
82
|
*/
|
|
85
83
|
function removeLogcatListener(listener) {
|
|
86
|
-
|
|
84
|
+
const logcat = this.logcat;
|
|
85
|
+
if (!logcat || lodash_1.default.isEmpty(this.logcat)) {
|
|
87
86
|
throw new Error("Logcat process hasn't been started");
|
|
88
87
|
}
|
|
89
|
-
|
|
88
|
+
logcat.removeListener('output', listener);
|
|
90
89
|
}
|
|
91
90
|
//# sourceMappingURL=logcat-commands.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logcat-commands.js","sourceRoot":"","sources":["../../../lib/tools/logcat-commands.
|
|
1
|
+
{"version":3,"file":"logcat-commands.js","sourceRoot":"","sources":["../../../lib/tools/logcat-commands.ts"],"names":[],"mappings":";;;;;AAWA,kCAaC;AAMD,gCAUC;AASD,sCAMC;AAQD,8CAMC;AAUD,oDAMC;AArFD,oDAAuB;AACvB,sCAAiC;AAIjC;;;;;GAKG;AACI,KAAK,UAAU,WAAW,CAAY,OAAmB,EAAE;IAChE,IAAI,CAAC,gBAAC,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,CAAC;IAED,IAAI,CAAC,MAAM,GAAG,IAAI,eAAM,CAAC;QACvB,GAAG,EAAE,IAAI,CAAC,UAAU;QACpB,KAAK,EAAE,KAAK;QACZ,UAAU,EAAE,KAAK;QACjB,sBAAsB,EAAE,CAAC,CAAC,IAAI,CAAC,sBAAsB;KACtD,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;AACnC,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,UAAU;IAC9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CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -1,80 +1,73 @@
|
|
|
1
|
+
import type { ADB } from '../adb.js';
|
|
2
|
+
import type { PortFamily, PortInfo } from './types.js';
|
|
1
3
|
/**
|
|
2
4
|
* Get TCP port forwarding with adb on the device under test.
|
|
3
5
|
*
|
|
4
|
-
* @
|
|
5
|
-
* @return {Promise<string[]>} The output of the corresponding adb command.
|
|
6
|
+
* @return The output of the corresponding adb command.
|
|
6
7
|
* An array contains each forwarding line of output
|
|
7
8
|
*/
|
|
8
|
-
export function getForwardList(this:
|
|
9
|
+
export declare function getForwardList(this: ADB): Promise<string[]>;
|
|
9
10
|
/**
|
|
10
11
|
* Setup TCP port forwarding with adb on the device under test.
|
|
11
12
|
*
|
|
12
|
-
* @
|
|
13
|
-
* @param
|
|
14
|
-
* @param {string|number} devicePort - The number of the remote device port.
|
|
13
|
+
* @param systemPort - The number of the local system port.
|
|
14
|
+
* @param devicePort - The number of the remote device port.
|
|
15
15
|
*/
|
|
16
|
-
export function forwardPort(this:
|
|
16
|
+
export declare function forwardPort(this: ADB, systemPort: string | number, devicePort: string | number): Promise<void>;
|
|
17
17
|
/**
|
|
18
18
|
* Remove TCP port forwarding with adb on the device under test. The forwarding
|
|
19
19
|
* for the given port should be setup with {@link #forwardPort} first.
|
|
20
20
|
*
|
|
21
|
-
* @
|
|
22
|
-
* @param {string|number} systemPort - The number of the local system port
|
|
21
|
+
* @param systemPort - The number of the local system port
|
|
23
22
|
* to remove forwarding on.
|
|
24
23
|
*/
|
|
25
|
-
export function removePortForward(this:
|
|
24
|
+
export declare function removePortForward(this: ADB, systemPort: string | number): Promise<void>;
|
|
26
25
|
/**
|
|
27
26
|
* Get TCP port forwarding with adb on the device under test.
|
|
28
27
|
*
|
|
29
|
-
* @
|
|
30
|
-
* @return {Promise<string[]>} The output of the corresponding adb command.
|
|
28
|
+
* @return The output of the corresponding adb command.
|
|
31
29
|
* An array contains each forwarding line of output
|
|
32
30
|
*/
|
|
33
|
-
export function getReverseList(this:
|
|
31
|
+
export declare function getReverseList(this: ADB): Promise<string[]>;
|
|
34
32
|
/**
|
|
35
33
|
* Setup TCP port forwarding with adb on the device under test.
|
|
36
34
|
* Only available for API 21+.
|
|
37
35
|
*
|
|
38
|
-
* @
|
|
39
|
-
* @param
|
|
40
|
-
* @param {string|number} systemPort - The number of the local system port.
|
|
36
|
+
* @param devicePort - The number of the remote device port.
|
|
37
|
+
* @param systemPort - The number of the local system port.
|
|
41
38
|
*/
|
|
42
|
-
export function reversePort(this:
|
|
39
|
+
export declare function reversePort(this: ADB, devicePort: string | number, systemPort: string | number): Promise<void>;
|
|
43
40
|
/**
|
|
44
41
|
* Remove TCP port forwarding with adb on the device under test. The forwarding
|
|
45
42
|
* for the given port should be setup with {@link #forwardPort} first.
|
|
46
43
|
*
|
|
47
|
-
* @
|
|
48
|
-
* @param {string|number} devicePort - The number of the remote device port
|
|
44
|
+
* @param devicePort - The number of the remote device port
|
|
49
45
|
* to remove forwarding on.
|
|
50
46
|
*/
|
|
51
|
-
export function removePortReverse(this:
|
|
47
|
+
export declare function removePortReverse(this: ADB, devicePort: string | number): Promise<void>;
|
|
52
48
|
/**
|
|
53
49
|
* Setup TCP port forwarding with adb on the device under test. The difference
|
|
54
50
|
* between {@link #forwardPort} is that this method does setup for an abstract
|
|
55
51
|
* local port.
|
|
56
52
|
*
|
|
57
|
-
* @
|
|
58
|
-
* @param
|
|
59
|
-
* @param {string|number} devicePort - The number of the remote device port.
|
|
53
|
+
* @param systemPort - The number of the local system port.
|
|
54
|
+
* @param devicePort - The number of the remote device port.
|
|
60
55
|
*/
|
|
61
|
-
export function forwardAbstractPort(this:
|
|
56
|
+
export declare function forwardAbstractPort(this: ADB, systemPort: string | number, devicePort: string | number): Promise<void>;
|
|
62
57
|
/**
|
|
63
58
|
* Execute ping shell command on the device under test.
|
|
64
59
|
*
|
|
65
|
-
* @
|
|
66
|
-
* @return {Promise<boolean>} True if the command output contains 'ping' substring.
|
|
60
|
+
* @return True if the command output contains 'ping' substring.
|
|
67
61
|
* @throws {Error} If there was an error while executing 'ping' command on the
|
|
68
62
|
* device under test.
|
|
69
63
|
*/
|
|
70
|
-
export function ping(this:
|
|
64
|
+
export declare function ping(this: ADB): Promise<boolean>;
|
|
71
65
|
/**
|
|
72
66
|
* Returns the list of TCP port states of the given family.
|
|
73
67
|
* Could be empty if no ports are opened.
|
|
74
68
|
*
|
|
75
|
-
* @
|
|
76
|
-
* @
|
|
77
|
-
* @returns {Promise<import('./types').PortInfo[]>}
|
|
69
|
+
* @param family - Port family ('4' for IPv4, '6' for IPv6)
|
|
70
|
+
* @returns Array of port information
|
|
78
71
|
*/
|
|
79
|
-
export function listPorts(this:
|
|
72
|
+
export declare function listPorts(this: ADB, family?: PortFamily): Promise<PortInfo[]>;
|
|
80
73
|
//# sourceMappingURL=network-commands.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network-commands.d.ts","sourceRoot":"","sources":["../../../lib/tools/network-commands.
|
|
1
|
+
{"version":3,"file":"network-commands.d.ts","sourceRoot":"","sources":["../../../lib/tools/network-commands.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAErD;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAIjE;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,GAAG,EACT,UAAU,EAAE,MAAM,GAAG,MAAM,EAC3B,UAAU,EAAE,MAAM,GAAG,MAAM,GAC1B,OAAO,CAAC,IAAI,CAAC,CAGf;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG7F;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAIjE;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,GAAG,EACT,UAAU,EAAE,MAAM,GAAG,MAAM,EAC3B,UAAU,EAAE,MAAM,GAAG,MAAM,GAC1B,OAAO,CAAC,IAAI,CAAC,CAGf;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,GAAG,EACT,UAAU,EAAE,MAAM,GAAG,MAAM,GAC1B,OAAO,CAAC,IAAI,CAAC,CAGf;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,GAAG,EACT,UAAU,EAAE,MAAM,GAAG,MAAM,EAC3B,UAAU,EAAE,MAAM,GAAG,MAAM,GAC1B,OAAO,CAAC,IAAI,CAAC,CAGf;AAED;;;;;;GAMG;AACH,wBAAsB,IAAI,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAMtD;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,GAAE,UAAgB,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAgCxF"}
|
|
@@ -18,8 +18,7 @@ const logger_js_1 = require("../logger.js");
|
|
|
18
18
|
/**
|
|
19
19
|
* Get TCP port forwarding with adb on the device under test.
|
|
20
20
|
*
|
|
21
|
-
* @
|
|
22
|
-
* @return {Promise<string[]>} The output of the corresponding adb command.
|
|
21
|
+
* @return The output of the corresponding adb command.
|
|
23
22
|
* An array contains each forwarding line of output
|
|
24
23
|
*/
|
|
25
24
|
async function getForwardList() {
|
|
@@ -30,9 +29,8 @@ async function getForwardList() {
|
|
|
30
29
|
/**
|
|
31
30
|
* Setup TCP port forwarding with adb on the device under test.
|
|
32
31
|
*
|
|
33
|
-
* @
|
|
34
|
-
* @param
|
|
35
|
-
* @param {string|number} devicePort - The number of the remote device port.
|
|
32
|
+
* @param systemPort - The number of the local system port.
|
|
33
|
+
* @param devicePort - The number of the remote device port.
|
|
36
34
|
*/
|
|
37
35
|
async function forwardPort(systemPort, devicePort) {
|
|
38
36
|
logger_js_1.log.debug(`Forwarding system: ${systemPort} to device: ${devicePort}`);
|
|
@@ -42,8 +40,7 @@ async function forwardPort(systemPort, devicePort) {
|
|
|
42
40
|
* Remove TCP port forwarding with adb on the device under test. The forwarding
|
|
43
41
|
* for the given port should be setup with {@link #forwardPort} first.
|
|
44
42
|
*
|
|
45
|
-
* @
|
|
46
|
-
* @param {string|number} systemPort - The number of the local system port
|
|
43
|
+
* @param systemPort - The number of the local system port
|
|
47
44
|
* to remove forwarding on.
|
|
48
45
|
*/
|
|
49
46
|
async function removePortForward(systemPort) {
|
|
@@ -53,8 +50,7 @@ async function removePortForward(systemPort) {
|
|
|
53
50
|
/**
|
|
54
51
|
* Get TCP port forwarding with adb on the device under test.
|
|
55
52
|
*
|
|
56
|
-
* @
|
|
57
|
-
* @return {Promise<string[]>} The output of the corresponding adb command.
|
|
53
|
+
* @return The output of the corresponding adb command.
|
|
58
54
|
* An array contains each forwarding line of output
|
|
59
55
|
*/
|
|
60
56
|
async function getReverseList() {
|
|
@@ -66,9 +62,8 @@ async function getReverseList() {
|
|
|
66
62
|
* Setup TCP port forwarding with adb on the device under test.
|
|
67
63
|
* Only available for API 21+.
|
|
68
64
|
*
|
|
69
|
-
* @
|
|
70
|
-
* @param
|
|
71
|
-
* @param {string|number} systemPort - The number of the local system port.
|
|
65
|
+
* @param devicePort - The number of the remote device port.
|
|
66
|
+
* @param systemPort - The number of the local system port.
|
|
72
67
|
*/
|
|
73
68
|
async function reversePort(devicePort, systemPort) {
|
|
74
69
|
logger_js_1.log.debug(`Forwarding device: ${devicePort} to system: ${systemPort}`);
|
|
@@ -78,8 +73,7 @@ async function reversePort(devicePort, systemPort) {
|
|
|
78
73
|
* Remove TCP port forwarding with adb on the device under test. The forwarding
|
|
79
74
|
* for the given port should be setup with {@link #forwardPort} first.
|
|
80
75
|
*
|
|
81
|
-
* @
|
|
82
|
-
* @param {string|number} devicePort - The number of the remote device port
|
|
76
|
+
* @param devicePort - The number of the remote device port
|
|
83
77
|
* to remove forwarding on.
|
|
84
78
|
*/
|
|
85
79
|
async function removePortReverse(devicePort) {
|
|
@@ -91,9 +85,8 @@ async function removePortReverse(devicePort) {
|
|
|
91
85
|
* between {@link #forwardPort} is that this method does setup for an abstract
|
|
92
86
|
* local port.
|
|
93
87
|
*
|
|
94
|
-
* @
|
|
95
|
-
* @param
|
|
96
|
-
* @param {string|number} devicePort - The number of the remote device port.
|
|
88
|
+
* @param systemPort - The number of the local system port.
|
|
89
|
+
* @param devicePort - The number of the remote device port.
|
|
97
90
|
*/
|
|
98
91
|
async function forwardAbstractPort(systemPort, devicePort) {
|
|
99
92
|
logger_js_1.log.debug(`Forwarding system: ${systemPort} to abstract device: ${devicePort}`);
|
|
@@ -102,13 +95,12 @@ async function forwardAbstractPort(systemPort, devicePort) {
|
|
|
102
95
|
/**
|
|
103
96
|
* Execute ping shell command on the device under test.
|
|
104
97
|
*
|
|
105
|
-
* @
|
|
106
|
-
* @return {Promise<boolean>} True if the command output contains 'ping' substring.
|
|
98
|
+
* @return True if the command output contains 'ping' substring.
|
|
107
99
|
* @throws {Error} If there was an error while executing 'ping' command on the
|
|
108
100
|
* device under test.
|
|
109
101
|
*/
|
|
110
102
|
async function ping() {
|
|
111
|
-
|
|
103
|
+
const stdout = await this.shell(['echo', 'ping']);
|
|
112
104
|
if (stdout.indexOf('ping') === 0) {
|
|
113
105
|
return true;
|
|
114
106
|
}
|
|
@@ -118,9 +110,8 @@ async function ping() {
|
|
|
118
110
|
* Returns the list of TCP port states of the given family.
|
|
119
111
|
* Could be empty if no ports are opened.
|
|
120
112
|
*
|
|
121
|
-
* @
|
|
122
|
-
* @
|
|
123
|
-
* @returns {Promise<import('./types').PortInfo[]>}
|
|
113
|
+
* @param family - Port family ('4' for IPv4, '6' for IPv6)
|
|
114
|
+
* @returns Array of port information
|
|
124
115
|
*/
|
|
125
116
|
async function listPorts(family = '4') {
|
|
126
117
|
const sourceProcName = `/proc/net/tcp${family === '6' ? '6' : ''}`;
|
|
@@ -138,7 +129,6 @@ async function listPorts(family = '4') {
|
|
|
138
129
|
logger_js_1.log.debug(lines[0]);
|
|
139
130
|
throw new Error(`Cannot parse the header row of ${sourceProcName} payload`);
|
|
140
131
|
}
|
|
141
|
-
/** @type {import('./types').PortInfo[]} */
|
|
142
132
|
const result = [];
|
|
143
133
|
// 2: 1002000A:D036 24CE3AD8:01BB 08 00000000:00000000 00:00000000 00000000 10132 0 49104 1 0000000000000000 21 4 20 10 -1
|
|
144
134
|
for (const line of lines.slice(1)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network-commands.js","sourceRoot":"","sources":["../../../lib/tools/network-commands.
|
|
1
|
+
{"version":3,"file":"network-commands.js","sourceRoot":"","sources":["../../../lib/tools/network-commands.ts"],"names":[],"mappings":";;;;;AAYA,wCAIC;AAQD,kCAOC;AASD,8CAGC;AAQD,wCAIC;AASD,kCAOC;AASD,8CAMC;AAUD,kDAOC;AASD,oBAMC;AASD,8BAgCC;AA/JD,2BAAuB;AACvB,oDAAuB;AACvB,4CAAiC;AAIjC;;;;;GAKG;AACI,KAAK,UAAU,cAAc;IAClC,eAAG,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;IACnC,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC9D,OAAO,WAAW,CAAC,KAAK,CAAC,QAAG,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AACvE,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,WAAW,CAE/B,U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import {unzipFile} from '../helpers.js';
|
|
|
6
6
|
import AsyncLock from 'async-lock';
|
|
7
7
|
import B from 'bluebird';
|
|
8
8
|
import crypto from 'crypto';
|
|
9
|
+
import type {ADB} from '../adb.js';
|
|
10
|
+
import type {ApkCreationOptions, StringRecord} from './types.js';
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
const AAB_CACHE = new LRUCache({
|
|
12
|
+
const AAB_CACHE = new LRUCache<string, string>({
|
|
12
13
|
max: 10,
|
|
13
|
-
dispose: (extractedFilesRoot) => fs.rimraf(
|
|
14
|
+
dispose: (extractedFilesRoot) => fs.rimraf(extractedFilesRoot),
|
|
14
15
|
});
|
|
15
16
|
const AAB_CACHE_GUARD = new AsyncLock();
|
|
16
17
|
const UNIVERSAL_APK = 'universal.apk';
|
|
@@ -20,7 +21,7 @@ process.on('exit', () => {
|
|
|
20
21
|
return;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
const paths =
|
|
24
|
+
const paths = [...AAB_CACHE.values()];
|
|
24
25
|
log.debug(
|
|
25
26
|
`Performing cleanup of ${paths.length} cached .aab ` + util.pluralize('package', paths.length),
|
|
26
27
|
);
|
|
@@ -29,7 +30,7 @@ process.on('exit', () => {
|
|
|
29
30
|
// Asynchronous calls are not supported in onExit handler
|
|
30
31
|
fs.rimrafSync(appPath);
|
|
31
32
|
} catch (e) {
|
|
32
|
-
log.warn(
|
|
33
|
+
log.warn((e as Error).message);
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
});
|
|
@@ -39,14 +40,17 @@ process.on('exit', () => {
|
|
|
39
40
|
* https://developer.android.com/studio/command-line/bundletool#generate_apks
|
|
40
41
|
* for more details.
|
|
41
42
|
*
|
|
42
|
-
* @
|
|
43
|
-
* @param
|
|
44
|
-
* @param {import('./types').ApkCreationOptions} [opts={}]
|
|
43
|
+
* @param aabPath Full path to the source .aab package
|
|
44
|
+
* @param opts Options for APK creation
|
|
45
45
|
* @returns The path to the resulting universal .apk. The .apk is stored in the internal cache
|
|
46
46
|
* by default.
|
|
47
47
|
* @throws {Error} If there was an error while creating the universal .apk
|
|
48
48
|
*/
|
|
49
|
-
export async function extractUniversalApk(
|
|
49
|
+
export async function extractUniversalApk(
|
|
50
|
+
this: ADB,
|
|
51
|
+
aabPath: string,
|
|
52
|
+
opts: ApkCreationOptions = {},
|
|
53
|
+
): Promise<string> {
|
|
50
54
|
if (!(await fs.exists(aabPath))) {
|
|
51
55
|
throw new Error(`The file at '${aabPath}' either does not exist or is not accessible`);
|
|
52
56
|
}
|
|
@@ -79,18 +83,22 @@ export async function extractUniversalApk(aabPath, opts = {}) {
|
|
|
79
83
|
}
|
|
80
84
|
log.debug(`Calculated the cache key for '${aabPath}': ${cacheHash}`);
|
|
81
85
|
if (AAB_CACHE.has(cacheHash)) {
|
|
82
|
-
const
|
|
83
|
-
if (
|
|
84
|
-
|
|
86
|
+
const cachedRoot = AAB_CACHE.get(cacheHash);
|
|
87
|
+
if (cachedRoot) {
|
|
88
|
+
const resultPath = path.resolve(cachedRoot, apkName);
|
|
89
|
+
if (await fs.exists(resultPath)) {
|
|
90
|
+
return resultPath;
|
|
91
|
+
}
|
|
85
92
|
}
|
|
86
93
|
AAB_CACHE.delete(cacheHash);
|
|
87
94
|
}
|
|
88
95
|
|
|
89
96
|
await this.initAapt2();
|
|
97
|
+
const binaries = this.binaries as StringRecord;
|
|
90
98
|
const args = [
|
|
91
99
|
'build-apks',
|
|
92
100
|
'--aapt2',
|
|
93
|
-
|
|
101
|
+
binaries.aapt2,
|
|
94
102
|
'--bundle',
|
|
95
103
|
aabPath,
|
|
96
104
|
'--output',
|
|
@@ -114,8 +122,8 @@ export async function extractUniversalApk(aabPath, opts = {}) {
|
|
|
114
122
|
|
|
115
123
|
log.debug(`Unpacking universal application bundle at '${tmpApksPath}' to '${tmpRoot}'`);
|
|
116
124
|
await unzipFile(tmpApksPath, tmpRoot);
|
|
117
|
-
let universalApkPath;
|
|
118
|
-
const fileDeletionPromises = [];
|
|
125
|
+
let universalApkPath: string | undefined;
|
|
126
|
+
const fileDeletionPromises: Promise<void>[] = [];
|
|
119
127
|
const allFileNames = await fs.readdir(tmpRoot);
|
|
120
128
|
for (const fileName of allFileNames) {
|
|
121
129
|
const fullPath = path.join(tmpRoot, fileName);
|
|
@@ -146,3 +154,4 @@ export async function extractUniversalApk(aabPath, opts = {}) {
|
|
|
146
154
|
throw e;
|
|
147
155
|
}
|
|
148
156
|
}
|
|
157
|
+
|