appium-android-driver 5.14.7 → 6.0.0
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/build/index.d.ts +282 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js.map +1 -0
- package/build/lib/commands/actions.d.ts +6 -224
- package/build/lib/commands/actions.d.ts.map +1 -1
- package/build/lib/commands/actions.js +306 -405
- package/build/lib/commands/actions.js.map +1 -1
- package/build/lib/commands/alert.d.ts +7 -9
- package/build/lib/commands/alert.d.ts.map +1 -1
- package/build/lib/commands/alert.js +24 -18
- package/build/lib/commands/alert.js.map +1 -1
- package/build/lib/commands/app-management.d.ts +7 -313
- package/build/lib/commands/app-management.d.ts.map +1 -1
- package/build/lib/commands/app-management.js +135 -293
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/context.d.ts +8 -92
- package/build/lib/commands/context.d.ts.map +1 -1
- package/build/lib/commands/context.js +381 -439
- package/build/lib/commands/context.js.map +1 -1
- package/build/lib/commands/element.d.ts +8 -35
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js +153 -136
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/emu-console.d.ts +6 -48
- package/build/lib/commands/emu-console.d.ts.map +1 -1
- package/build/lib/commands/emu-console.js +19 -34
- package/build/lib/commands/emu-console.js.map +1 -1
- package/build/lib/commands/execute.d.ts +6 -5
- package/build/lib/commands/execute.d.ts.map +1 -1
- package/build/lib/commands/execute.js +77 -66
- package/build/lib/commands/execute.js.map +1 -1
- package/build/lib/commands/file-actions.d.ts +7 -128
- package/build/lib/commands/file-actions.d.ts.map +1 -1
- package/build/lib/commands/file-actions.js +183 -219
- package/build/lib/commands/file-actions.js.map +1 -1
- package/build/lib/commands/find.d.ts +8 -12
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js +19 -23
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/commands/general.d.ts +9 -132
- package/build/lib/commands/general.d.ts.map +1 -1
- package/build/lib/commands/general.js +281 -312
- package/build/lib/commands/general.js.map +1 -1
- package/build/lib/commands/ime.d.ts +7 -10
- package/build/lib/commands/ime.d.ts.map +1 -1
- package/build/lib/commands/ime.js +47 -35
- package/build/lib/commands/ime.js.map +1 -1
- package/build/lib/commands/index.d.ts +27 -2
- package/build/lib/commands/index.d.ts.map +1 -1
- package/build/lib/commands/index.js +41 -19
- package/build/lib/commands/index.js.map +1 -1
- package/build/lib/commands/intent.d.ts +7 -417
- package/build/lib/commands/intent.d.ts.map +1 -1
- package/build/lib/commands/intent.js +104 -216
- package/build/lib/commands/intent.js.map +1 -1
- package/build/lib/commands/keyboard.d.ts +6 -5
- package/build/lib/commands/keyboard.d.ts.map +1 -1
- package/build/lib/commands/keyboard.js +16 -8
- package/build/lib/commands/keyboard.js.map +1 -1
- package/build/lib/commands/log.d.ts +7 -44
- package/build/lib/commands/log.d.ts.map +1 -1
- package/build/lib/commands/log.js +146 -108
- package/build/lib/commands/log.js.map +1 -1
- package/build/lib/commands/media-projection.d.ts +7 -143
- package/build/lib/commands/media-projection.d.ts.map +1 -1
- package/build/lib/commands/media-projection.js +113 -140
- package/build/lib/commands/media-projection.js.map +1 -1
- package/build/lib/commands/mixins.d.ts +740 -0
- package/build/lib/commands/mixins.d.ts.map +1 -0
- package/build/lib/commands/mixins.js +19 -0
- package/build/lib/commands/mixins.js.map +1 -0
- package/build/lib/commands/network.d.ts +7 -138
- package/build/lib/commands/network.d.ts.map +1 -1
- package/build/lib/commands/network.js +212 -254
- package/build/lib/commands/network.js.map +1 -1
- package/build/lib/commands/performance.d.ts +24 -70
- package/build/lib/commands/performance.d.ts.map +1 -1
- package/build/lib/commands/performance.js +144 -100
- package/build/lib/commands/performance.js.map +1 -1
- package/build/lib/commands/permissions.d.ts +8 -92
- package/build/lib/commands/permissions.d.ts.map +1 -1
- package/build/lib/commands/permissions.js +75 -87
- package/build/lib/commands/permissions.js.map +1 -1
- package/build/lib/commands/recordscreen.d.ts +7 -193
- package/build/lib/commands/recordscreen.d.ts.map +1 -1
- package/build/lib/commands/recordscreen.js +151 -182
- package/build/lib/commands/recordscreen.js.map +1 -1
- package/build/lib/commands/shell.d.ts +7 -7
- package/build/lib/commands/shell.d.ts.map +1 -1
- package/build/lib/commands/shell.js +40 -33
- package/build/lib/commands/shell.js.map +1 -1
- package/build/lib/commands/streamscreen.d.ts +9 -103
- package/build/lib/commands/streamscreen.d.ts.map +1 -1
- package/build/lib/commands/streamscreen.js +261 -218
- package/build/lib/commands/streamscreen.js.map +1 -1
- package/build/lib/commands/system-bars.d.ts +22 -90
- package/build/lib/commands/system-bars.d.ts.map +1 -1
- package/build/lib/commands/system-bars.js +76 -74
- package/build/lib/commands/system-bars.js.map +1 -1
- package/build/lib/commands/touch.d.ts +10 -29
- package/build/lib/commands/touch.d.ts.map +1 -1
- package/build/lib/commands/touch.js +301 -285
- package/build/lib/commands/touch.js.map +1 -1
- package/build/lib/commands/types.d.ts +978 -0
- package/build/lib/commands/types.d.ts.map +1 -0
- package/build/lib/commands/types.js +3 -0
- package/build/lib/commands/types.js.map +1 -0
- package/build/lib/constraints.d.ts +291 -0
- package/build/lib/constraints.d.ts.map +1 -0
- package/build/lib/constraints.js +300 -0
- package/build/lib/constraints.js.map +1 -0
- package/build/lib/driver.d.ts +68 -37
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +123 -80
- package/build/lib/driver.js.map +1 -1
- package/build/lib/helpers/android.d.ts +164 -0
- package/build/lib/helpers/android.d.ts.map +1 -0
- package/build/lib/helpers/android.js +819 -0
- package/build/lib/helpers/android.js.map +1 -0
- package/build/lib/helpers/index.d.ts +7 -0
- package/build/lib/helpers/index.d.ts.map +1 -0
- package/build/lib/helpers/index.js +29 -0
- package/build/lib/helpers/index.js.map +1 -0
- package/build/lib/helpers/types.d.ts +121 -0
- package/build/lib/helpers/types.d.ts.map +1 -0
- package/build/lib/helpers/types.js +3 -0
- package/build/lib/helpers/types.js.map +1 -0
- package/build/lib/helpers/unlock.d.ts +32 -0
- package/build/lib/helpers/unlock.d.ts.map +1 -0
- package/build/lib/helpers/unlock.js +273 -0
- package/build/lib/helpers/unlock.js.map +1 -0
- package/build/lib/helpers/webview.d.ts +74 -0
- package/build/lib/helpers/webview.d.ts.map +1 -0
- package/build/lib/helpers/webview.js +421 -0
- package/build/lib/helpers/webview.js.map +1 -0
- package/build/lib/index.d.ts +9 -0
- package/build/lib/index.d.ts.map +1 -0
- package/build/lib/index.js +37 -0
- package/build/lib/index.js.map +1 -0
- package/build/lib/method-map.d.ts +0 -8
- package/build/lib/method-map.d.ts.map +1 -1
- package/build/lib/method-map.js +63 -74
- package/build/lib/method-map.js.map +1 -1
- package/build/lib/stubs.d.ts +0 -1
- package/build/lib/stubs.d.ts.map +1 -1
- package/build/lib/stubs.js +1 -0
- package/build/lib/stubs.js.map +1 -1
- package/build/lib/utils.d.ts +1 -1
- package/build/lib/utils.d.ts.map +1 -1
- package/lib/commands/actions.js +351 -464
- package/lib/commands/alert.js +27 -17
- package/lib/commands/app-management.js +156 -314
- package/lib/commands/context.js +457 -441
- package/lib/commands/element.js +201 -157
- package/lib/commands/emu-console.js +25 -45
- package/lib/commands/execute.js +106 -90
- package/lib/commands/file-actions.js +222 -240
- package/lib/commands/find.ts +103 -0
- package/lib/commands/general.js +327 -339
- package/lib/commands/ime.js +50 -34
- package/lib/commands/{index.js → index.ts} +20 -24
- package/lib/commands/intent.js +108 -249
- package/lib/commands/keyboard.js +20 -8
- package/lib/commands/log.js +172 -116
- package/lib/commands/media-projection.js +134 -161
- package/lib/commands/mixins.ts +966 -0
- package/lib/commands/network.js +252 -281
- package/lib/commands/performance.js +203 -132
- package/lib/commands/permissions.js +108 -109
- package/lib/commands/recordscreen.js +212 -209
- package/lib/commands/shell.js +51 -40
- package/lib/commands/streamscreen.js +355 -289
- package/lib/commands/system-bars.js +92 -83
- package/lib/commands/touch.js +357 -294
- package/lib/commands/types.ts +1097 -0
- package/lib/{desired-caps.js → constraints.ts} +106 -103
- package/lib/{driver.js → driver.ts} +278 -132
- package/lib/helpers/android.ts +1143 -0
- package/lib/helpers/index.ts +6 -0
- package/lib/helpers/types.ts +134 -0
- package/lib/helpers/unlock.ts +329 -0
- package/lib/helpers/webview.ts +582 -0
- package/lib/index.ts +18 -0
- package/lib/method-map.js +87 -98
- package/lib/stubs.ts +0 -1
- package/package.json +27 -20
- package/index.js +0 -24
- package/lib/android-helpers.js +0 -983
- package/lib/commands/coverage.js +0 -18
- package/lib/commands/find.js +0 -82
- package/lib/unlock-helpers.js +0 -278
- package/lib/webview-helpers.js +0 -602
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// @ts-check
|
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
5
|
};
|
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.commands = void 0;
|
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
8
|
const support_1 = require("@appium/support");
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const driver_1 = require("appium/driver");
|
|
11
11
|
const utils_1 = require("../utils");
|
|
12
|
+
const mixins_1 = require("./mixins");
|
|
12
13
|
const CONTAINER_PATH_MARKER = '@';
|
|
13
14
|
// https://regex101.com/r/PLdB0G/2
|
|
14
15
|
const CONTAINER_PATH_PATTERN = new RegExp(`^${CONTAINER_PATH_MARKER}([^/]+)/(.+)`);
|
|
15
16
|
const ANDROID_MEDIA_RESCAN_INTENT = 'android.intent.action.MEDIA_SCANNER_SCAN_FILE';
|
|
16
|
-
const commands = {};
|
|
17
|
-
exports.commands = commands;
|
|
18
17
|
/**
|
|
19
18
|
* Parses the actual destination path from the given value
|
|
20
19
|
*
|
|
@@ -38,26 +37,31 @@ function parseContainerPath(remotePath) {
|
|
|
38
37
|
* Exceptions are ignored and written into the log.
|
|
39
38
|
*
|
|
40
39
|
* @param {ADB} adb ADB instance
|
|
41
|
-
* @param {Object?} log Logger instance
|
|
42
40
|
* @param {string} remotePath The file/folder path on the remote device
|
|
41
|
+
* @param {import('@appium/types').AppiumLogger} [log] Logger instance
|
|
43
42
|
*/
|
|
44
|
-
async function scanMedia(adb, remotePath, log
|
|
43
|
+
async function scanMedia(adb, remotePath, log) {
|
|
45
44
|
log?.debug(`Performing media scan of '${remotePath}'`);
|
|
46
45
|
try {
|
|
47
46
|
// https://github.com/appium/appium/issues/16184
|
|
48
|
-
if (await adb.getApiLevel() >= 29) {
|
|
47
|
+
if ((await adb.getApiLevel()) >= 29) {
|
|
49
48
|
await adb.scanMedia(remotePath);
|
|
50
49
|
}
|
|
51
50
|
else {
|
|
52
51
|
await adb.shell([
|
|
53
|
-
'am',
|
|
54
|
-
'
|
|
55
|
-
'-
|
|
52
|
+
'am',
|
|
53
|
+
'broadcast',
|
|
54
|
+
'-a',
|
|
55
|
+
ANDROID_MEDIA_RESCAN_INTENT,
|
|
56
|
+
'-d',
|
|
57
|
+
`file://${remotePath}`,
|
|
56
58
|
]);
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
catch (e) {
|
|
60
|
-
|
|
62
|
+
const err = /** @type {any} */ (e);
|
|
63
|
+
// FIXME: what has a `stderr` prop?
|
|
64
|
+
log?.warn(`Ignoring an unexpected error upon media scanning of '${remotePath}': ${err.stderr ?? err.message}`);
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
67
|
/**
|
|
@@ -71,187 +75,181 @@ function escapePath(p) {
|
|
|
71
75
|
return p.replace(/'/g, `\\'`);
|
|
72
76
|
}
|
|
73
77
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* in order to access its files.
|
|
77
|
-
*
|
|
78
|
-
* @param {string} remotePath The full path to the remote file
|
|
79
|
-
* or a specially formatted path, which points to an item inside app bundle
|
|
80
|
-
* @returns {string} Base64 encoded content of the pulled file
|
|
81
|
-
* @throws {Error} If the pull operation failed
|
|
78
|
+
* @type {import('./mixins').FileActionsMixin & ThisType<import('../driver').AndroidDriver>}
|
|
79
|
+
* @satisfies {import('@appium/types').ExternalDriver}
|
|
82
80
|
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (remotePath.startsWith(CONTAINER_PATH_MARKER)) {
|
|
90
|
-
const [packageId, pathInContainer] = parseContainerPath(remotePath);
|
|
91
|
-
this.log.debug(`Parsed package identifier '${packageId}' from '${remotePath}'. Will get the data from '${pathInContainer}'`);
|
|
92
|
-
tmpDestination = `/data/local/tmp/${path_1.default.posix.basename(pathInContainer)}`;
|
|
93
|
-
try {
|
|
94
|
-
await this.adb.shell(['run-as', packageId, `chmod 777 '${escapePath(pathInContainer)}'`]);
|
|
95
|
-
await this.adb.shell([
|
|
96
|
-
'run-as', packageId,
|
|
97
|
-
`cp -f '${escapePath(pathInContainer)}' '${escapePath(tmpDestination)}'`
|
|
98
|
-
]);
|
|
99
|
-
}
|
|
100
|
-
catch (e) {
|
|
101
|
-
this.log.errorAndThrow(`Cannot access the container of '${packageId}' application. ` +
|
|
102
|
-
`Is the application installed and has 'debuggable' build option set to true? ` +
|
|
103
|
-
`Original error: ${e.message}`);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
const localFile = await support_1.tempDir.path({ prefix: 'appium', suffix: '.tmp' });
|
|
107
|
-
try {
|
|
108
|
-
await this.adb.pull(tmpDestination || remotePath, localFile);
|
|
109
|
-
return (await support_1.util.toInMemoryBase64(localFile)).toString();
|
|
110
|
-
}
|
|
111
|
-
finally {
|
|
112
|
-
if (await support_1.fs.exists(localFile)) {
|
|
113
|
-
await support_1.fs.unlink(localFile);
|
|
114
|
-
}
|
|
115
|
-
if (tmpDestination) {
|
|
116
|
-
await this.adb.shell(['rm', '-f', tmpDestination]);
|
|
81
|
+
const FileActionsMixin = {
|
|
82
|
+
async pullFile(remotePath) {
|
|
83
|
+
const adb = /** @type {ADB} */ (this.adb);
|
|
84
|
+
if (remotePath.endsWith('/')) {
|
|
85
|
+
throw new driver_1.errors.InvalidArgumentError(`It is expected that remote path points to a file and not to a folder. ` +
|
|
86
|
+
`'${remotePath}' is given instead`);
|
|
117
87
|
}
|
|
118
|
-
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* @typedef {Object} PullFileOptions
|
|
122
|
-
* @property {string} remotePath The full path to the remote file
|
|
123
|
-
* or a specially formatted path, which points to an item inside an app bundle,
|
|
124
|
-
* for example `@my.app.id/my/path`. It is mandatory for the app bundle to have
|
|
125
|
-
* debugging enabled in order to use the latter remotePath format.
|
|
126
|
-
*/
|
|
127
|
-
/**
|
|
128
|
-
* Pulls a remote file from the device.
|
|
129
|
-
*
|
|
130
|
-
* @param {PullFileOptions} opts
|
|
131
|
-
* @returns {string} The same as `pullFile`
|
|
132
|
-
*/
|
|
133
|
-
commands.mobilePullFile = async function mobilePullFile(opts = {}) {
|
|
134
|
-
const { remotePath } = (0, utils_1.requireArgs)('remotePath', opts);
|
|
135
|
-
return await this.pullFile(remotePath);
|
|
136
|
-
};
|
|
137
|
-
/**
|
|
138
|
-
* Pushes the given data to a file on the remote device
|
|
139
|
-
* It is required, that a package has debugging flag enabled
|
|
140
|
-
* in order to access its files.
|
|
141
|
-
* After a file is pushed it gets automatically scanned for possible
|
|
142
|
-
* media occurrences. If the scan succeeds then the file is added to the
|
|
143
|
-
* media library.
|
|
144
|
-
*
|
|
145
|
-
* @param {string} remotePath The full path to the remote file or
|
|
146
|
-
* a file inside a package bundle
|
|
147
|
-
* @param {string} base64Data Base64 encoded data to be written to the
|
|
148
|
-
* remote file. The remote file will be silently overridden if it already exists.
|
|
149
|
-
* @throws {Error} If there was an error while pushing the data
|
|
150
|
-
*/
|
|
151
|
-
commands.pushFile = async function pushFile(remotePath, base64Data) {
|
|
152
|
-
if (remotePath.endsWith('/')) {
|
|
153
|
-
throw new driver_1.errors.InvalidArgumentError(`It is expected that remote path points to a file and not to a folder. ` +
|
|
154
|
-
`'${remotePath}' is given instead`);
|
|
155
|
-
}
|
|
156
|
-
const localFile = await support_1.tempDir.path({ prefix: 'appium', suffix: '.tmp' });
|
|
157
|
-
if (lodash_1.default.isArray(base64Data)) {
|
|
158
|
-
// some clients (ahem) java, send a byte array encoding utf8 characters
|
|
159
|
-
// instead of a string, which would be infinitely better!
|
|
160
|
-
base64Data = Buffer.from(base64Data).toString('utf8');
|
|
161
|
-
}
|
|
162
|
-
const content = Buffer.from(base64Data, 'base64');
|
|
163
|
-
let tmpDestination = null;
|
|
164
|
-
try {
|
|
165
|
-
await support_1.fs.writeFile(localFile, content.toString('binary'), 'binary');
|
|
88
|
+
let tmpDestination = null;
|
|
166
89
|
if (remotePath.startsWith(CONTAINER_PATH_MARKER)) {
|
|
167
90
|
const [packageId, pathInContainer] = parseContainerPath(remotePath);
|
|
168
|
-
this.log.debug(`Parsed package identifier '${packageId}' from '${remotePath}'. `
|
|
169
|
-
`Will put the data into '${pathInContainer}'`);
|
|
91
|
+
this.log.debug(`Parsed package identifier '${packageId}' from '${remotePath}'. Will get the data from '${pathInContainer}'`);
|
|
170
92
|
tmpDestination = `/data/local/tmp/${path_1.default.posix.basename(pathInContainer)}`;
|
|
171
93
|
try {
|
|
172
|
-
await
|
|
173
|
-
await
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
'run-as', packageId,
|
|
178
|
-
`cp -f '${escapePath(tmpDestination)}' '${escapePath(pathInContainer)}'`
|
|
94
|
+
await adb.shell(['run-as', packageId, `chmod 777 '${escapePath(pathInContainer)}'`]);
|
|
95
|
+
await adb.shell([
|
|
96
|
+
'run-as',
|
|
97
|
+
packageId,
|
|
98
|
+
`cp -f '${escapePath(pathInContainer)}' '${escapePath(tmpDestination)}'`,
|
|
179
99
|
]);
|
|
180
100
|
}
|
|
181
101
|
catch (e) {
|
|
182
102
|
this.log.errorAndThrow(`Cannot access the container of '${packageId}' application. ` +
|
|
183
103
|
`Is the application installed and has 'debuggable' build option set to true? ` +
|
|
184
|
-
`Original error: ${e.message}`);
|
|
104
|
+
`Original error: ${ /** @type {Error} */(e).message}`);
|
|
185
105
|
}
|
|
186
106
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
await
|
|
190
|
-
|
|
191
|
-
// apps know about it
|
|
192
|
-
await scanMedia(this.adb, remotePath, this.log);
|
|
107
|
+
const localFile = await support_1.tempDir.path({ prefix: 'appium', suffix: '.tmp' });
|
|
108
|
+
try {
|
|
109
|
+
await adb.pull(tmpDestination || remotePath, localFile);
|
|
110
|
+
return (await support_1.util.toInMemoryBase64(localFile)).toString();
|
|
193
111
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
112
|
+
finally {
|
|
113
|
+
if (await support_1.fs.exists(localFile)) {
|
|
114
|
+
await support_1.fs.unlink(localFile);
|
|
115
|
+
}
|
|
116
|
+
if (tmpDestination) {
|
|
117
|
+
await adb.shell(['rm', '-f', tmpDestination]);
|
|
118
|
+
}
|
|
198
119
|
}
|
|
199
|
-
|
|
200
|
-
|
|
120
|
+
},
|
|
121
|
+
async mobilePullFile(opts) {
|
|
122
|
+
const { remotePath } = (0, utils_1.requireArgs)('remotePath', opts);
|
|
123
|
+
return await this.pullFile(remotePath);
|
|
124
|
+
},
|
|
125
|
+
async pushFile(remotePath, base64Data) {
|
|
126
|
+
if (remotePath.endsWith('/')) {
|
|
127
|
+
throw new driver_1.errors.InvalidArgumentError(`It is expected that remote path points to a file and not to a folder. ` +
|
|
128
|
+
`'${remotePath}' is given instead`);
|
|
201
129
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
130
|
+
const localFile = await support_1.tempDir.path({ prefix: 'appium', suffix: '.tmp' });
|
|
131
|
+
if (lodash_1.default.isArray(base64Data)) {
|
|
132
|
+
// some clients (ahem) java, send a byte array encoding utf8 characters
|
|
133
|
+
// instead of a string, which would be infinitely better!
|
|
134
|
+
base64Data = Buffer.from(base64Data).toString('utf8');
|
|
135
|
+
}
|
|
136
|
+
const content = Buffer.from(base64Data, 'base64');
|
|
137
|
+
let tmpDestination = null;
|
|
138
|
+
const adb = /** @type {ADB} */ (this.adb);
|
|
139
|
+
try {
|
|
140
|
+
await support_1.fs.writeFile(localFile, content.toString('binary'), 'binary');
|
|
141
|
+
if (remotePath.startsWith(CONTAINER_PATH_MARKER)) {
|
|
142
|
+
const [packageId, pathInContainer] = parseContainerPath(remotePath);
|
|
143
|
+
this.log.debug(`Parsed package identifier '${packageId}' from '${remotePath}'. ` +
|
|
144
|
+
`Will put the data into '${pathInContainer}'`);
|
|
145
|
+
tmpDestination = `/data/local/tmp/${path_1.default.posix.basename(pathInContainer)}`;
|
|
146
|
+
try {
|
|
147
|
+
await adb.shell([
|
|
148
|
+
'run-as',
|
|
149
|
+
packageId,
|
|
150
|
+
`mkdir -p '${escapePath(path_1.default.posix.dirname(pathInContainer))}'`,
|
|
151
|
+
]);
|
|
152
|
+
await adb.shell(['run-as', packageId, `touch '${escapePath(pathInContainer)}'`]);
|
|
153
|
+
await adb.shell(['run-as', packageId, `chmod 777 '${escapePath(pathInContainer)}'`]);
|
|
154
|
+
await adb.push(localFile, tmpDestination);
|
|
155
|
+
await adb.shell([
|
|
156
|
+
'run-as',
|
|
157
|
+
packageId,
|
|
158
|
+
`cp -f '${escapePath(tmpDestination)}' '${escapePath(pathInContainer)}'`,
|
|
159
|
+
]);
|
|
160
|
+
}
|
|
161
|
+
catch (e) {
|
|
162
|
+
this.log.errorAndThrow(`Cannot access the container of '${packageId}' application. ` +
|
|
163
|
+
`Is the application installed and has 'debuggable' build option set to true? ` +
|
|
164
|
+
`Original error: ${ /** @type {Error} */(e).message}`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
// adb push creates folders and overwrites existing files.
|
|
169
|
+
await adb.push(localFile, remotePath);
|
|
170
|
+
// if we have pushed a file, it might be a media file, so ensure that
|
|
171
|
+
// apps know about it
|
|
172
|
+
await scanMedia(adb, remotePath, this.log);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
finally {
|
|
176
|
+
if (await support_1.fs.exists(localFile)) {
|
|
177
|
+
await support_1.fs.unlink(localFile);
|
|
178
|
+
}
|
|
179
|
+
if (tmpDestination) {
|
|
180
|
+
await adb.shell(['rm', '-f', tmpDestination]);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
async mobilePushFile(opts) {
|
|
185
|
+
const { remotePath, payload } = (0, utils_1.requireArgs)(['remotePath', 'payload'], opts);
|
|
186
|
+
return await this.pushFile(remotePath, payload);
|
|
187
|
+
},
|
|
188
|
+
async pullFolder(remotePath) {
|
|
189
|
+
const tmpRoot = await support_1.tempDir.openDir();
|
|
190
|
+
try {
|
|
191
|
+
await /** @type {ADB} */ (this.adb).pull(remotePath, tmpRoot);
|
|
192
|
+
return (await support_1.zip.toInMemoryZip(tmpRoot, {
|
|
193
|
+
encodeToBase64: true,
|
|
194
|
+
})).toString();
|
|
195
|
+
}
|
|
196
|
+
finally {
|
|
197
|
+
await support_1.fs.rimraf(tmpRoot);
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
async mobilePullFolder(opts) {
|
|
201
|
+
const { remotePath } = (0, utils_1.requireArgs)('remotePath', opts);
|
|
202
|
+
return await this.pullFolder(remotePath);
|
|
203
|
+
},
|
|
204
|
+
async mobileDeleteFile(opts) {
|
|
205
|
+
const { remotePath } = (0, utils_1.requireArgs)('remotePath', opts);
|
|
206
|
+
if (remotePath.endsWith('/')) {
|
|
207
|
+
throw new driver_1.errors.InvalidArgumentError(`It is expected that remote path points to a folder and not to a file. ` +
|
|
208
|
+
`'${remotePath}' is given instead`);
|
|
209
|
+
}
|
|
210
|
+
return await deleteFileOrFolder.call(this, /** @type {ADB} */ (this.adb), remotePath);
|
|
211
|
+
},
|
|
240
212
|
};
|
|
241
213
|
/**
|
|
242
|
-
*
|
|
243
|
-
* @
|
|
244
|
-
*/
|
|
245
|
-
/**
|
|
246
|
-
* Pulls the whole folder from the device under test.
|
|
247
|
-
*
|
|
248
|
-
* @param {PullFolderOptions} opts
|
|
249
|
-
* @returns {string} The same as `pullFolder`
|
|
214
|
+
* Factory providing filesystem test functions using ADB
|
|
215
|
+
* @param {ADB} adb
|
|
250
216
|
*/
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}
|
|
217
|
+
function createFSTests(adb) {
|
|
218
|
+
/**
|
|
219
|
+
*
|
|
220
|
+
* @param {string} p
|
|
221
|
+
* @param {'d'|'f'|'e'} op
|
|
222
|
+
* @param {string} [runAs]
|
|
223
|
+
* @returns
|
|
224
|
+
*/
|
|
225
|
+
const performRemoteFsCheck = async (p, op, runAs) => {
|
|
226
|
+
const passFlag = '__PASS__';
|
|
227
|
+
const checkCmd = `[ -${op} '${escapePath(p)}' ] && echo ${passFlag}`;
|
|
228
|
+
const fullCmd = runAs ? `run-as ${runAs} ${checkCmd}` : checkCmd;
|
|
229
|
+
try {
|
|
230
|
+
return lodash_1.default.includes(await adb.shell([fullCmd]), passFlag);
|
|
231
|
+
}
|
|
232
|
+
catch (ign) {
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
/**
|
|
237
|
+
* @param {string} p
|
|
238
|
+
* @param {string} [runAs]
|
|
239
|
+
*/
|
|
240
|
+
const isFile = async (p, runAs) => await performRemoteFsCheck(p, 'f', runAs);
|
|
241
|
+
/**
|
|
242
|
+
* @param {string} p
|
|
243
|
+
* @param {string} [runAs]
|
|
244
|
+
*/
|
|
245
|
+
const isDir = async (p, runAs) => await performRemoteFsCheck(p, 'd', runAs);
|
|
246
|
+
/**
|
|
247
|
+
* @param {string} p
|
|
248
|
+
* @param {string} [runAs]
|
|
249
|
+
*/
|
|
250
|
+
const isPresent = async (p, runAs) => await performRemoteFsCheck(p, 'e', runAs);
|
|
251
|
+
return { isFile, isDir, isPresent };
|
|
252
|
+
}
|
|
255
253
|
/**
|
|
256
254
|
* Deletes the given folder or file from the remote device
|
|
257
255
|
*
|
|
@@ -260,27 +258,16 @@ commands.mobilePullFolder = async function mobilePullFolder(opts = {}) {
|
|
|
260
258
|
* or file (folder names must end with a single slash)
|
|
261
259
|
* @throws {Error} If the provided remote path is invalid or
|
|
262
260
|
* the package content cannot be accessed
|
|
263
|
-
* @returns {boolean} `true` if the remote item has been successfully deleted.
|
|
261
|
+
* @returns {Promise<boolean>} `true` if the remote item has been successfully deleted.
|
|
264
262
|
* If the remote path is valid, but the remote path does not exist
|
|
265
263
|
* this function return `false`.
|
|
264
|
+
* @this {import('../driver').AndroidDriver}
|
|
266
265
|
*/
|
|
267
266
|
async function deleteFileOrFolder(adb, remotePath) {
|
|
268
|
-
const
|
|
269
|
-
const passFlag = '__PASS__';
|
|
270
|
-
const checkCmd = `[ -${op} '${escapePath(p)}' ] && echo ${passFlag}`;
|
|
271
|
-
const fullCmd = runAs ? `run-as ${runAs} ${checkCmd}` : checkCmd;
|
|
272
|
-
try {
|
|
273
|
-
return lodash_1.default.includes(await adb.shell([fullCmd]), passFlag);
|
|
274
|
-
}
|
|
275
|
-
catch (ign) {
|
|
276
|
-
return false;
|
|
277
|
-
}
|
|
278
|
-
};
|
|
279
|
-
const isFile = async (p, runAs = null) => await performRemoteFsCheck(p, 'f', runAs);
|
|
280
|
-
const isDir = async (p, runAs = null) => await performRemoteFsCheck(p, 'd', runAs);
|
|
281
|
-
const isPresent = async (p, runAs = null) => await performRemoteFsCheck(p, 'e', runAs);
|
|
267
|
+
const { isDir, isPresent, isFile } = createFSTests(adb);
|
|
282
268
|
let dstPath = remotePath;
|
|
283
|
-
|
|
269
|
+
/** @type {string|undefined} */
|
|
270
|
+
let pkgId;
|
|
284
271
|
if (remotePath.startsWith(CONTAINER_PATH_MARKER)) {
|
|
285
272
|
const [packageId, pathInContainer] = parseContainerPath(remotePath);
|
|
286
273
|
this.log.debug(`Parsed package identifier '${packageId}' from '${remotePath}'`);
|
|
@@ -294,18 +281,18 @@ async function deleteFileOrFolder(adb, remotePath) {
|
|
|
294
281
|
catch (e) {
|
|
295
282
|
this.log.errorAndThrow(`Cannot access the container of '${pkgId}' application. ` +
|
|
296
283
|
`Is the application installed and has 'debuggable' build option set to true? ` +
|
|
297
|
-
`Original error: ${e.message}`);
|
|
284
|
+
`Original error: ${ /** @type {Error} */(e).message}`);
|
|
298
285
|
}
|
|
299
286
|
}
|
|
300
|
-
if (!await isPresent(dstPath, pkgId)) {
|
|
287
|
+
if (!(await isPresent(dstPath, pkgId))) {
|
|
301
288
|
this.log.info(`The item at '${dstPath}' does not exist. Perhaps, already deleted?`);
|
|
302
289
|
return false;
|
|
303
290
|
}
|
|
304
291
|
const expectsFile = !remotePath.endsWith('/');
|
|
305
|
-
if (expectsFile && !await isFile(dstPath, pkgId)) {
|
|
292
|
+
if (expectsFile && !(await isFile(dstPath, pkgId))) {
|
|
306
293
|
this.log.errorAndThrow(`The item at '${dstPath}' is not a file`);
|
|
307
294
|
}
|
|
308
|
-
else if (!expectsFile && !await isDir(dstPath, pkgId)) {
|
|
295
|
+
else if (!expectsFile && !(await isDir(dstPath, pkgId))) {
|
|
309
296
|
this.log.errorAndThrow(`The item at '${dstPath}' is not a folder`);
|
|
310
297
|
}
|
|
311
298
|
if (pkgId) {
|
|
@@ -315,36 +302,13 @@ async function deleteFileOrFolder(adb, remotePath) {
|
|
|
315
302
|
await adb.shell(['rm', `-f${expectsFile ? '' : 'r'}`, dstPath]);
|
|
316
303
|
}
|
|
317
304
|
if (await isPresent(dstPath, pkgId)) {
|
|
318
|
-
this.log.errorAndThrow(`The item at '${dstPath}' still exists after being deleted. ` +
|
|
319
|
-
`Is it writable?`);
|
|
305
|
+
this.log.errorAndThrow(`The item at '${dstPath}' still exists after being deleted. ` + `Is it writable?`);
|
|
320
306
|
}
|
|
321
307
|
return true;
|
|
322
308
|
}
|
|
309
|
+
(0, mixins_1.mixin)(FileActionsMixin);
|
|
323
310
|
/**
|
|
324
|
-
* @typedef {
|
|
325
|
-
* @property {!string} remotePath The full path to the remote file
|
|
326
|
-
* or a file inside an application bundle (for example `@my.app.id/path/in/bundle`)
|
|
311
|
+
* @typedef {import('appium-adb').ADB} ADB
|
|
327
312
|
*/
|
|
328
|
-
|
|
329
|
-
* Deletes a file on the remote device
|
|
330
|
-
*
|
|
331
|
-
* @param {DeleteFileOpts} opts
|
|
332
|
-
* @returns {boolean} `true` if the remote file has been successfully deleted.
|
|
333
|
-
* If the path to a remote file is valid, but the file itself does not exist
|
|
334
|
-
* then `false` is returned.
|
|
335
|
-
* @throws {Error} If the argument is invalid or there was an error while
|
|
336
|
-
* deleting the file
|
|
337
|
-
*/
|
|
338
|
-
commands.mobileDeleteFile = async function mobileDeleteFile(opts = {}) {
|
|
339
|
-
const { remotePath } = opts;
|
|
340
|
-
if (!remotePath) {
|
|
341
|
-
throw new driver_1.errors.InvalidArgumentError(`The 'remotePath' argument is mandatory`);
|
|
342
|
-
}
|
|
343
|
-
if (remotePath.endsWith('/')) {
|
|
344
|
-
throw new driver_1.errors.InvalidArgumentError(`It is expected that remote path points to a folder and not to a file. ` +
|
|
345
|
-
`'${remotePath}' is given instead`);
|
|
346
|
-
}
|
|
347
|
-
return await deleteFileOrFolder(this.adb, remotePath);
|
|
348
|
-
};
|
|
349
|
-
exports.default = commands;
|
|
313
|
+
exports.default = FileActionsMixin;
|
|
350
314
|
//# sourceMappingURL=file-actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-actions.js","sourceRoot":"","sources":["../../../lib/commands/file-actions.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file-actions.js","sourceRoot":"","sources":["../../../lib/commands/file-actions.js"],"names":[],"mappings":";AAAA,YAAY;;;;;AAEZ,oDAAuB;AACvB,6CAAuD;AACvD,gDAAwB;AACxB,0CAAqC;AACrC,oCAAqC;AACrC,qCAA+B;AAE/B,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,kCAAkC;AAClC,MAAM,sBAAsB,GAAG,IAAI,MAAM,CAAC,IAAI,qBAAqB,cAAc,CAAC,CAAC;AACnF,MAAM,2BAA2B,GAAG,+CAA+C,CAAC;AAEpF;;;;;;;;GAQG;AACH,SAAS,kBAAkB,CAAC,UAAU;IACpC,MAAM,KAAK,GAAG,sBAAsB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACtD,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,IAAI,KAAK,CACb,kGAAkG;YAChG,IAAI,UAAU,oBAAoB,CACrC,CAAC;KACH;IACD,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,cAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED;;;;;;;;GAQG;AACH,KAAK,UAAU,SAAS,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG;IAC3C,GAAG,EAAE,KAAK,CAAC,6BAA6B,UAAU,GAAG,CAAC,CAAC;IACvD,IAAI;QACF,gDAAgD;QAChD,IAAI,CAAC,MAAM,GAAG,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE;YACnC,MAAM,GAAG,C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,iBAAiB,CAAC,CAAC;KAClE;SAAM,IAAI,CAAC,WAAW,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,EAAE;QACzD,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,gBAAgB,OAAO,mBAAmB,CAAC,CAAC;KACpE;IAED,IAAI,KAAK,EAAE;QACT,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;KAC/F;SAAM;QACL,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;KACjE;IACD,IAAI,MAAM,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;QACnC,IAAI,CAAC,GAAG,CAAC,aAAa,CACpB,gBAAgB,OAAO,sCAAsC,GAAG,iBAAiB,CAClF,CAAC;KACH;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,IAAA,cAAK,EAAC,gBAAgB,CAAC,CAAC;AAExB;;GAEG;AAEH,kBAAe,gBAAgB,CAAC"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function doFindElementOrEls(params: any): Promise<any>;
|
|
10
|
-
function findElOrEls(strategy: any, selector: any, mult: any, context?: string): Promise<any[] | undefined>;
|
|
11
|
-
}
|
|
12
|
-
declare let extensions: {};
|
|
1
|
+
/**
|
|
2
|
+
* @privateRemarks This file needed to be converted to TS because the overload of `findElOrEls` is seemingly impossible to express in JS since the value of `this` cannot be bound via a type assertion.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
import { type FindMixin } from './mixins';
|
|
6
|
+
import type { AndroidDriver } from '../driver';
|
|
7
|
+
declare const FindMixin: FindMixin & ThisType<AndroidDriver>;
|
|
8
|
+
export default FindMixin;
|
|
13
9
|
//# sourceMappingURL=find.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../lib/commands/find.
|
|
1
|
+
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../lib/commands/find.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAQ,KAAK,SAAS,EAAC,MAAM,UAAU,CAAC;AAE/C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC;AAoF7C,QAAA,MAAM,SAAS,EAAE,SAAS,GAAG,QAAQ,CAAC,aAAa,CAMlD,CAAC;AAIF,eAAe,SAAS,CAAC"}
|