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,110 +1,95 @@
|
|
|
1
|
+
import { SubProcess } from 'teen_process';
|
|
2
|
+
import type { ADB } from '../adb.js';
|
|
3
|
+
import type { ScreenrecordOptions } from './types.js';
|
|
1
4
|
/**
|
|
2
5
|
* Get the path to adb executable amd assign it
|
|
3
6
|
* to this.executable.path and this.binaries.adb properties.
|
|
4
7
|
*
|
|
5
|
-
* @
|
|
6
|
-
* @return {Promise<import('../adb.js').ADB>} ADB instance.
|
|
8
|
+
* @return ADB instance.
|
|
7
9
|
*/
|
|
8
|
-
export function getAdbWithCorrectAdbPath(this:
|
|
10
|
+
export declare function getAdbWithCorrectAdbPath(this: ADB): Promise<ADB>;
|
|
9
11
|
/**
|
|
10
12
|
* Get the full path to aapt tool and assign it to
|
|
11
13
|
* this.binaries.aapt property
|
|
12
|
-
* @this {import('../adb.js').ADB}
|
|
13
14
|
*/
|
|
14
|
-
export function initAapt(this:
|
|
15
|
+
export declare function initAapt(this: ADB): Promise<void>;
|
|
15
16
|
/**
|
|
16
17
|
* Get the full path to aapt2 tool and assign it to
|
|
17
18
|
* this.binaries.aapt2 property
|
|
18
|
-
* @this {import('../adb.js').ADB}
|
|
19
19
|
*/
|
|
20
|
-
export function initAapt2(this:
|
|
20
|
+
export declare function initAapt2(this: ADB): Promise<void>;
|
|
21
21
|
/**
|
|
22
22
|
* Get the full path to zipalign tool and assign it to
|
|
23
23
|
* this.binaries.zipalign property
|
|
24
|
-
* @this {import('../adb.js').ADB}
|
|
25
24
|
*/
|
|
26
|
-
export function initZipAlign(this:
|
|
25
|
+
export declare function initZipAlign(this: ADB): Promise<void>;
|
|
27
26
|
/**
|
|
28
27
|
* Get the full path to bundletool binary and assign it to
|
|
29
28
|
* this.binaries.bundletool property
|
|
30
|
-
* @this {import('../adb.js').ADB}
|
|
31
29
|
*/
|
|
32
|
-
export function initBundletool(this:
|
|
30
|
+
export declare function initBundletool(this: ADB): Promise<void>;
|
|
33
31
|
/**
|
|
34
32
|
* Retrieve the API level of the device under test.
|
|
35
33
|
*
|
|
36
|
-
* @
|
|
37
|
-
* @return {Promise<number>} The API level as integer number, for example 21 for
|
|
34
|
+
* @return The API level as integer number, for example 21 for
|
|
38
35
|
* Android Lollipop. The result of this method is cached, so all the further
|
|
39
36
|
* calls return the same value as the first one.
|
|
40
37
|
*/
|
|
41
|
-
export function getApiLevel(this:
|
|
42
|
-
export class getApiLevel {
|
|
43
|
-
_apiLevel: number | undefined;
|
|
44
|
-
}
|
|
38
|
+
export declare function getApiLevel(this: ADB): Promise<number>;
|
|
45
39
|
/**
|
|
46
40
|
* Verify whether a device is connected.
|
|
47
41
|
*
|
|
48
|
-
* @
|
|
49
|
-
* @return {Promise<boolean>} True if at least one device is visible to adb.
|
|
42
|
+
* @return True if at least one device is visible to adb.
|
|
50
43
|
*/
|
|
51
|
-
export function isDeviceConnected(this:
|
|
44
|
+
export declare function isDeviceConnected(this: ADB): Promise<boolean>;
|
|
52
45
|
/**
|
|
53
46
|
* Clear the active text field on the device under test by sending
|
|
54
47
|
* special keyevents to it.
|
|
55
48
|
*
|
|
56
|
-
* @
|
|
57
|
-
* @param {number} [length=100] - The maximum length of the text in the field to be cleared.
|
|
49
|
+
* @param length - The maximum length of the text in the field to be cleared.
|
|
58
50
|
*/
|
|
59
|
-
export function clearTextField(this:
|
|
51
|
+
export declare function clearTextField(this: ADB, length?: number): Promise<void>;
|
|
60
52
|
/**
|
|
61
53
|
* Send the special keycode to the device under test in order to emulate
|
|
62
54
|
* Back button tap.
|
|
63
|
-
* @this {import('../adb.js').ADB}
|
|
64
55
|
*/
|
|
65
|
-
export function back(this:
|
|
56
|
+
export declare function back(this: ADB): Promise<void>;
|
|
66
57
|
/**
|
|
67
58
|
* Send the special keycode to the device under test in order to emulate
|
|
68
59
|
* Home button tap.
|
|
69
|
-
* @this {import('../adb.js').ADB}
|
|
70
60
|
*/
|
|
71
|
-
export function goToHome(this:
|
|
61
|
+
export declare function goToHome(this: ADB): Promise<void>;
|
|
72
62
|
/**
|
|
73
|
-
* @
|
|
74
|
-
* @return {string} the actual path to adb executable.
|
|
63
|
+
* @return the actual path to adb executable.
|
|
75
64
|
*/
|
|
76
|
-
export function getAdbPath(this:
|
|
65
|
+
export declare function getAdbPath(this: ADB): string;
|
|
77
66
|
/**
|
|
78
67
|
* Restart the device under test using adb commands.
|
|
79
68
|
*
|
|
80
|
-
* @this {import('../adb.js').ADB}
|
|
81
69
|
* @throws {Error} If start fails.
|
|
82
70
|
*/
|
|
83
|
-
export function restart(this:
|
|
71
|
+
export declare function restart(this: ADB): Promise<void>;
|
|
84
72
|
/**
|
|
85
73
|
* Retrieve the `adb bugreport` command output. This
|
|
86
74
|
* operation may take up to several minutes.
|
|
87
75
|
*
|
|
88
|
-
* @
|
|
89
|
-
* @
|
|
90
|
-
* @returns {Promise<string>} Command stdout
|
|
76
|
+
* @param timeout - Command timeout in milliseconds
|
|
77
|
+
* @returns Command stdout
|
|
91
78
|
*/
|
|
92
|
-
export function bugreport(this:
|
|
79
|
+
export declare function bugreport(this: ADB, timeout?: number): Promise<string>;
|
|
93
80
|
/**
|
|
94
81
|
* Initiate screenrecord utility on the device
|
|
95
82
|
*
|
|
96
|
-
* @
|
|
97
|
-
* @param {string} destination - Full path to the writable media file destination
|
|
83
|
+
* @param destination - Full path to the writable media file destination
|
|
98
84
|
* on the device file system.
|
|
99
|
-
* @param
|
|
100
|
-
* @returns
|
|
85
|
+
* @param options - Screenrecord options
|
|
86
|
+
* @returns screenrecord process, which can be then controlled by the client code
|
|
101
87
|
*/
|
|
102
|
-
export function screenrecord(this:
|
|
88
|
+
export declare function screenrecord(this: ADB, destination: string, options?: ScreenrecordOptions): SubProcess;
|
|
103
89
|
/**
|
|
104
90
|
* Retrieves the list of features supported by the device under test
|
|
105
91
|
*
|
|
106
|
-
* @
|
|
107
|
-
* @returns {Promise<string[]>} the list of supported feature names or an empty list.
|
|
92
|
+
* @returns the list of supported feature names or an empty list.
|
|
108
93
|
* An example adb command output:
|
|
109
94
|
* ```
|
|
110
95
|
* cmd
|
|
@@ -120,10 +105,7 @@ export function screenrecord(this: import("../adb.js").ADB, destination: string,
|
|
|
120
105
|
* ```
|
|
121
106
|
* @throws {Error} if there was an error while retrieving the list
|
|
122
107
|
*/
|
|
123
|
-
export function listFeatures(this:
|
|
124
|
-
export class listFeatures {
|
|
125
|
-
_memoizedFeatures: () => Promise<string>;
|
|
126
|
-
}
|
|
108
|
+
export declare function listFeatures(this: ADB): Promise<string[]>;
|
|
127
109
|
/**
|
|
128
110
|
* Checks the state of streamed install feature.
|
|
129
111
|
* This feature allows to speed up apk installation
|
|
@@ -134,30 +116,26 @@ export class listFeatures {
|
|
|
134
116
|
* See https://github.com/aosp-mirror/platform_system_core/blob/master/adb/client/adb_install.cpp
|
|
135
117
|
* for more details
|
|
136
118
|
*
|
|
137
|
-
* @
|
|
138
|
-
* @returns {Promise<boolean>} `true` if the feature is supported by both adb and the
|
|
119
|
+
* @returns `true` if the feature is supported by both adb and the
|
|
139
120
|
* device under test
|
|
140
121
|
*/
|
|
141
|
-
export function isStreamedInstallSupported(this:
|
|
122
|
+
export declare function isStreamedInstallSupported(this: ADB): Promise<boolean>;
|
|
142
123
|
/**
|
|
143
124
|
* Checks whether incremental install feature is supported by ADB.
|
|
144
125
|
* Read https://developer.android.com/preview/features#incremental
|
|
145
126
|
* for more details on it.
|
|
146
127
|
*
|
|
147
|
-
* @
|
|
148
|
-
* @returns {Promise<boolean>} `true` if the feature is supported by both adb and the
|
|
128
|
+
* @returns `true` if the feature is supported by both adb and the
|
|
149
129
|
* device under test
|
|
150
130
|
*/
|
|
151
|
-
export function isIncrementalInstallSupported(this:
|
|
131
|
+
export declare function isIncrementalInstallSupported(this: ADB): Promise<boolean>;
|
|
152
132
|
/**
|
|
153
133
|
* Takes a screenshot of the given display or the default display.
|
|
154
134
|
*
|
|
155
|
-
* @
|
|
156
|
-
* @param {number|string?} displayId A valid display identifier. If
|
|
135
|
+
* @param displayId A valid display identifier. If
|
|
157
136
|
* no identifier is provided then the screenshot of the default display is returned.
|
|
158
137
|
* Note that only recent Android APIs provide multi-screen support.
|
|
159
|
-
* @returns
|
|
138
|
+
* @returns PNG screenshot payload
|
|
160
139
|
*/
|
|
161
|
-
export function takeScreenshot(this:
|
|
162
|
-
import { SubProcess } from 'teen_process';
|
|
140
|
+
export declare function takeScreenshot(this: ADB, displayId?: number | string): Promise<Buffer>;
|
|
163
141
|
//# sourceMappingURL=general-commands.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general-commands.d.ts","sourceRoot":"","sources":["../../../lib/tools/general-commands.
|
|
1
|
+
{"version":3,"file":"general-commands.d.ts","sourceRoot":"","sources":["../../../lib/tools/general-commands.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,UAAU,EAAuB,MAAM,cAAc,CAAC;AAC9D,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAC,mBAAmB,EAAe,MAAM,YAAY,CAAC;AAElE;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAGtE;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CA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;;;;;;;;;;GAkBG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAuB/D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,0BAA0B,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAI5E;AAED;;;;;;;GAOG;AACH,wBAAsB,6BAA6B,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAS/E;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,GAAG,EACT,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAC1B,OAAO,CAAC,MAAM,CAAC,CA8BjB"}
|
|
@@ -29,8 +29,7 @@ const teen_process_1 = require("teen_process");
|
|
|
29
29
|
* Get the path to adb executable amd assign it
|
|
30
30
|
* to this.executable.path and this.binaries.adb properties.
|
|
31
31
|
*
|
|
32
|
-
* @
|
|
33
|
-
* @return {Promise<import('../adb.js').ADB>} ADB instance.
|
|
32
|
+
* @return ADB instance.
|
|
34
33
|
*/
|
|
35
34
|
async function getAdbWithCorrectAdbPath() {
|
|
36
35
|
this.executable.path = await this.getSdkBinaryPath('adb');
|
|
@@ -39,7 +38,6 @@ async function getAdbWithCorrectAdbPath() {
|
|
|
39
38
|
/**
|
|
40
39
|
* Get the full path to aapt tool and assign it to
|
|
41
40
|
* this.binaries.aapt property
|
|
42
|
-
* @this {import('../adb.js').ADB}
|
|
43
41
|
*/
|
|
44
42
|
async function initAapt() {
|
|
45
43
|
await this.getSdkBinaryPath('aapt');
|
|
@@ -47,7 +45,6 @@ async function initAapt() {
|
|
|
47
45
|
/**
|
|
48
46
|
* Get the full path to aapt2 tool and assign it to
|
|
49
47
|
* this.binaries.aapt2 property
|
|
50
|
-
* @this {import('../adb.js').ADB}
|
|
51
48
|
*/
|
|
52
49
|
async function initAapt2() {
|
|
53
50
|
await this.getSdkBinaryPath('aapt2');
|
|
@@ -55,7 +52,6 @@ async function initAapt2() {
|
|
|
55
52
|
/**
|
|
56
53
|
* Get the full path to zipalign tool and assign it to
|
|
57
54
|
* this.binaries.zipalign property
|
|
58
|
-
* @this {import('../adb.js').ADB}
|
|
59
55
|
*/
|
|
60
56
|
async function initZipAlign() {
|
|
61
57
|
await this.getSdkBinaryPath('zipalign');
|
|
@@ -63,12 +59,11 @@ async function initZipAlign() {
|
|
|
63
59
|
/**
|
|
64
60
|
* Get the full path to bundletool binary and assign it to
|
|
65
61
|
* this.binaries.bundletool property
|
|
66
|
-
* @this {import('../adb.js').ADB}
|
|
67
62
|
*/
|
|
68
63
|
async function initBundletool() {
|
|
69
64
|
try {
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
const binaries = this.binaries;
|
|
66
|
+
binaries.bundletool = await support_1.fs.which('bundletool.jar');
|
|
72
67
|
}
|
|
73
68
|
catch {
|
|
74
69
|
throw new Error('bundletool.jar binary is expected to be present in PATH. ' +
|
|
@@ -78,8 +73,7 @@ async function initBundletool() {
|
|
|
78
73
|
/**
|
|
79
74
|
* Retrieve the API level of the device under test.
|
|
80
75
|
*
|
|
81
|
-
* @
|
|
82
|
-
* @return {Promise<number>} The API level as integer number, for example 21 for
|
|
76
|
+
* @return The API level as integer number, for example 21 for
|
|
83
77
|
* Android Lollipop. The result of this method is cached, so all the further
|
|
84
78
|
* calls return the same value as the first one.
|
|
85
79
|
*/
|
|
@@ -104,27 +98,25 @@ async function getApiLevel() {
|
|
|
104
98
|
}
|
|
105
99
|
}
|
|
106
100
|
catch (e) {
|
|
107
|
-
throw new Error(`Error getting device API level. Original error: ${
|
|
101
|
+
throw new Error(`Error getting device API level. Original error: ${e.message}`);
|
|
108
102
|
}
|
|
109
103
|
}
|
|
110
|
-
return
|
|
104
|
+
return this._apiLevel;
|
|
111
105
|
}
|
|
112
106
|
/**
|
|
113
107
|
* Verify whether a device is connected.
|
|
114
108
|
*
|
|
115
|
-
* @
|
|
116
|
-
* @return {Promise<boolean>} True if at least one device is visible to adb.
|
|
109
|
+
* @return True if at least one device is visible to adb.
|
|
117
110
|
*/
|
|
118
111
|
async function isDeviceConnected() {
|
|
119
|
-
|
|
112
|
+
const devices = await this.getConnectedDevices();
|
|
120
113
|
return devices.length > 0;
|
|
121
114
|
}
|
|
122
115
|
/**
|
|
123
116
|
* Clear the active text field on the device under test by sending
|
|
124
117
|
* special keyevents to it.
|
|
125
118
|
*
|
|
126
|
-
* @
|
|
127
|
-
* @param {number} [length=100] - The maximum length of the text in the field to be cleared.
|
|
119
|
+
* @param length - The maximum length of the text in the field to be cleared.
|
|
128
120
|
*/
|
|
129
121
|
async function clearTextField(length = 100) {
|
|
130
122
|
// assumes that the EditText field already has focus
|
|
@@ -132,7 +124,7 @@ async function clearTextField(length = 100) {
|
|
|
132
124
|
if (length === 0) {
|
|
133
125
|
return;
|
|
134
126
|
}
|
|
135
|
-
|
|
127
|
+
const args = ['input', 'keyevent'];
|
|
136
128
|
for (let i = 0; i < length; i++) {
|
|
137
129
|
// we cannot know where the cursor is in the text field, so delete both before
|
|
138
130
|
// and after so that we get rid of everything
|
|
@@ -145,7 +137,6 @@ async function clearTextField(length = 100) {
|
|
|
145
137
|
/**
|
|
146
138
|
* Send the special keycode to the device under test in order to emulate
|
|
147
139
|
* Back button tap.
|
|
148
|
-
* @this {import('../adb.js').ADB}
|
|
149
140
|
*/
|
|
150
141
|
async function back() {
|
|
151
142
|
logger_js_1.log.debug('Pressing the BACK button');
|
|
@@ -154,15 +145,13 @@ async function back() {
|
|
|
154
145
|
/**
|
|
155
146
|
* Send the special keycode to the device under test in order to emulate
|
|
156
147
|
* Home button tap.
|
|
157
|
-
* @this {import('../adb.js').ADB}
|
|
158
148
|
*/
|
|
159
149
|
async function goToHome() {
|
|
160
150
|
logger_js_1.log.debug('Pressing the HOME button');
|
|
161
151
|
await this.keyevent(3);
|
|
162
152
|
}
|
|
163
153
|
/**
|
|
164
|
-
* @
|
|
165
|
-
* @return {string} the actual path to adb executable.
|
|
154
|
+
* @return the actual path to adb executable.
|
|
166
155
|
*/
|
|
167
156
|
function getAdbPath() {
|
|
168
157
|
return this.executable.path;
|
|
@@ -170,7 +159,6 @@ function getAdbPath() {
|
|
|
170
159
|
/**
|
|
171
160
|
* Restart the device under test using adb commands.
|
|
172
161
|
*
|
|
173
|
-
* @this {import('../adb.js').ADB}
|
|
174
162
|
* @throws {Error} If start fails.
|
|
175
163
|
*/
|
|
176
164
|
async function restart() {
|
|
@@ -181,7 +169,7 @@ async function restart() {
|
|
|
181
169
|
await this.startLogcat(this._logcatStartupParams);
|
|
182
170
|
}
|
|
183
171
|
catch (e) {
|
|
184
|
-
const err =
|
|
172
|
+
const err = e;
|
|
185
173
|
throw new Error(`Restart failed. Original error: ${err.message}`);
|
|
186
174
|
}
|
|
187
175
|
}
|
|
@@ -189,9 +177,8 @@ async function restart() {
|
|
|
189
177
|
* Retrieve the `adb bugreport` command output. This
|
|
190
178
|
* operation may take up to several minutes.
|
|
191
179
|
*
|
|
192
|
-
* @
|
|
193
|
-
* @
|
|
194
|
-
* @returns {Promise<string>} Command stdout
|
|
180
|
+
* @param timeout - Command timeout in milliseconds
|
|
181
|
+
* @returns Command stdout
|
|
195
182
|
*/
|
|
196
183
|
async function bugreport(timeout = 120000) {
|
|
197
184
|
return await this.adbExec(['bugreport'], { timeout });
|
|
@@ -199,11 +186,10 @@ async function bugreport(timeout = 120000) {
|
|
|
199
186
|
/**
|
|
200
187
|
* Initiate screenrecord utility on the device
|
|
201
188
|
*
|
|
202
|
-
* @
|
|
203
|
-
* @param {string} destination - Full path to the writable media file destination
|
|
189
|
+
* @param destination - Full path to the writable media file destination
|
|
204
190
|
* on the device file system.
|
|
205
|
-
* @param
|
|
206
|
-
* @returns
|
|
191
|
+
* @param options - Screenrecord options
|
|
192
|
+
* @returns screenrecord process, which can be then controlled by the client code
|
|
207
193
|
*/
|
|
208
194
|
function screenrecord(destination, options = {}) {
|
|
209
195
|
const cmd = ['screenrecord'];
|
|
@@ -228,8 +214,7 @@ function screenrecord(destination, options = {}) {
|
|
|
228
214
|
/**
|
|
229
215
|
* Retrieves the list of features supported by the device under test
|
|
230
216
|
*
|
|
231
|
-
* @
|
|
232
|
-
* @returns {Promise<string[]>} the list of supported feature names or an empty list.
|
|
217
|
+
* @returns the list of supported feature names or an empty list.
|
|
233
218
|
* An example adb command output:
|
|
234
219
|
* ```
|
|
235
220
|
* cmd
|
|
@@ -250,13 +235,17 @@ async function listFeatures() {
|
|
|
250
235
|
this._memoizedFeatures ||
|
|
251
236
|
lodash_1.default.memoize(async () => await this.adbExec(['features']), () => this.curDeviceId);
|
|
252
237
|
try {
|
|
253
|
-
|
|
238
|
+
const memoizedFeatures = this._memoizedFeatures;
|
|
239
|
+
if (!memoizedFeatures) {
|
|
240
|
+
throw new Error('Memoized features function is not initialized');
|
|
241
|
+
}
|
|
242
|
+
return (await memoizedFeatures())
|
|
254
243
|
.split(/\s+/)
|
|
255
244
|
.map((x) => x.trim())
|
|
256
245
|
.filter(Boolean);
|
|
257
246
|
}
|
|
258
247
|
catch (e) {
|
|
259
|
-
const err =
|
|
248
|
+
const err = e;
|
|
260
249
|
if (lodash_1.default.includes(err.stderr, 'unknown command')) {
|
|
261
250
|
return [];
|
|
262
251
|
}
|
|
@@ -273,8 +262,7 @@ async function listFeatures() {
|
|
|
273
262
|
* See https://github.com/aosp-mirror/platform_system_core/blob/master/adb/client/adb_install.cpp
|
|
274
263
|
* for more details
|
|
275
264
|
*
|
|
276
|
-
* @
|
|
277
|
-
* @returns {Promise<boolean>} `true` if the feature is supported by both adb and the
|
|
265
|
+
* @returns `true` if the feature is supported by both adb and the
|
|
278
266
|
* device under test
|
|
279
267
|
*/
|
|
280
268
|
async function isStreamedInstallSupported() {
|
|
@@ -287,8 +275,7 @@ async function isStreamedInstallSupported() {
|
|
|
287
275
|
* Read https://developer.android.com/preview/features#incremental
|
|
288
276
|
* for more details on it.
|
|
289
277
|
*
|
|
290
|
-
* @
|
|
291
|
-
* @returns {Promise<boolean>} `true` if the feature is supported by both adb and the
|
|
278
|
+
* @returns `true` if the feature is supported by both adb and the
|
|
292
279
|
* device under test
|
|
293
280
|
*/
|
|
294
281
|
async function isIncrementalInstallSupported() {
|
|
@@ -302,29 +289,36 @@ async function isIncrementalInstallSupported() {
|
|
|
302
289
|
/**
|
|
303
290
|
* Takes a screenshot of the given display or the default display.
|
|
304
291
|
*
|
|
305
|
-
* @
|
|
306
|
-
* @param {number|string?} displayId A valid display identifier. If
|
|
292
|
+
* @param displayId A valid display identifier. If
|
|
307
293
|
* no identifier is provided then the screenshot of the default display is returned.
|
|
308
294
|
* Note that only recent Android APIs provide multi-screen support.
|
|
309
|
-
* @returns
|
|
295
|
+
* @returns PNG screenshot payload
|
|
310
296
|
*/
|
|
311
297
|
async function takeScreenshot(displayId) {
|
|
312
298
|
const args = [...this.executable.defaultArgs, 'exec-out', 'screencap', '-p'];
|
|
313
299
|
// @ts-ignore This validation works as expected
|
|
314
|
-
const displayIdStr = isNaN(displayId) ? null : `${displayId}`;
|
|
300
|
+
const displayIdStr = isNaN(Number(displayId)) ? null : `${displayId}`;
|
|
315
301
|
if (displayIdStr) {
|
|
316
302
|
args.push('-d', displayIdStr);
|
|
317
303
|
}
|
|
318
|
-
const displayDescr = displayIdStr ?
|
|
304
|
+
const displayDescr = displayIdStr ? `display #${displayIdStr}` : 'default display';
|
|
319
305
|
let stdout;
|
|
320
306
|
try {
|
|
321
307
|
({ stdout } = await (0, teen_process_1.exec)(this.executable.path, args, { encoding: 'binary', isBuffer: true }));
|
|
322
308
|
}
|
|
323
309
|
catch (e) {
|
|
324
|
-
const err =
|
|
310
|
+
const err = e;
|
|
311
|
+
let outputStr = '';
|
|
312
|
+
if (err.stderr) {
|
|
313
|
+
const stderr = err.stderr;
|
|
314
|
+
outputStr = typeof stderr === 'string' ? stderr : stderr.toString('utf-8');
|
|
315
|
+
}
|
|
316
|
+
else if (err.stdout) {
|
|
317
|
+
const stdout = err.stdout;
|
|
318
|
+
outputStr = typeof stdout === 'string' ? stdout : stdout.toString('utf-8');
|
|
319
|
+
}
|
|
325
320
|
throw new Error(`Screenshot of the ${displayDescr} failed. ` +
|
|
326
|
-
|
|
327
|
-
`Code: '${err.code}', output: '${(err.stderr.length ? err.stderr : err.stdout).toString('utf-8')}'`);
|
|
321
|
+
`Code: '${err.code ?? 'unknown'}', output: '${outputStr}'`);
|
|
328
322
|
}
|
|
329
323
|
if (stdout.length === 0) {
|
|
330
324
|
throw new Error(`Screenshot of the ${displayDescr} returned no data`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general-commands.js","sourceRoot":"","sources":["../../../lib/tools/general-commands.
|
|
1
|
+
{"version":3,"file":"general-commands.js","sourceRoot":"","sources":["../../../lib/tools/general-commands.ts"],"names":[],"mappings":";;;;;AAaA,4DAGC;AAMD,4BAEC;AAMD,8BAEC;AAMD,oCAEC;AAMD,wCAUC;AASD,kCA8BC;AAOD,8CAGC;AAQD,wCAeC;AAMD,oBAGC;AAMD,4BAGC;AAKD,gCAEC;AAOD,0BAUC;AASD,8BAEC;AAUD,oCAwBC;AAqBD,oCAuBC;AAeD,gEAIC;AAUD,sEASC;AAUD,wCAiCC;AApVD,4CAAiC;AACjC,oDAAuB;AACvB,6CAAyC;AACzC,+CAA8D;AAI9D;;;;;GAKG;AACI,KAAK,UAAU,wBAAwB;IAC5C,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC1D,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,QAAQ;IAC5B,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,SAAS;IAC7B,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;AACvC,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,YAAY;IAChC,MAA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AC;QAC7E,CAAC;QACD,MAAM,IAAI,KAAK,CACb,qBAAqB,YAAY,WAAW;YAC1C,UAAU,GAAG,CAAC,IAAI,IAAI,SAAS,eAAe,SAAS,GAAG,CAC7D,CAAC;IACJ,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,qBAAqB,YAAY,mBAAmB,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,88 +1,79 @@
|
|
|
1
|
+
import type { ADB } from '../adb.js';
|
|
2
|
+
import type { KeyboardState } from './types.js';
|
|
1
3
|
/**
|
|
2
4
|
* Hides software keyboard if it is visible.
|
|
3
5
|
* Noop if the keyboard is already hidden.
|
|
4
6
|
*
|
|
5
|
-
* @
|
|
6
|
-
* @param {number} [timeoutMs=1000] For how long to wait (in milliseconds)
|
|
7
|
+
* @param timeoutMs - For how long to wait (in milliseconds)
|
|
7
8
|
* until the keyboard is actually hidden.
|
|
8
|
-
* @returns
|
|
9
|
+
* @returns `false` if the keyboard was already hidden
|
|
9
10
|
* @throws {Error} If the keyboard cannot be hidden.
|
|
10
11
|
*/
|
|
11
|
-
export function hideKeyboard(this:
|
|
12
|
+
export declare function hideKeyboard(this: ADB, timeoutMs?: number): Promise<boolean>;
|
|
12
13
|
/**
|
|
13
14
|
* Retrieve the state of the software keyboard on the device under test.
|
|
14
15
|
*
|
|
15
|
-
* @
|
|
16
|
-
* @return {Promise<import('./types').KeyboardState>} The keyboard state.
|
|
16
|
+
* @return The keyboard state.
|
|
17
17
|
*/
|
|
18
|
-
export function isSoftKeyboardPresent(this:
|
|
18
|
+
export declare function isSoftKeyboardPresent(this: ADB): Promise<KeyboardState>;
|
|
19
19
|
/**
|
|
20
20
|
* Send the particular keycode to the device under test.
|
|
21
21
|
*
|
|
22
|
-
* @
|
|
23
|
-
* @param {string|number} keycode - The actual key code to be sent.
|
|
22
|
+
* @param keycode - The actual key code to be sent.
|
|
24
23
|
*/
|
|
25
|
-
export function keyevent(this:
|
|
24
|
+
export declare function keyevent(this: ADB, keycode: string | number): Promise<void>;
|
|
26
25
|
/**
|
|
27
26
|
* Retrieve the list of available input methods (IMEs) for the device under test.
|
|
28
27
|
*
|
|
29
|
-
* @
|
|
30
|
-
* @return {Promise<string[]>} The list of IME names or an empty list.
|
|
28
|
+
* @return The list of IME names or an empty list.
|
|
31
29
|
*/
|
|
32
|
-
export function availableIMEs(this:
|
|
30
|
+
export declare function availableIMEs(this: ADB): Promise<string[]>;
|
|
33
31
|
/**
|
|
34
32
|
* Retrieve the list of enabled input methods (IMEs) for the device under test.
|
|
35
33
|
*
|
|
36
|
-
* @
|
|
37
|
-
* @return {Promise<string[]>} The list of enabled IME names or an empty list.
|
|
34
|
+
* @return The list of enabled IME names or an empty list.
|
|
38
35
|
*/
|
|
39
|
-
export function enabledIMEs(this:
|
|
36
|
+
export declare function enabledIMEs(this: ADB): Promise<string[]>;
|
|
40
37
|
/**
|
|
41
38
|
* Enable the particular input method on the device under test.
|
|
42
39
|
*
|
|
43
|
-
* @
|
|
44
|
-
* @param {string} imeId - One of existing IME ids.
|
|
40
|
+
* @param imeId - One of existing IME ids.
|
|
45
41
|
*/
|
|
46
|
-
export function enableIME(this:
|
|
42
|
+
export declare function enableIME(this: ADB, imeId: string): Promise<void>;
|
|
47
43
|
/**
|
|
48
44
|
* Disable the particular input method on the device under test.
|
|
49
45
|
*
|
|
50
|
-
* @
|
|
51
|
-
* @param {string} imeId - One of existing IME ids.
|
|
46
|
+
* @param imeId - One of existing IME ids.
|
|
52
47
|
*/
|
|
53
|
-
export function disableIME(this:
|
|
48
|
+
export declare function disableIME(this: ADB, imeId: string): Promise<void>;
|
|
54
49
|
/**
|
|
55
50
|
* Set the particular input method on the device under test.
|
|
56
51
|
*
|
|
57
|
-
* @
|
|
58
|
-
* @param {string} imeId - One of existing IME ids.
|
|
52
|
+
* @param imeId - One of existing IME ids.
|
|
59
53
|
*/
|
|
60
|
-
export function setIME(this:
|
|
54
|
+
export declare function setIME(this: ADB, imeId: string): Promise<void>;
|
|
61
55
|
/**
|
|
62
56
|
* Get the default input method on the device under test.
|
|
63
57
|
*
|
|
64
|
-
* @
|
|
65
|
-
* @return {Promise<string|null>} The name of the default input method
|
|
58
|
+
* @return The name of the default input method
|
|
66
59
|
*/
|
|
67
|
-
export function defaultIME(this:
|
|
60
|
+
export declare function defaultIME(this: ADB): Promise<string | null>;
|
|
68
61
|
/**
|
|
69
62
|
* Send the particular text or a number to the device under test.
|
|
70
63
|
* The text gets properly escaped before being passed to ADB.
|
|
71
64
|
* Noop if the text is empty.
|
|
72
65
|
*
|
|
73
|
-
* @
|
|
74
|
-
* @param {string|number} text - The actual text to be sent.
|
|
66
|
+
* @param text - The actual text to be sent.
|
|
75
67
|
* @throws {Error} If it is impossible to escape the given string
|
|
76
68
|
*/
|
|
77
|
-
export function inputText(this:
|
|
69
|
+
export declare function inputText(this: ADB, text: string | number): Promise<void>;
|
|
78
70
|
/**
|
|
79
71
|
* Executes the given function with the given input method context
|
|
80
72
|
* and then restores the IME to the original value
|
|
81
73
|
*
|
|
82
|
-
* @
|
|
83
|
-
* @param
|
|
84
|
-
* @
|
|
85
|
-
* @returns {Promise<any>} The result of the given function
|
|
74
|
+
* @param ime - Valid IME identifier
|
|
75
|
+
* @param fn - Function to execute
|
|
76
|
+
* @returns The result of the given function
|
|
86
77
|
*/
|
|
87
|
-
export function runInImeContext(this:
|
|
78
|
+
export declare function runInImeContext<T>(this: ADB, ime: string, fn: () => Promise<T>): Promise<T>;
|
|
88
79
|
//# sourceMappingURL=keyboard-commands.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard-commands.d.ts","sourceRoot":"","sources":["../../../lib/tools/keyboard-commands.
|
|
1
|
+
{"version":3,"file":"keyboard-commands.d.ts","sourceRoot":"","sources":["../../../lib/tools/keyboard-commands.ts"],"names":[],"mappings":"AAIA,OAA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