appium-android-driver 13.4.0 → 14.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/CHANGELOG.md +10 -0
- package/build/lib/commands/app-management.d.ts +2 -2
- package/build/lib/commands/app-management.d.ts.map +1 -1
- package/build/lib/commands/app-management.js +41 -67
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/appearance.d.ts +1 -1
- package/build/lib/commands/appearance.d.ts.map +1 -1
- package/build/lib/commands/appearance.js +2 -6
- package/build/lib/commands/appearance.js.map +1 -1
- package/build/lib/commands/bidi/constants.js +4 -8
- package/build/lib/commands/bidi/constants.js.map +1 -1
- package/build/lib/commands/bidi/models.d.ts +1 -1
- package/build/lib/commands/bidi/models.d.ts.map +1 -1
- package/build/lib/commands/bidi/models.js +7 -13
- package/build/lib/commands/bidi/models.js.map +1 -1
- package/build/lib/commands/bidi/types.js +1 -2
- package/build/lib/commands/bluetooth.d.ts +1 -1
- package/build/lib/commands/bluetooth.d.ts.map +1 -1
- package/build/lib/commands/bluetooth.js +3 -6
- package/build/lib/commands/bluetooth.js.map +1 -1
- package/build/lib/commands/context/cache.d.ts +1 -1
- package/build/lib/commands/context/cache.d.ts.map +1 -1
- package/build/lib/commands/context/cache.js +5 -10
- package/build/lib/commands/context/cache.js.map +1 -1
- package/build/lib/commands/context/exports.d.ts +2 -2
- package/build/lib/commands/context/exports.d.ts.map +1 -1
- package/build/lib/commands/context/exports.js +64 -86
- package/build/lib/commands/context/exports.js.map +1 -1
- package/build/lib/commands/context/helpers.d.ts +2 -2
- package/build/lib/commands/context/helpers.d.ts.map +1 -1
- package/build/lib/commands/context/helpers.js +69 -82
- package/build/lib/commands/context/helpers.js.map +1 -1
- package/build/lib/commands/device/common.d.ts +2 -2
- package/build/lib/commands/device/common.d.ts.map +1 -1
- package/build/lib/commands/device/common.js +28 -71
- package/build/lib/commands/device/common.js.map +1 -1
- package/build/lib/commands/device/emulator-actions.d.ts +2 -2
- package/build/lib/commands/device/emulator-actions.d.ts.map +1 -1
- package/build/lib/commands/device/emulator-actions.js +33 -52
- package/build/lib/commands/device/emulator-actions.js.map +1 -1
- package/build/lib/commands/device/emulator-console.d.ts +1 -1
- package/build/lib/commands/device/emulator-console.d.ts.map +1 -1
- package/build/lib/commands/device/emulator-console.js +3 -6
- package/build/lib/commands/device/emulator-console.js.map +1 -1
- package/build/lib/commands/device/utils.d.ts +1 -1
- package/build/lib/commands/device/utils.d.ts.map +1 -1
- package/build/lib/commands/device/utils.js +27 -37
- package/build/lib/commands/device/utils.js.map +1 -1
- package/build/lib/commands/deviceidle.d.ts +1 -1
- package/build/lib/commands/deviceidle.d.ts.map +1 -1
- package/build/lib/commands/deviceidle.js +4 -7
- package/build/lib/commands/deviceidle.js.map +1 -1
- package/build/lib/commands/element.d.ts +2 -2
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js +22 -39
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/execute.d.ts +1 -1
- package/build/lib/commands/execute.d.ts.map +1 -1
- package/build/lib/commands/execute.js +6 -9
- package/build/lib/commands/execute.js.map +1 -1
- package/build/lib/commands/file-actions.d.ts +1 -1
- package/build/lib/commands/file-actions.d.ts.map +1 -1
- package/build/lib/commands/file-actions.js +25 -34
- package/build/lib/commands/file-actions.js.map +1 -1
- package/build/lib/commands/find.d.ts +2 -2
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js +10 -14
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/commands/geolocation.d.ts +1 -1
- package/build/lib/commands/geolocation.d.ts.map +1 -1
- package/build/lib/commands/geolocation.js +21 -35
- package/build/lib/commands/geolocation.js.map +1 -1
- package/build/lib/commands/gestures.d.ts +1 -1
- package/build/lib/commands/gestures.d.ts.map +1 -1
- package/build/lib/commands/gestures.js +4 -7
- package/build/lib/commands/gestures.js.map +1 -1
- package/build/lib/commands/image-injection.d.ts +1 -1
- package/build/lib/commands/image-injection.d.ts.map +1 -1
- package/build/lib/commands/image-injection.js +16 -23
- package/build/lib/commands/image-injection.js.map +1 -1
- package/build/lib/commands/ime.d.ts +1 -1
- package/build/lib/commands/ime.d.ts.map +1 -1
- package/build/lib/commands/ime.js +10 -18
- package/build/lib/commands/ime.js.map +1 -1
- package/build/lib/commands/intent.d.ts +1 -1
- package/build/lib/commands/intent.d.ts.map +1 -1
- package/build/lib/commands/intent.js +22 -29
- package/build/lib/commands/intent.js.map +1 -1
- package/build/lib/commands/keyboard.d.ts +2 -2
- package/build/lib/commands/keyboard.d.ts.map +1 -1
- package/build/lib/commands/keyboard.js +21 -33
- package/build/lib/commands/keyboard.js.map +1 -1
- package/build/lib/commands/legacy.d.ts +1 -1
- package/build/lib/commands/legacy.d.ts.map +1 -1
- package/build/lib/commands/legacy.js +7 -12
- package/build/lib/commands/legacy.js.map +1 -1
- package/build/lib/commands/lock/exports.d.ts +2 -2
- package/build/lib/commands/lock/exports.d.ts.map +1 -1
- package/build/lib/commands/lock/exports.js +18 -25
- package/build/lib/commands/lock/exports.js.map +1 -1
- package/build/lib/commands/lock/helpers.d.ts +2 -2
- package/build/lib/commands/lock/helpers.d.ts.map +1 -1
- package/build/lib/commands/lock/helpers.js +48 -64
- package/build/lib/commands/lock/helpers.js.map +1 -1
- package/build/lib/commands/log.d.ts +2 -2
- package/build/lib/commands/log.d.ts.map +1 -1
- package/build/lib/commands/log.js +38 -42
- package/build/lib/commands/log.js.map +1 -1
- package/build/lib/commands/media-projection.d.ts +2 -2
- package/build/lib/commands/media-projection.d.ts.map +1 -1
- package/build/lib/commands/media-projection.js +14 -22
- package/build/lib/commands/media-projection.js.map +1 -1
- package/build/lib/commands/memory.d.ts +2 -2
- package/build/lib/commands/memory.d.ts.map +1 -1
- package/build/lib/commands/memory.js +4 -7
- package/build/lib/commands/memory.js.map +1 -1
- package/build/lib/commands/misc.d.ts +2 -2
- package/build/lib/commands/misc.d.ts.map +1 -1
- package/build/lib/commands/misc.js +10 -19
- package/build/lib/commands/misc.js.map +1 -1
- package/build/lib/commands/network.d.ts +2 -2
- package/build/lib/commands/network.d.ts.map +1 -1
- package/build/lib/commands/network.js +14 -26
- package/build/lib/commands/network.js.map +1 -1
- package/build/lib/commands/nfc.d.ts +2 -2
- package/build/lib/commands/nfc.d.ts.map +1 -1
- package/build/lib/commands/nfc.js +3 -6
- package/build/lib/commands/nfc.js.map +1 -1
- package/build/lib/commands/performance.d.ts +2 -2
- package/build/lib/commands/performance.d.ts.map +1 -1
- package/build/lib/commands/performance.js +48 -58
- package/build/lib/commands/performance.js.map +1 -1
- package/build/lib/commands/permissions.d.ts +1 -1
- package/build/lib/commands/permissions.d.ts.map +1 -1
- package/build/lib/commands/permissions.js +16 -20
- package/build/lib/commands/permissions.js.map +1 -1
- package/build/lib/commands/recordscreen.d.ts +2 -2
- package/build/lib/commands/recordscreen.d.ts.map +1 -1
- package/build/lib/commands/recordscreen.js +32 -39
- package/build/lib/commands/recordscreen.js.map +1 -1
- package/build/lib/commands/resources.d.ts +1 -1
- package/build/lib/commands/resources.d.ts.map +1 -1
- package/build/lib/commands/resources.js +7 -11
- package/build/lib/commands/resources.js.map +1 -1
- package/build/lib/commands/shell.d.ts +1 -1
- package/build/lib/commands/shell.d.ts.map +1 -1
- package/build/lib/commands/shell.js +9 -12
- package/build/lib/commands/shell.js.map +1 -1
- package/build/lib/commands/streamscreen.d.ts +1 -1
- package/build/lib/commands/streamscreen.d.ts.map +1 -1
- package/build/lib/commands/streamscreen.js +32 -37
- package/build/lib/commands/streamscreen.js.map +1 -1
- package/build/lib/commands/system-bars.d.ts +2 -2
- package/build/lib/commands/system-bars.d.ts.map +1 -1
- package/build/lib/commands/system-bars.js +10 -16
- package/build/lib/commands/system-bars.js.map +1 -1
- package/build/lib/commands/time.d.ts +1 -1
- package/build/lib/commands/time.d.ts.map +1 -1
- package/build/lib/commands/time.js +9 -17
- package/build/lib/commands/time.js.map +1 -1
- package/build/lib/commands/types.d.ts +15 -1
- package/build/lib/commands/types.d.ts.map +1 -1
- package/build/lib/commands/types.js +1 -2
- package/build/lib/constraints.js +2 -5
- package/build/lib/constraints.js.map +1 -1
- package/build/lib/doctor/checks.js +54 -65
- package/build/lib/doctor/checks.js.map +1 -1
- package/build/lib/doctor/utils.js +4 -7
- package/build/lib/doctor/utils.js.map +1 -1
- package/build/lib/driver.d.ts +39 -39
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +220 -223
- package/build/lib/driver.js.map +1 -1
- package/build/lib/execute-method-map.js +1 -4
- package/build/lib/execute-method-map.js.map +1 -1
- package/build/lib/index.d.ts +7 -7
- package/build/lib/index.d.ts.map +1 -1
- package/build/lib/index.js +11 -51
- package/build/lib/index.js.map +1 -1
- package/build/lib/logger.js +2 -5
- package/build/lib/logger.js.map +1 -1
- package/build/lib/method-map.js +1 -4
- package/build/lib/method-map.js.map +1 -1
- package/build/lib/utils.d.ts +9 -7
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +22 -28
- package/build/lib/utils.js.map +1 -1
- package/lib/commands/app-management.ts +5 -11
- package/lib/commands/appearance.ts +1 -1
- package/lib/commands/bidi/models.ts +3 -3
- package/lib/commands/bluetooth.ts +2 -2
- package/lib/commands/context/cache.ts +1 -1
- package/lib/commands/context/exports.ts +7 -7
- package/lib/commands/context/helpers.ts +4 -4
- package/lib/commands/device/common.ts +9 -10
- package/lib/commands/device/emulator-actions.ts +4 -4
- package/lib/commands/device/emulator-console.ts +2 -2
- package/lib/commands/device/utils.ts +3 -3
- package/lib/commands/deviceidle.ts +2 -2
- package/lib/commands/element.ts +3 -3
- package/lib/commands/execute.ts +2 -2
- package/lib/commands/file-actions.ts +2 -2
- package/lib/commands/find.ts +4 -4
- package/lib/commands/geolocation.ts +2 -2
- package/lib/commands/gestures.ts +3 -3
- package/lib/commands/image-injection.ts +2 -2
- package/lib/commands/ime.ts +3 -3
- package/lib/commands/intent.ts +3 -3
- package/lib/commands/keyboard.ts +3 -3
- package/lib/commands/legacy.ts +2 -2
- package/lib/commands/lock/exports.ts +3 -3
- package/lib/commands/lock/helpers.ts +2 -2
- package/lib/commands/log.ts +18 -11
- package/lib/commands/media-projection.ts +2 -2
- package/lib/commands/memory.ts +3 -3
- package/lib/commands/misc.ts +3 -3
- package/lib/commands/network.ts +3 -3
- package/lib/commands/nfc.ts +3 -3
- package/lib/commands/performance.ts +4 -4
- package/lib/commands/permissions.ts +3 -3
- package/lib/commands/recordscreen.ts +5 -5
- package/lib/commands/resources.ts +2 -2
- package/lib/commands/shell.ts +3 -3
- package/lib/commands/streamscreen.ts +6 -4
- package/lib/commands/system-bars.ts +6 -6
- package/lib/commands/time.ts +3 -3
- package/lib/commands/types.ts +15 -1
- package/lib/doctor/checks.ts +1 -1
- package/lib/driver.ts +44 -44
- package/lib/index.ts +7 -7
- package/lib/method-map.ts +1 -1
- package/lib/utils.ts +10 -8
- package/package.json +12 -3
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.pullFile = pullFile;
|
|
7
|
-
exports.pushFile = pushFile;
|
|
8
|
-
exports.pullFolder = pullFolder;
|
|
9
|
-
exports.mobileDeleteFile = mobileDeleteFile;
|
|
10
|
-
const support_1 = require("@appium/support");
|
|
11
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
12
|
-
const driver_1 = require("appium/driver");
|
|
1
|
+
import { fs, util, zip, tempDir } from '@appium/support';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { errors } from 'appium/driver.js';
|
|
13
4
|
const CONTAINER_PATH_MARKER = '@';
|
|
14
5
|
// https://regex101.com/r/PLdB0G/2
|
|
15
6
|
const CONTAINER_PATH_PATTERN = new RegExp(`^${CONTAINER_PATH_MARKER}([^/]+)/(.+)`);
|
|
@@ -29,16 +20,16 @@ const ANDROID_MEDIA_RESCAN_INTENT = 'android.intent.action.MEDIA_SCANNER_SCAN_FI
|
|
|
29
20
|
* @returns Promise that resolves to the file content as a base64-encoded string.
|
|
30
21
|
* @throws {errors.InvalidArgumentError} If the remote path points to a folder instead of a file.
|
|
31
22
|
*/
|
|
32
|
-
async function pullFile(remotePath) {
|
|
23
|
+
export async function pullFile(remotePath) {
|
|
33
24
|
if (remotePath.endsWith('/')) {
|
|
34
|
-
throw new
|
|
25
|
+
throw new errors.InvalidArgumentError(`It is expected that remote path points to a file and not to a folder. ` +
|
|
35
26
|
`'${remotePath}' is given instead`);
|
|
36
27
|
}
|
|
37
28
|
let tmpDestination = null;
|
|
38
29
|
if (remotePath.startsWith(CONTAINER_PATH_MARKER)) {
|
|
39
30
|
const [packageId, pathInContainer] = parseContainerPath(remotePath);
|
|
40
31
|
this.log.debug(`Parsed package identifier '${packageId}' from '${remotePath}'. Will get the data from '${pathInContainer}'`);
|
|
41
|
-
tmpDestination = `/data/local/tmp/${
|
|
32
|
+
tmpDestination = `/data/local/tmp/${path.posix.basename(pathInContainer)}`;
|
|
42
33
|
try {
|
|
43
34
|
await this.adb.shell(['run-as', packageId, `chmod 777 '${escapePath(pathInContainer)}'`]);
|
|
44
35
|
await this.adb.shell([
|
|
@@ -53,14 +44,14 @@ async function pullFile(remotePath) {
|
|
|
53
44
|
`Original error: ${e.message}`);
|
|
54
45
|
}
|
|
55
46
|
}
|
|
56
|
-
const localFile = await
|
|
47
|
+
const localFile = await tempDir.path({ prefix: 'appium', suffix: '.tmp' });
|
|
57
48
|
try {
|
|
58
49
|
await this.adb.pull(tmpDestination || remotePath, localFile);
|
|
59
|
-
return (await
|
|
50
|
+
return (await util.toInMemoryBase64(localFile)).toString();
|
|
60
51
|
}
|
|
61
52
|
finally {
|
|
62
|
-
if (await
|
|
63
|
-
await
|
|
53
|
+
if (await fs.exists(localFile)) {
|
|
54
|
+
await fs.unlink(localFile);
|
|
64
55
|
}
|
|
65
56
|
if (tmpDestination) {
|
|
66
57
|
await this.adb.shell(['rm', '-f', tmpDestination]);
|
|
@@ -84,12 +75,12 @@ async function pullFile(remotePath) {
|
|
|
84
75
|
* @returns Promise that resolves when the file is pushed.
|
|
85
76
|
* @throws {errors.InvalidArgumentError} If the remote path points to a folder instead of a file.
|
|
86
77
|
*/
|
|
87
|
-
async function pushFile(remotePath, base64Data) {
|
|
78
|
+
export async function pushFile(remotePath, base64Data) {
|
|
88
79
|
if (remotePath.endsWith('/')) {
|
|
89
|
-
throw new
|
|
80
|
+
throw new errors.InvalidArgumentError(`It is expected that remote path points to a file and not to a folder. ` +
|
|
90
81
|
`'${remotePath}' is given instead`);
|
|
91
82
|
}
|
|
92
|
-
const localFile = await
|
|
83
|
+
const localFile = await tempDir.path({ prefix: 'appium', suffix: '.tmp' });
|
|
93
84
|
let base64String;
|
|
94
85
|
if (Array.isArray(base64Data)) {
|
|
95
86
|
// some clients (ahem) java, send a byte array encoding utf8 characters
|
|
@@ -102,17 +93,17 @@ async function pushFile(remotePath, base64Data) {
|
|
|
102
93
|
const content = Buffer.from(base64String, 'base64');
|
|
103
94
|
let tmpDestination = null;
|
|
104
95
|
try {
|
|
105
|
-
await
|
|
96
|
+
await fs.writeFile(localFile, content.toString('binary'), 'binary');
|
|
106
97
|
if (remotePath.startsWith(CONTAINER_PATH_MARKER)) {
|
|
107
98
|
const [packageId, pathInContainer] = parseContainerPath(remotePath);
|
|
108
99
|
this.log.debug(`Parsed package identifier '${packageId}' from '${remotePath}'. ` +
|
|
109
100
|
`Will put the data into '${pathInContainer}'`);
|
|
110
|
-
tmpDestination = `/data/local/tmp/${
|
|
101
|
+
tmpDestination = `/data/local/tmp/${path.posix.basename(pathInContainer)}`;
|
|
111
102
|
try {
|
|
112
103
|
await this.adb.shell([
|
|
113
104
|
'run-as',
|
|
114
105
|
packageId,
|
|
115
|
-
`mkdir -p '${escapePath(
|
|
106
|
+
`mkdir -p '${escapePath(path.posix.dirname(pathInContainer))}'`,
|
|
116
107
|
]);
|
|
117
108
|
await this.adb.shell(['run-as', packageId, `touch '${escapePath(pathInContainer)}'`]);
|
|
118
109
|
await this.adb.shell(['run-as', packageId, `chmod 777 '${escapePath(pathInContainer)}'`]);
|
|
@@ -138,8 +129,8 @@ async function pushFile(remotePath, base64Data) {
|
|
|
138
129
|
}
|
|
139
130
|
}
|
|
140
131
|
finally {
|
|
141
|
-
if (await
|
|
142
|
-
await
|
|
132
|
+
if (await fs.exists(localFile)) {
|
|
133
|
+
await fs.unlink(localFile);
|
|
143
134
|
}
|
|
144
135
|
if (tmpDestination) {
|
|
145
136
|
await this.adb.shell(['rm', '-f', tmpDestination]);
|
|
@@ -152,16 +143,16 @@ async function pushFile(remotePath, base64Data) {
|
|
|
152
143
|
* @param remotePath The full path to the remote folder.
|
|
153
144
|
* @returns Promise that resolves to the folder content as a base64-encoded zip file string.
|
|
154
145
|
*/
|
|
155
|
-
async function pullFolder(remotePath) {
|
|
156
|
-
const tmpRoot = await
|
|
146
|
+
export async function pullFolder(remotePath) {
|
|
147
|
+
const tmpRoot = await tempDir.openDir();
|
|
157
148
|
try {
|
|
158
149
|
await this.adb.pull(remotePath, tmpRoot);
|
|
159
|
-
return (await
|
|
150
|
+
return (await zip.toInMemoryZip(tmpRoot, {
|
|
160
151
|
encodeToBase64: true,
|
|
161
152
|
})).toString();
|
|
162
153
|
}
|
|
163
154
|
finally {
|
|
164
|
-
await
|
|
155
|
+
await fs.rimraf(tmpRoot);
|
|
165
156
|
}
|
|
166
157
|
}
|
|
167
158
|
/**
|
|
@@ -172,9 +163,9 @@ async function pullFolder(remotePath) {
|
|
|
172
163
|
* @returns Promise that resolves to `true` if the file was successfully deleted, `false` if it doesn't exist.
|
|
173
164
|
* @throws {errors.InvalidArgumentError} If the remote path points to a folder instead of a file.
|
|
174
165
|
*/
|
|
175
|
-
async function mobileDeleteFile(remotePath) {
|
|
166
|
+
export async function mobileDeleteFile(remotePath) {
|
|
176
167
|
if (remotePath.endsWith('/')) {
|
|
177
|
-
throw new
|
|
168
|
+
throw new errors.InvalidArgumentError(`It is expected that remote path points to a folder and not to a file. ` +
|
|
178
169
|
`'${remotePath}' is given instead`);
|
|
179
170
|
}
|
|
180
171
|
return await deleteFileOrFolder.call(this, this.adb, remotePath);
|
|
@@ -244,7 +235,7 @@ function parseContainerPath(remotePath) {
|
|
|
244
235
|
throw new Error(`It is expected that package identifier is separated from the relative path with a single slash. ` +
|
|
245
236
|
`'${remotePath}' is given instead`);
|
|
246
237
|
}
|
|
247
|
-
return [match[1],
|
|
238
|
+
return [match[1], path.posix.resolve(`/data/data/${match[1]}`, match[2])];
|
|
248
239
|
}
|
|
249
240
|
/**
|
|
250
241
|
* Scans the given file/folder on the remote device
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-actions.js","sourceRoot":"","sources":["../../../lib/commands/file-actions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file-actions.js","sourceRoot":"","sources":["../../../lib/commands/file-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAC,MAAM,iBAAiB,CAAC;AACvD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AAIxC,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;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAsB,UAAkB;IACpE,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,MAAM,CAAC,oBAAoB,CACnC,wEAAwE;YACtE,IAAI,UAAU,oBAAoB,CACrC,CAAC;IACJ,CAAC;IACD,IAAI,cAAc,GAAkB,IAAI,CAAC;IACzC,IAAI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EAAE,KAAK,UAAU,CAAC,CAAC,CAAC,eAAe,QAAQ,EAAE,CAAC;QACrE,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,UAAU,KAAK,IAAI,QAAQ,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;QACjE,IAAI,CAAC;YACH,OAAO,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACzD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,MAAM,GAAG,KAAK,EAAE,CAAS,EAAE,KAAc,EAAoB,EAAE,CACnE,MAAM,oBAAoB,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC5C,MAAM,KAAK,GAAG,KAAK,EAAE,CAAS,EAAE,KAAc,EAAoB,EAAE,CAClE,MAAM,oBAAoB,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAG,KAAK,EAAE,CAAS,EAAE,KAAc,EAAoB,EAAE,CACtE,MAAM,oBAAoB,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAE5C,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAC,CAAC;AACpC,CAAC;AAED,aAAa"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AndroidDriver } from '../driver';
|
|
1
|
+
import type { AndroidDriver } from '../driver.js';
|
|
2
2
|
import type { Element } from '@appium/types';
|
|
3
|
-
import type { FindElementOpts } from './types';
|
|
3
|
+
import type { FindElementOpts } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* @param strategy The element location strategy to use (e.g., 'id', 'xpath', 'class name').
|
|
6
6
|
* @param selector The selector value to search for.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../lib/commands/find.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../lib/commands/find.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAEhD;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,IAAI,EACV,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;AACtB,wBAAsB,WAAW,CAC/B,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,KAAK,EACX,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC,CAAC;AAkEpB;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,OAAO,GAAG,OAAO,EAAE,CAAC,CAG9B"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.doFindElementOrEls = doFindElementOrEls;
|
|
5
|
-
const driver_1 = require("appium/driver");
|
|
6
|
-
const support_1 = require("@appium/support");
|
|
7
|
-
async function findElOrEls(strategy, selector, mult, context = '') {
|
|
1
|
+
import { errors, isErrorType } from 'appium/driver.js';
|
|
2
|
+
import { util } from '@appium/support';
|
|
3
|
+
export async function findElOrEls(strategy, selector, mult, context = '') {
|
|
8
4
|
if (!selector) {
|
|
9
5
|
throw new Error('Must provide a selector when finding elements');
|
|
10
6
|
}
|
|
@@ -22,20 +18,20 @@ async function findElOrEls(strategy, selector, mult, context = '') {
|
|
|
22
18
|
catch (err) {
|
|
23
19
|
// if the error that comes back is from a proxied request, we need to
|
|
24
20
|
// unwrap it to its actual protocol error first
|
|
25
|
-
if (
|
|
21
|
+
if (isErrorType(err, errors.ProxyRequestError)) {
|
|
26
22
|
err = err.getActualError(); // eslint-disable-line no-ex-assign
|
|
27
23
|
}
|
|
28
24
|
// now we have to inspect the error to determine if it is a no such
|
|
29
25
|
// element error, based on the shape of the error object from
|
|
30
26
|
// appium/driver
|
|
31
|
-
if (
|
|
27
|
+
if (isErrorType(err, errors.NoSuchElementError)) {
|
|
32
28
|
// we are fine with this, just indicate a retry
|
|
33
29
|
return false;
|
|
34
30
|
}
|
|
35
31
|
throw err;
|
|
36
32
|
}
|
|
37
33
|
// we want to return false if we want to potentially try again
|
|
38
|
-
return !
|
|
34
|
+
return !util.isEmpty(element);
|
|
39
35
|
};
|
|
40
36
|
try {
|
|
41
37
|
await this.implicitWaitForCondition(doFind);
|
|
@@ -54,8 +50,8 @@ async function findElOrEls(strategy, selector, mult, context = '') {
|
|
|
54
50
|
if (mult) {
|
|
55
51
|
return element;
|
|
56
52
|
}
|
|
57
|
-
if (
|
|
58
|
-
throw new
|
|
53
|
+
if (util.isEmpty(element)) {
|
|
54
|
+
throw new errors.NoSuchElementError();
|
|
59
55
|
}
|
|
60
56
|
return element;
|
|
61
57
|
}
|
|
@@ -69,8 +65,8 @@ async function findElOrEls(strategy, selector, mult, context = '') {
|
|
|
69
65
|
* @returns A single `Element` if `params.multiple` is `false`, or an array of `Element` objects if `true`.
|
|
70
66
|
* @throws {errors.NotImplementedError} This method must be implemented by the specific context handler.
|
|
71
67
|
*/
|
|
72
|
-
async function doFindElementOrEls(params) {
|
|
68
|
+
export async function doFindElementOrEls(params) {
|
|
73
69
|
void params;
|
|
74
|
-
throw new
|
|
70
|
+
throw new errors.NotImplementedError('Not implemented');
|
|
75
71
|
}
|
|
76
72
|
//# sourceMappingURL=find.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find.js","sourceRoot":"","sources":["../../../lib/commands/find.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"find.js","sourceRoot":"","sources":["../../../lib/commands/find.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAC,IAAI,EAAC,MAAM,iBAAiB,CAAC;AA6BrC,MAAM,CAAC,KAAK,UAAU,WAAW,CAE/B,QAAgB,EAChB,QAAgB,EAChB,IAAa,EACb,OAAO,GAAG,EAAE;IAEZ,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;IAED,MAAM,MAAM,GAAoB;QAC9B,QAAQ;QACR,QAAQ;QACR,OAAO;QACP,QAAQ,EAAE,IAAI;KACf,CAAC;IAEF,IAAI,OAAwC,CAAC;IAC7C,MAAM,MAAM,GAAG,KAAK,IAAI,EAAE;QACxB,IAAI,CAAC;YACH,OAAO,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;QAClD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,qEAAqE;YACrE,+CAA+C;YAC/C,IAAI,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,iBAAiB,CAAC,EAAE,CAAC;gBAC/C,GAAG,GAAG,GAAG,CAAC,cAAc,EAAE,CAAC,CAAC,mCAAmC;YACjE,CAAC;YAED,mEAAmE;YACnE,6DAA6D;YAC7D,gBAAgB;YAChB,IAAI,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,kBAAkB,CAAC,EAAE,CAAC;gBAChD,+CAA+C;gBAC/C,OAAO,KAAK,CAAC;YACf,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC;QAED,8DAA8D;QAC9D,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC,CAAC;IAEF,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,GAAG,GAAG,CAAU,CAAC;QACvB,IAAI,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,EAAE,CAAC;YAC1C,wDAAwD;YACxD,mDAAmD;YACnD,OAAO,GAAG,EAAE,CAAC;QACf,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;IAED,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,OAAoB,CAAC;IAC9B,CAAC;IACD,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,MAAM,CAAC,kBAAkB,EAAE,CAAC;IACxC,CAAC;IACD,OAAO,OAAkB,CAAC;AAC5B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAEtC,MAAuB;IAEvB,KAAK,MAAM,CAAC;IACZ,MAAM,IAAI,MAAM,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geolocation.d.ts","sourceRoot":"","sources":["../../../lib/commands/geolocation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"geolocation.d.ts","sourceRoot":"","sources":["../../../lib/commands/geolocation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAE5C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAWhD;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,aAAa,EAAE,QAAQ,E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ation;
|
|
7
|
-
exports.mobileSetGeolocation = mobileSetGeolocation;
|
|
8
|
-
exports.mobileRefreshGpsCache = mobileRefreshGpsCache;
|
|
9
|
-
exports.getGeoLocation = getGeoLocation;
|
|
10
|
-
exports.mobileGetGeolocation = mobileGetGeolocation;
|
|
11
|
-
exports.isLocationServicesEnabled = isLocationServicesEnabled;
|
|
12
|
-
exports.toggleLocationServices = toggleLocationServices;
|
|
13
|
-
exports.mobileResetGeolocation = mobileResetGeolocation;
|
|
14
|
-
exports.setMockLocationApp = setMockLocationApp;
|
|
15
|
-
const asyncbox_1 = require("asyncbox");
|
|
16
|
-
const support_1 = require("@appium/support");
|
|
17
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
18
|
-
const io_appium_settings_1 = require("io.appium.settings");
|
|
19
|
-
const app_management_1 = require("./app-management");
|
|
1
|
+
import { asyncmap } from 'asyncbox';
|
|
2
|
+
import { fs, tempDir } from '@appium/support';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { getThirdPartyPackages } from './app-management.js';
|
|
5
|
+
import { SETTINGS_HELPER_ID } from 'io.appium.settings';
|
|
20
6
|
// The value close to zero, but not zero, is needed
|
|
21
7
|
// to trick JSON generation and send a float value instead of an integer,
|
|
22
8
|
// This allows strictly-typed clients, like Java, to properly
|
|
@@ -30,7 +16,7 @@ const MOCK_APP_IDS_STORE = '/data/local/tmp/mock_apps.json';
|
|
|
30
16
|
* @param location The geolocation object containing latitude, longitude, and altitude.
|
|
31
17
|
* @returns Promise that resolves to the current geolocation after setting it.
|
|
32
18
|
*/
|
|
33
|
-
async function setGeoLocation(location) {
|
|
19
|
+
export async function setGeoLocation(location) {
|
|
34
20
|
await this.settingsApp.setGeoLocation(location, this.isEmulator());
|
|
35
21
|
try {
|
|
36
22
|
return await this.getGeoLocation();
|
|
@@ -60,7 +46,7 @@ async function setGeoLocation(location) {
|
|
|
60
46
|
* https://developer.android.com/reference/android/location/Location#setAccuracy(float),
|
|
61
47
|
* https://developer.android.com/reference/android/location/Criteria
|
|
62
48
|
*/
|
|
63
|
-
async function mobileSetGeolocation(latitude, longitude, altitude, satellites, speed, bearing, accuracy) {
|
|
49
|
+
export async function mobileSetGeolocation(latitude, longitude, altitude, satellites, speed, bearing, accuracy) {
|
|
64
50
|
await this.settingsApp.setGeoLocation({
|
|
65
51
|
latitude,
|
|
66
52
|
longitude,
|
|
@@ -84,7 +70,7 @@ async function mobileSetGeolocation(latitude, longitude, altitude, satellites, s
|
|
|
84
70
|
* 20000ms by default.
|
|
85
71
|
* @returns Promise that resolves when the GPS cache refresh is initiated.
|
|
86
72
|
*/
|
|
87
|
-
async function mobileRefreshGpsCache(timeoutMs) {
|
|
73
|
+
export async function mobileRefreshGpsCache(timeoutMs) {
|
|
88
74
|
await this.settingsApp.refreshGeoLocationCache(timeoutMs);
|
|
89
75
|
}
|
|
90
76
|
/**
|
|
@@ -92,7 +78,7 @@ async function mobileRefreshGpsCache(timeoutMs) {
|
|
|
92
78
|
*
|
|
93
79
|
* @returns Promise that resolves to the current geolocation object.
|
|
94
80
|
*/
|
|
95
|
-
async function getGeoLocation() {
|
|
81
|
+
export async function getGeoLocation() {
|
|
96
82
|
const { latitude, longitude, altitude } = await this.settingsApp.getGeoLocation();
|
|
97
83
|
return {
|
|
98
84
|
latitude: parseFloat(String(latitude)) || GEO_EPSILON,
|
|
@@ -105,7 +91,7 @@ async function getGeoLocation() {
|
|
|
105
91
|
*
|
|
106
92
|
* @returns Promise that resolves to the current geolocation object.
|
|
107
93
|
*/
|
|
108
|
-
async function mobileGetGeolocation() {
|
|
94
|
+
export async function mobileGetGeolocation() {
|
|
109
95
|
return await this.getGeoLocation();
|
|
110
96
|
}
|
|
111
97
|
/**
|
|
@@ -113,7 +99,7 @@ async function mobileGetGeolocation() {
|
|
|
113
99
|
*
|
|
114
100
|
* @returns Promise that resolves to `true` if location services are enabled, `false` otherwise.
|
|
115
101
|
*/
|
|
116
|
-
async function isLocationServicesEnabled() {
|
|
102
|
+
export async function isLocationServicesEnabled() {
|
|
117
103
|
return (await this.adb.getLocationProviders()).includes('gps');
|
|
118
104
|
}
|
|
119
105
|
/**
|
|
@@ -121,7 +107,7 @@ async function isLocationServicesEnabled() {
|
|
|
121
107
|
*
|
|
122
108
|
* @returns Promise that resolves when the location services state is toggled.
|
|
123
109
|
*/
|
|
124
|
-
async function toggleLocationServices() {
|
|
110
|
+
export async function toggleLocationServices() {
|
|
125
111
|
this.log.info('Toggling location services');
|
|
126
112
|
const isGpsEnabled = await this.isLocationServicesEnabled();
|
|
127
113
|
this.log.debug(`Current GPS state: ${isGpsEnabled}. ` +
|
|
@@ -134,7 +120,7 @@ async function toggleLocationServices() {
|
|
|
134
120
|
* @returns Promise that resolves when the geolocation is reset.
|
|
135
121
|
* @throws {Error} If called on an emulator (geolocation reset does not work on emulators).
|
|
136
122
|
*/
|
|
137
|
-
async function mobileResetGeolocation() {
|
|
123
|
+
export async function mobileResetGeolocation() {
|
|
138
124
|
if (this.isEmulator()) {
|
|
139
125
|
throw new Error('Geolocation reset does not work on emulators');
|
|
140
126
|
}
|
|
@@ -147,7 +133,7 @@ async function mobileResetGeolocation() {
|
|
|
147
133
|
* @param appId The application package identifier.
|
|
148
134
|
* @returns Promise that resolves when the mock location permission is set.
|
|
149
135
|
*/
|
|
150
|
-
async function setMockLocationApp(appId) {
|
|
136
|
+
export async function setMockLocationApp(appId) {
|
|
151
137
|
try {
|
|
152
138
|
await this.adb.shell(['appops', 'set', appId, 'android:mock_location', 'allow']);
|
|
153
139
|
}
|
|
@@ -167,14 +153,14 @@ async function setMockLocationApp(appId) {
|
|
|
167
153
|
return;
|
|
168
154
|
}
|
|
169
155
|
pkgIds.push(appId);
|
|
170
|
-
const tmpRoot = await
|
|
171
|
-
const srcPath =
|
|
156
|
+
const tmpRoot = await tempDir.openDir();
|
|
157
|
+
const srcPath = path.posix.join(tmpRoot, path.posix.basename(MOCK_APP_IDS_STORE));
|
|
172
158
|
try {
|
|
173
|
-
await
|
|
159
|
+
await fs.writeFile(srcPath, JSON.stringify(pkgIds), 'utf8');
|
|
174
160
|
await this.adb.push(srcPath, MOCK_APP_IDS_STORE);
|
|
175
161
|
}
|
|
176
162
|
finally {
|
|
177
|
-
await
|
|
163
|
+
await fs.rimraf(tmpRoot);
|
|
178
164
|
}
|
|
179
165
|
}
|
|
180
166
|
catch (e) {
|
|
@@ -188,7 +174,7 @@ async function setMockLocationApp(appId) {
|
|
|
188
174
|
*/
|
|
189
175
|
async function resetMockLocation() {
|
|
190
176
|
try {
|
|
191
|
-
const thirdPartyPkgIdsPromise =
|
|
177
|
+
const thirdPartyPkgIdsPromise = getThirdPartyPackages.bind(this)();
|
|
192
178
|
let pkgIds = [];
|
|
193
179
|
if (await this.adb.fileExists(MOCK_APP_IDS_STORE)) {
|
|
194
180
|
try {
|
|
@@ -203,14 +189,14 @@ async function resetMockLocation() {
|
|
|
203
189
|
await this.adb.shell([
|
|
204
190
|
'appops',
|
|
205
191
|
'set',
|
|
206
|
-
resultPkgs[0] ??
|
|
192
|
+
resultPkgs[0] ?? SETTINGS_HELPER_ID,
|
|
207
193
|
'android:mock_location',
|
|
208
194
|
'deny',
|
|
209
195
|
]);
|
|
210
196
|
return;
|
|
211
197
|
}
|
|
212
198
|
this.log.debug(`Resetting mock_location permission for the following apps: ${resultPkgs}`);
|
|
213
|
-
await
|
|
199
|
+
await asyncmap(resultPkgs, async (pkgId) => {
|
|
214
200
|
try {
|
|
215
201
|
await this.adb.shell(['appops', 'set', pkgId, 'android:mock_location', 'deny']);
|
|
216
202
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geolocation.js","sourceRoot":"","sources":["../../../lib/commands/geolocation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"geolocation.js","sourceRoot":"","sources":["../../../lib/commands/geolocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,UAAU,CAAC;AAClC,OAAO,EAAC,EAAE,EAAE,OAAO,EA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UAAU,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;gBACnB,QAAQ;gBACR,KAAK;gBACL,UAAU,CAAC,CAAC,CAAC,IAAI,kBAAkB;gBACnC,uBAAuB;gBACvB,MAAM;aACP,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,8DAA8D,UAAU,EAAE,CAAC,CAAC;QAC3F,MAAM,QAAQ,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACzC,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,uBAAuB,EAAE,MAAM,CAAC,CAAC,CAAC;YAClF,CAAC;YAAC,MAAM,CAAC,CAAA,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,kCAAmC,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC;AAED,8BAA8B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gestures.d.ts","sourceRoot":"","sources":["../../../lib/commands/gestures.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gestures.d.ts","sourceRoot":"","sources":["../../../lib/commands/gestures.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAEhD;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAGhG"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.performActions = performActions;
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5
|
-
const driver_1 = require("appium/driver");
|
|
1
|
+
import { errors } from 'appium/driver.js';
|
|
6
2
|
/**
|
|
7
3
|
* Performs a series of actions (gestures) on the device.
|
|
8
4
|
*
|
|
@@ -10,7 +6,8 @@ const driver_1 = require("appium/driver");
|
|
|
10
6
|
* @returns Promise that resolves when all actions are performed.
|
|
11
7
|
* @throws {errors.NotImplementedError} This method is not implemented.
|
|
12
8
|
*/
|
|
13
|
-
async function performActions(actions) {
|
|
14
|
-
|
|
9
|
+
export async function performActions(actions) {
|
|
10
|
+
void actions;
|
|
11
|
+
throw new errors.NotImplementedError('Not implemented');
|
|
15
12
|
}
|
|
16
13
|
//# sourceMappingURL=gestures.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gestures.js","sourceRoot":"","sources":["../../../lib/commands/gestures.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gestures.js","sourceRoot":"","sources":["../../../lib/commands/gestures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AAIxC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAsB,OAAuB;IAC/E,KAAK,OAAO,CAAC;IACb,MAAM,IAAI,MAAM,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-injection.d.ts","sourceRoot":"","sources":["../../../lib/commands/image-injection.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"image-injection.d.ts","sourceRoot":"","sources":["../../../lib/commands/image-injection.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAmBhD;;;;;;;;GAQG;AACH,wBAAsB,gCAAgC,CACpD,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,CAAC,CAkClB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,+BAA+B,CACnD,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CA4Bf"}
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.prepareEmulatorForImageInjection = prepareEmulatorForImageInjection;
|
|
7
|
-
exports.mobileInjectEmulatorCameraImage = mobileInjectEmulatorCameraImage;
|
|
8
|
-
const driver_1 = require("appium/driver");
|
|
9
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
-
const support_1 = require("@appium/support");
|
|
11
|
-
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
1
|
+
import { errors } from 'appium/driver.js';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fs, tempDir } from '@appium/support';
|
|
4
|
+
import crypto from 'node:crypto';
|
|
12
5
|
const EMULATOR_RESOURCES_ROOT = ['emulator', 'resources'];
|
|
13
6
|
const CONFIG_NAME = 'Toren1BD.posters';
|
|
14
7
|
const DEFAULT_CONFIG_PAYLOAD_PREFIX = `poster wall
|
|
@@ -34,7 +27,7 @@ const PNG_MAGIC_LENGTH = 4;
|
|
|
34
27
|
* to load the updated config or `false` if the current config is already up to date
|
|
35
28
|
* or does not need to be updated
|
|
36
29
|
*/
|
|
37
|
-
async function prepareEmulatorForImageInjection(sdkRoot) {
|
|
30
|
+
export async function prepareEmulatorForImageInjection(sdkRoot) {
|
|
38
31
|
const { injectedImageProperties: props } = this.opts;
|
|
39
32
|
if (!props) {
|
|
40
33
|
return false;
|
|
@@ -43,9 +36,9 @@ async function prepareEmulatorForImageInjection(sdkRoot) {
|
|
|
43
36
|
const position = `position ${props.position?.x ?? 0} ${props.position?.y ?? 0} ${props.position?.z ?? -1.5}`;
|
|
44
37
|
const rotation = `rotation ${props.rotation?.x ?? 0} ${props.rotation?.y ?? 0} ${props.rotation?.z ?? 0}`;
|
|
45
38
|
const strProps = `${size}\n${position}\n${rotation}`;
|
|
46
|
-
const configPath =
|
|
47
|
-
if (await
|
|
48
|
-
const configPayload = await
|
|
39
|
+
const configPath = path.resolve(sdkRoot, ...EMULATOR_RESOURCES_ROOT, CONFIG_NAME);
|
|
40
|
+
if (await fs.exists(configPath)) {
|
|
41
|
+
const configPayload = await fs.readFile(configPath, 'utf8');
|
|
49
42
|
if (configPayload.includes(strProps)) {
|
|
50
43
|
this.log.info(`The image injection config at '${configPath}' is already up to date. Doing nothing`);
|
|
51
44
|
return false;
|
|
@@ -55,10 +48,10 @@ async function prepareEmulatorForImageInjection(sdkRoot) {
|
|
|
55
48
|
${position}
|
|
56
49
|
${rotation}
|
|
57
50
|
`;
|
|
58
|
-
await
|
|
51
|
+
await fs.writeFile(configPath, updatedPayload, 'utf-8');
|
|
59
52
|
}
|
|
60
53
|
else {
|
|
61
|
-
await
|
|
54
|
+
await fs.writeFile(configPath, DEFAULT_CONFIG_PAYLOAD, 'utf-8');
|
|
62
55
|
}
|
|
63
56
|
this.log.info(`The image injection config at '${configPath}' has been successfully updated with ` +
|
|
64
57
|
`${size}, ${position}, ${rotation}. ` +
|
|
@@ -79,30 +72,30 @@ async function prepareEmulatorForImageInjection(sdkRoot) {
|
|
|
79
72
|
* @throws {Error} If called on a non-emulator device.
|
|
80
73
|
* @throws {errors.InvalidArgumentError} If the payload is not a valid base64-encoded PNG.
|
|
81
74
|
*/
|
|
82
|
-
async function mobileInjectEmulatorCameraImage(payload) {
|
|
75
|
+
export async function mobileInjectEmulatorCameraImage(payload) {
|
|
83
76
|
if (!this.isEmulator()) {
|
|
84
77
|
throw new Error('The image injection feature is only available on emulators');
|
|
85
78
|
}
|
|
86
79
|
if (typeof payload !== 'string' || payload.length <= PNG_MAGIC_LENGTH) {
|
|
87
|
-
throw new
|
|
80
|
+
throw new errors.InvalidArgumentError(`You must provide a valid base64-encoded .PNG data as the 'payload' argument`);
|
|
88
81
|
}
|
|
89
82
|
const pngBuffer = Buffer.from(payload, 'base64');
|
|
90
83
|
const magic = pngBuffer.toString('hex', 0, PNG_MAGIC_LENGTH);
|
|
91
84
|
if (magic !== PNG_MAGIC) {
|
|
92
|
-
throw new
|
|
85
|
+
throw new errors.InvalidArgumentError('The provided image payload must contain a valid base64-encoded .PNG data');
|
|
93
86
|
}
|
|
94
|
-
const tmpImagePath = await
|
|
87
|
+
const tmpImagePath = await tempDir.path({
|
|
95
88
|
// this is needed to avoid creation of multiple temp files for the same image payload
|
|
96
89
|
prefix: calculateImageHash(pngBuffer),
|
|
97
90
|
suffix: '.png',
|
|
98
91
|
});
|
|
99
|
-
await
|
|
92
|
+
await fs.writeFile(tmpImagePath, pngBuffer);
|
|
100
93
|
await this.adb.execEmuConsoleCommand(`virtualscene-image table ${tmpImagePath}`);
|
|
101
94
|
this.log.info(`The provided image has been successully injected to the ${this.adb.curDeviceId} emulator`);
|
|
102
95
|
}
|
|
103
96
|
// #region Internal helpers
|
|
104
97
|
function calculateImageHash(buffer) {
|
|
105
|
-
const hasher =
|
|
98
|
+
const hasher = crypto.createHash('sha1');
|
|
106
99
|
hasher.update(buffer);
|
|
107
100
|
return hasher.digest('hex');
|
|
108
101
|
}
|