appium-uiautomator2-driver 10.4.2 → 10.4.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/driver.d.ts +6 -0
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/execute-method-map.d.ts +6 -0
- package/build/lib/execute-method-map.d.ts.map +1 -1
- package/node_modules/appium-adb/CHANGELOG.md +14 -0
- package/node_modules/appium-adb/build/lib/adb.d.ts +2 -0
- package/node_modules/appium-adb/build/lib/adb.d.ts.map +1 -1
- package/node_modules/appium-adb/build/lib/adb.js +2 -0
- package/node_modules/appium-adb/build/lib/adb.js.map +1 -1
- package/node_modules/appium-adb/build/lib/tools/app-commands.d.ts +5 -7
- package/node_modules/appium-adb/build/lib/tools/app-commands.d.ts.map +1 -1
- package/node_modules/appium-adb/build/lib/tools/app-commands.js +17 -61
- package/node_modules/appium-adb/build/lib/tools/app-commands.js.map +1 -1
- package/node_modules/appium-adb/build/lib/tools/device-settings.d.ts +6 -4
- package/node_modules/appium-adb/build/lib/tools/device-settings.d.ts.map +1 -1
- package/node_modules/appium-adb/build/lib/tools/device-settings.js +10 -42
- package/node_modules/appium-adb/build/lib/tools/device-settings.js.map +1 -1
- package/node_modules/appium-adb/build/lib/tools/emulator-commands.d.ts +26 -1
- package/node_modules/appium-adb/build/lib/tools/emulator-commands.d.ts.map +1 -1
- package/node_modules/appium-adb/build/lib/tools/emulator-commands.js +120 -5
- package/node_modules/appium-adb/build/lib/tools/emulator-commands.js.map +1 -1
- package/node_modules/appium-adb/build/lib/tools/general-commands.d.ts +2 -2
- package/node_modules/appium-adb/build/lib/tools/general-commands.js +2 -2
- package/node_modules/appium-adb/build/lib/tools/lockmgmt.d.ts.map +1 -1
- package/node_modules/appium-adb/build/lib/tools/lockmgmt.js +3 -39
- package/node_modules/appium-adb/build/lib/tools/lockmgmt.js.map +1 -1
- package/node_modules/appium-adb/build/lib/tools/network-commands.d.ts +0 -1
- package/node_modules/appium-adb/build/lib/tools/network-commands.d.ts.map +1 -1
- package/node_modules/appium-adb/build/lib/tools/network-commands.js +0 -1
- package/node_modules/appium-adb/build/lib/tools/network-commands.js.map +1 -1
- package/node_modules/appium-adb/build/lib/tools/types.d.ts +21 -6
- package/node_modules/appium-adb/build/lib/tools/types.d.ts.map +1 -1
- package/node_modules/appium-adb/build/lib/utils/helpers/install.d.ts +2 -2
- package/node_modules/appium-adb/build/lib/utils/helpers/install.d.ts.map +1 -1
- package/node_modules/appium-adb/build/lib/utils/helpers/install.js +3 -11
- package/node_modules/appium-adb/build/lib/utils/helpers/install.js.map +1 -1
- package/node_modules/appium-adb/lib/adb.ts +2 -0
- package/node_modules/appium-adb/lib/tools/app-commands.ts +17 -61
- package/node_modules/appium-adb/lib/tools/device-settings.ts +10 -43
- package/node_modules/appium-adb/lib/tools/emulator-commands.ts +130 -5
- package/node_modules/appium-adb/lib/tools/general-commands.ts +2 -2
- package/node_modules/appium-adb/lib/tools/lockmgmt.ts +3 -42
- package/node_modules/appium-adb/lib/tools/network-commands.ts +0 -1
- package/node_modules/appium-adb/lib/tools/types.ts +22 -6
- package/node_modules/appium-adb/lib/utils/helpers/install.ts +3 -13
- package/node_modules/appium-adb/package.json +2 -2
- package/node_modules/appium-android-driver/CHANGELOG.md +60 -0
- package/node_modules/appium-android-driver/build/lib/commands/app-management.d.ts +2 -2
- package/node_modules/appium-android-driver/build/lib/commands/app-management.js +2 -2
- package/node_modules/appium-android-driver/build/lib/commands/context/helpers.d.ts.map +1 -1
- package/node_modules/appium-android-driver/build/lib/commands/context/helpers.js +83 -36
- package/node_modules/appium-android-driver/build/lib/commands/context/helpers.js.map +1 -1
- package/node_modules/appium-android-driver/build/lib/commands/device/emulator-actions.d.ts +9 -0
- package/node_modules/appium-android-driver/build/lib/commands/device/emulator-actions.d.ts.map +1 -1
- package/node_modules/appium-android-driver/build/lib/commands/device/emulator-actions.js +14 -0
- package/node_modules/appium-android-driver/build/lib/commands/device/emulator-actions.js.map +1 -1
- package/node_modules/appium-android-driver/build/lib/commands/device/utils.js +1 -1
- package/node_modules/appium-android-driver/build/lib/commands/device/utils.js.map +1 -1
- package/node_modules/appium-android-driver/build/lib/commands/intent.d.ts +0 -1
- package/node_modules/appium-android-driver/build/lib/commands/intent.d.ts.map +1 -1
- package/node_modules/appium-android-driver/build/lib/commands/intent.js +0 -1
- package/node_modules/appium-android-driver/build/lib/commands/intent.js.map +1 -1
- package/node_modules/appium-android-driver/build/lib/commands/lock/helpers.d.ts.map +1 -1
- package/node_modules/appium-android-driver/build/lib/commands/lock/helpers.js +1 -2
- package/node_modules/appium-android-driver/build/lib/commands/lock/helpers.js.map +1 -1
- package/node_modules/appium-android-driver/build/lib/commands/performance.d.ts +1 -1
- package/node_modules/appium-android-driver/build/lib/commands/performance.js +3 -3
- package/node_modules/appium-android-driver/build/lib/driver.d.ts +6 -0
- package/node_modules/appium-android-driver/build/lib/driver.d.ts.map +1 -1
- package/node_modules/appium-android-driver/build/lib/driver.js +2 -1
- package/node_modules/appium-android-driver/build/lib/driver.js.map +1 -1
- package/node_modules/appium-android-driver/build/lib/execute-method-map.d.ts +6 -0
- package/node_modules/appium-android-driver/build/lib/execute-method-map.d.ts.map +1 -1
- package/node_modules/appium-android-driver/build/lib/execute-method-map.js +6 -0
- package/node_modules/appium-android-driver/build/lib/execute-method-map.js.map +1 -1
- package/node_modules/appium-android-driver/lib/commands/app-management.ts +2 -2
- package/node_modules/appium-android-driver/lib/commands/context/helpers.ts +104 -39
- package/node_modules/appium-android-driver/lib/commands/device/emulator-actions.ts +17 -0
- package/node_modules/appium-android-driver/lib/commands/device/utils.ts +1 -1
- package/node_modules/appium-android-driver/lib/commands/intent.ts +0 -1
- package/node_modules/appium-android-driver/lib/commands/lock/helpers.ts +1 -6
- package/node_modules/appium-android-driver/lib/commands/performance.ts +3 -3
- package/node_modules/appium-android-driver/lib/driver.ts +2 -0
- package/node_modules/appium-android-driver/lib/execute-method-map.ts +6 -0
- package/node_modules/appium-android-driver/package.json +5 -5
- package/node_modules/appium-chromedriver/CHANGELOG.md +21 -0
- package/node_modules/appium-chromedriver/build/lib/commands/version.js +2 -2
- package/node_modules/appium-chromedriver/build/lib/commands/version.js.map +1 -1
- package/node_modules/appium-chromedriver/config/checksums.json +8 -0
- package/node_modules/appium-chromedriver/config/edge-checksums.json +13 -0
- package/node_modules/appium-chromedriver/config/mapping.json +1 -0
- package/node_modules/appium-chromedriver/lib/commands/version.ts +2 -2
- package/node_modules/appium-chromedriver/package.json +2 -2
- package/node_modules/appium-uiautomator2-server/CHANGELOG.md +15 -0
- package/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk +0 -0
- package/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk.idsig +0 -0
- package/node_modules/appium-uiautomator2-server/apks/{appium-uiautomator2-server-v11.6.3.apk → appium-uiautomator2-server-v11.6.5.apk} +0 -0
- package/node_modules/appium-uiautomator2-server/apks/{appium-uiautomator2-server-v11.6.3.apk.idsig → appium-uiautomator2-server-v11.6.5.apk.idsig} +0 -0
- package/node_modules/appium-uiautomator2-server/package.json +3 -3
- package/node_modules/axios/README.md +22 -40
- package/node_modules/axios/dist/axios.js +155 -9
- package/node_modules/axios/dist/axios.min.js +3 -3
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +179 -7
- package/node_modules/axios/dist/esm/axios.js +179 -7
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +405 -102
- package/node_modules/axios/index.d.cts +12 -2
- package/node_modules/axios/index.d.ts +9 -2
- package/node_modules/axios/lib/adapters/adapters.js +21 -0
- package/node_modules/axios/lib/adapters/fetch.js +72 -3
- package/node_modules/axios/lib/adapters/http.js +181 -41
- package/node_modules/axios/lib/core/Axios.js +6 -0
- package/node_modules/axios/lib/core/AxiosHeaders.js +1 -0
- package/node_modules/axios/lib/core/InterceptorManager.js +7 -2
- package/node_modules/axios/lib/core/assertValidRequestUrl.js +62 -0
- package/node_modules/axios/lib/core/dispatchRequest.js +4 -0
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/combineURLs.js +8 -0
- package/node_modules/axios/lib/helpers/proxyFromEnv.js +158 -0
- package/node_modules/axios/lib/helpers/shouldBypassProxy.js +2 -1
- package/node_modules/axios/lib/helpers/trackStream.js +5 -0
- package/node_modules/axios/package.json +2 -3
- package/node_modules/b4a/browser.js +3 -2
- package/node_modules/b4a/lib/utf8.js +1 -1
- package/node_modules/b4a/package.json +1 -1
- package/node_modules/bare-url/CMakeLists.txt +1 -1
- package/node_modules/bare-url/binding.c +43 -0
- package/node_modules/bare-url/index.d.ts +21 -0
- package/node_modules/bare-url/index.js +62 -9
- package/node_modules/bare-url/package.json +1 -1
- package/node_modules/bare-url/prebuilds/darwin-arm64/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/linux-arm64/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/linux-x64/bare-url.bare +0 -0
- package/node_modules/bare-url/prebuilds/win32-x64/bare-url.bare +0 -0
- package/node_modules/io.appium.settings/CHANGELOG.md +22 -0
- package/node_modules/io.appium.settings/README.md +4 -5
- package/node_modules/io.appium.settings/apks/settings_apk-debug.apk +0 -0
- package/node_modules/io.appium.settings/package.json +3 -3
- package/package.json +6 -6
- package/node_modules/proxy-from-env/LICENSE +0 -20
- package/node_modules/proxy-from-env/README.md +0 -163
- package/node_modules/proxy-from-env/index.cjs +0 -105
- package/node_modules/proxy-from-env/index.js +0 -103
- package/node_modules/proxy-from-env/package.json +0 -43
|
@@ -2,6 +2,7 @@ import net from 'node:net';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
4
|
import {util, fs} from '@appium/support';
|
|
5
|
+
import {AsyncLock, sleep} from 'asyncbox';
|
|
5
6
|
import * as ini from 'ini';
|
|
6
7
|
|
|
7
8
|
import type {ADB} from '../adb.js';
|
|
@@ -17,8 +18,13 @@ import type {
|
|
|
17
18
|
GsmVoiceStates,
|
|
18
19
|
NetworkSpeed,
|
|
19
20
|
ExecTelnetOptions,
|
|
21
|
+
ShakeOptions,
|
|
20
22
|
} from './types.js';
|
|
21
23
|
|
|
24
|
+
const SHAKE_GUARD = new AsyncLock();
|
|
25
|
+
// m/s^2: standard gravity with a margin
|
|
26
|
+
const MAX_SCREEN_AXIS_AT_REST = 1.25 * 9.80665;
|
|
27
|
+
|
|
22
28
|
/**
|
|
23
29
|
* Check the emulator state.
|
|
24
30
|
*
|
|
@@ -49,11 +55,6 @@ export async function fingerprint(this: ADB, fingerprintId: string): Promise<voi
|
|
|
49
55
|
if (!fingerprintId) {
|
|
50
56
|
throw new Error('Fingerprint id parameter must be defined');
|
|
51
57
|
}
|
|
52
|
-
// the method used only works for API level 23 and above
|
|
53
|
-
const level = await this.getApiLevel();
|
|
54
|
-
if (level < 23) {
|
|
55
|
-
throw new Error(`Device API Level must be >= 23. Current Api level '${level}'`);
|
|
56
|
-
}
|
|
57
58
|
await this.adbExecEmu(['finger', 'touch', fingerprintId]);
|
|
58
59
|
}
|
|
59
60
|
|
|
@@ -103,6 +104,117 @@ export async function sensorSet(this: ADB, sensor: string, value: Sensors): Prom
|
|
|
103
104
|
await this.adbExecEmu(['sensor', 'set', sensor, `${value}`]);
|
|
104
105
|
}
|
|
105
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Read the current value of a sensor on the connected emulator
|
|
109
|
+
* through the emulator console.
|
|
110
|
+
*
|
|
111
|
+
* The console is used rather than `adb emu` because some adb versions
|
|
112
|
+
* do not print the console reply of `adb emu` commands.
|
|
113
|
+
*
|
|
114
|
+
* @param sensor - Sensor type declared in SENSORS items.
|
|
115
|
+
* @returns The sensor value components, for example `[x, y, z]`
|
|
116
|
+
* for the accelerometer in m/s^2.
|
|
117
|
+
* @throws If the sensor type is not supported or the console reply cannot be parsed.
|
|
118
|
+
*/
|
|
119
|
+
export async function sensorGet(this: ADB, sensor: Sensors): Promise<number[]> {
|
|
120
|
+
if (!(Object.values(this.SENSORS) as string[]).includes(sensor)) {
|
|
121
|
+
throw new TypeError(
|
|
122
|
+
`Unsupported sensor sent '${sensor}'. Supported values: ${Object.values(this.SENSORS).join(', ')}`,
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
const output = await execSensorConsoleCommand(this, ['sensor', 'get', sensor]);
|
|
126
|
+
// e.g. 'acceleration = 0:9.77631:0.812349'
|
|
127
|
+
const match = new RegExp(`^${sensor}\\s*=\\s*(\\S+)`, 'm').exec(output);
|
|
128
|
+
const values = match ? match[1].split(':').map(Number) : [];
|
|
129
|
+
if (values.length === 0 || values.some((v) => !Number.isFinite(v))) {
|
|
130
|
+
throw new Error(`Cannot parse the '${sensor}' sensor value from the emulator console output: '${output}'`);
|
|
131
|
+
}
|
|
132
|
+
return values;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Shake the connected emulator by swinging its accelerometer.
|
|
137
|
+
*
|
|
138
|
+
* The screen-plane axis with the least gravity (x in portrait, y in landscape) swings
|
|
139
|
+
* to alternating sides, then the reading at rest is restored, also on failure.
|
|
140
|
+
* The defaults (about 3.5 g, twenty 150 ms swings) trigger common detectors such as
|
|
141
|
+
* Seismic and React Native's dev menu. Shakes of the same device run one after another.
|
|
142
|
+
*
|
|
143
|
+
* @param opts - Shake options
|
|
144
|
+
* @throws If the emulator console fails, or the accelerometer does not read a device at rest.
|
|
145
|
+
*/
|
|
146
|
+
export async function shake(this: ADB, opts: ShakeOptions = {}): Promise<void> {
|
|
147
|
+
// Android 11 emulator images never send 'set-delay' to the emulator, so the emulator
|
|
148
|
+
// pushes sensor values to them only every 800 ms (its default). Each swing must last
|
|
149
|
+
// longer than that to be seen, and React Native may need sixteen of them, so there the
|
|
150
|
+
// shake takes about 14 s.
|
|
151
|
+
const isSlowSensorPush =
|
|
152
|
+
(opts.durationMs === undefined || opts.phaseMs === undefined) && (await this.getApiLevel()) === 30;
|
|
153
|
+
const {amplitude = 33, phaseMs = isSlowSensorPush ? 900 : 150} = opts;
|
|
154
|
+
if (!(Number.isFinite(amplitude) && amplitude > 0)) {
|
|
155
|
+
throw new TypeError(`The shake amplitude must be a positive number of m/s^2. '${amplitude}' was given`);
|
|
156
|
+
}
|
|
157
|
+
if (!(Number.isInteger(phaseMs) && phaseMs > 0)) {
|
|
158
|
+
throw new TypeError(`The shake phase duration must be a positive integer of ms. '${phaseMs}' was given`);
|
|
159
|
+
}
|
|
160
|
+
// The default is a number of swings, whatever their length
|
|
161
|
+
const {durationMs = (isSlowSensorPush ? 16 : 20) * phaseMs} = opts;
|
|
162
|
+
if (!(Number.isInteger(durationMs) && durationMs > 0)) {
|
|
163
|
+
throw new TypeError(`The shake duration must be a positive integer of ms. '${durationMs}' was given`);
|
|
164
|
+
}
|
|
165
|
+
const halfCycles = Math.max(1, Math.round(durationMs / phaseMs));
|
|
166
|
+
await SHAKE_GUARD.acquire(this.curDeviceId ?? '', async () => {
|
|
167
|
+
const sensor = this.SENSORS.ACCELERATION;
|
|
168
|
+
const atRest = await this.sensorGet(sensor);
|
|
169
|
+
if (atRest.length !== 3) {
|
|
170
|
+
throw new Error(`The emulator accelerometer returned an unexpected value: ${atRest.join(':')}`);
|
|
171
|
+
}
|
|
172
|
+
// At rest the screen-plane axes carry gravity at most. More than that is most likely
|
|
173
|
+
// a swing that an earlier shake could not restore, and shaking around it would keep it.
|
|
174
|
+
if (Math.abs(atRest[0]) > MAX_SCREEN_AXIS_AT_REST || Math.abs(atRest[1]) > MAX_SCREEN_AXIS_AT_REST) {
|
|
175
|
+
throw new Error(
|
|
176
|
+
`The emulator accelerometer reads ${atRest.join(':')}, which is not a device at rest. ` +
|
|
177
|
+
`Set it back to the reading it had before in the emulator console first ` +
|
|
178
|
+
`(for example 'sensor set acceleration 0:9.81:0' in portrait)`,
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
const axis = Math.abs(atRest[0]) <= Math.abs(atRest[1]) ? 0 : 1;
|
|
182
|
+
const setAcceleration = async (values: number[]) =>
|
|
183
|
+
await execSensorConsoleCommand(this, ['sensor', 'set', sensor, values.join(':')]);
|
|
184
|
+
const restore = async () => {
|
|
185
|
+
try {
|
|
186
|
+
await setAcceleration(atRest);
|
|
187
|
+
} catch (e) {
|
|
188
|
+
throw new Error(
|
|
189
|
+
`Could not restore the emulator accelerometer to ${atRest.join(':')}: ${(e as Error).message}`,
|
|
190
|
+
{
|
|
191
|
+
cause: e,
|
|
192
|
+
},
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
log.debug(`Shaking the emulator around the accelerometer value at rest ${atRest.join(':')}`);
|
|
197
|
+
try {
|
|
198
|
+
for (let i = 0; i < halfCycles; i++) {
|
|
199
|
+
const swing = [...atRest];
|
|
200
|
+
swing[axis] += i % 2 === 0 ? amplitude : -amplitude;
|
|
201
|
+
await setAcceleration(swing);
|
|
202
|
+
await sleep(phaseMs);
|
|
203
|
+
}
|
|
204
|
+
} catch (e) {
|
|
205
|
+
// The swing error is the cause; a failed restore after it is only logged
|
|
206
|
+
try {
|
|
207
|
+
await restore();
|
|
208
|
+
} catch (restoreError) {
|
|
209
|
+
log.warn((restoreError as Error).message);
|
|
210
|
+
}
|
|
211
|
+
throw e;
|
|
212
|
+
}
|
|
213
|
+
// Not best effort: if the reading at rest cannot be restored, the caller must know
|
|
214
|
+
await restore();
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
|
|
106
218
|
/**
|
|
107
219
|
* Emulate power capacity change on the connected emulator.
|
|
108
220
|
*
|
|
@@ -497,4 +609,17 @@ async function dirExists(location: string): Promise<boolean> {
|
|
|
497
609
|
return (await fs.exists(location)) && (await fs.stat(location)).isDirectory();
|
|
498
610
|
}
|
|
499
611
|
|
|
612
|
+
/**
|
|
613
|
+
* Runs an emulator console command for the sensor helpers.
|
|
614
|
+
* `execEmuConsoleCommand` rejects console `KO` replies with a plain string,
|
|
615
|
+
* for example when the sensor is disabled on the AVD. This turns them into errors.
|
|
616
|
+
*/
|
|
617
|
+
async function execSensorConsoleCommand(adb: ADB, cmd: string[]): Promise<string> {
|
|
618
|
+
try {
|
|
619
|
+
return await adb.execEmuConsoleCommand(cmd);
|
|
620
|
+
} catch (e) {
|
|
621
|
+
throw e instanceof Error ? e : new Error(`The emulator console rejected '${cmd.join(' ')}': ${String(e)}`);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
|
|
500
625
|
// #endregion
|
|
@@ -60,8 +60,8 @@ export async function initBundletool(this: ADB): Promise<void> {
|
|
|
60
60
|
/**
|
|
61
61
|
* Retrieve the API level of the device under test.
|
|
62
62
|
*
|
|
63
|
-
* @return The API level as integer number, for example
|
|
64
|
-
* Android
|
|
63
|
+
* @return The API level as integer number, for example 26 for
|
|
64
|
+
* Android Oreo. The result of this method is cached, so all the further
|
|
65
65
|
* calls return the same value as the first one.
|
|
66
66
|
*/
|
|
67
67
|
export async function getApiLevel(this: ADB): Promise<number> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {util} from '@appium/support';
|
|
2
|
-
import {
|
|
2
|
+
import {waitForCondition} from 'asyncbox';
|
|
3
3
|
|
|
4
4
|
import type {ADB} from '../adb.js';
|
|
5
5
|
import {log} from '../logger.js';
|
|
@@ -8,8 +8,7 @@ const CREDENTIAL_CANNOT_BE_NULL_OR_EMPTY_ERROR = `Credential can't be null or em
|
|
|
8
8
|
const CREDENTIAL_DID_NOT_MATCH_ERROR = `didn't match`;
|
|
9
9
|
const SUPPORTED_LOCK_CREDENTIAL_TYPES = ['password', 'pin', 'pattern'];
|
|
10
10
|
const KEYCODE_POWER = 26;
|
|
11
|
-
const KEYCODE_WAKEUP = 224;
|
|
12
|
-
const HIDE_KEYBOARD_WAIT_TIME = 100;
|
|
11
|
+
const KEYCODE_WAKEUP = 224;
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* Check whether the device supports lock settings management with `locksettings`
|
|
@@ -209,25 +208,7 @@ export async function dismissKeyguard(this: ADB): Promise<void> {
|
|
|
209
208
|
// Just screen on if the screen defaults off
|
|
210
209
|
await this.cycleWakeUp();
|
|
211
210
|
|
|
212
|
-
|
|
213
|
-
await this.shell(['wm', 'dismiss-keyguard']);
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
const stdout = await this.shell(['dumpsys', 'window']);
|
|
218
|
-
if (!isCurrentFocusOnKeyguard(stdout)) {
|
|
219
|
-
log.debug('The keyguard seems to be inactive');
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
log.debug('Swiping up to dismiss the keyguard');
|
|
224
|
-
if (await this.hideKeyboard()) {
|
|
225
|
-
await sleep(HIDE_KEYBOARD_WAIT_TIME);
|
|
226
|
-
}
|
|
227
|
-
log.debug('Dismissing notifications from the unlock view');
|
|
228
|
-
await this.shell(['service', 'call', 'notification', '1']);
|
|
229
|
-
await this.back();
|
|
230
|
-
await swipeUp.bind(this)(stdout);
|
|
211
|
+
await this.shell(['wm', 'dismiss-keyguard']);
|
|
231
212
|
}
|
|
232
213
|
|
|
233
214
|
/**
|
|
@@ -330,26 +311,6 @@ function buildCommand(verb: string, oldCredential: string | null = null, ...args
|
|
|
330
311
|
return cmd;
|
|
331
312
|
}
|
|
332
313
|
|
|
333
|
-
/**
|
|
334
|
-
* Performs swipe up gesture on the screen
|
|
335
|
-
*
|
|
336
|
-
* @param windowDumpsys The output of `adb shell dumpsys window` command
|
|
337
|
-
* @throws {Error} If the display size cannot be retrieved
|
|
338
|
-
*/
|
|
339
|
-
async function swipeUp(this: ADB, windowDumpsys: string): Promise<void> {
|
|
340
|
-
const dimensionsMatch = /init=(\d+)x(\d+)/.exec(windowDumpsys);
|
|
341
|
-
if (!dimensionsMatch) {
|
|
342
|
-
throw new Error('Cannot retrieve the display size');
|
|
343
|
-
}
|
|
344
|
-
const displayWidth = parseInt(dimensionsMatch[1], 10);
|
|
345
|
-
const displayHeight = parseInt(dimensionsMatch[2], 10);
|
|
346
|
-
const x0 = displayWidth / 2;
|
|
347
|
-
const y0 = (displayHeight / 5) * 4;
|
|
348
|
-
const x1 = x0;
|
|
349
|
-
const y1 = displayHeight / 5;
|
|
350
|
-
await this.shell(['input', 'touchscreen', 'swipe', ...[x0, y0, x1, y1].map((c) => `${Math.trunc(c)}`)]);
|
|
351
|
-
}
|
|
352
|
-
|
|
353
314
|
/**
|
|
354
315
|
* Checks mCurrentFocus in dumpsys output to determine if Keyguard is activated
|
|
355
316
|
*
|
|
@@ -53,7 +53,6 @@ export async function getReverseList(this: ADB): Promise<string[]> {
|
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* Setup TCP port forwarding with adb on the device under test.
|
|
56
|
-
* Only available for API 21+.
|
|
57
56
|
*
|
|
58
57
|
* @param devicePort - The number of the remote device port.
|
|
59
58
|
* @param systemPort - The number of the local system port.
|
|
@@ -168,6 +168,24 @@ export interface ExecTelnetOptions {
|
|
|
168
168
|
port?: number | string;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
export interface ShakeOptions {
|
|
172
|
+
/**
|
|
173
|
+
* How far the accelerometer swings from its value at rest, in m/s^2.
|
|
174
|
+
* 33 by default.
|
|
175
|
+
*/
|
|
176
|
+
amplitude?: number;
|
|
177
|
+
/**
|
|
178
|
+
* How long the shake lasts, in milliseconds. It is rounded to a whole number of swings, one at least.
|
|
179
|
+
* Twenty swings of `phaseMs` by default (sixteen on API level 30), so 3000 (14400 on API level 30)
|
|
180
|
+
* with the default `phaseMs`.
|
|
181
|
+
*/
|
|
182
|
+
durationMs?: number;
|
|
183
|
+
/**
|
|
184
|
+
* How long each swing is held, in milliseconds. 150 by default (900 on API level 30).
|
|
185
|
+
*/
|
|
186
|
+
phaseMs?: number;
|
|
187
|
+
}
|
|
188
|
+
|
|
171
189
|
export interface EmuVersionInfo {
|
|
172
190
|
/**
|
|
173
191
|
* The actual revision number, for example '30.0.5'
|
|
@@ -249,7 +267,7 @@ export interface InstallMultipleApksOptions {
|
|
|
249
267
|
/**
|
|
250
268
|
* Set to true in order to grant all the
|
|
251
269
|
* permissions requested in the application's manifest automatically after the installation
|
|
252
|
-
* is completed
|
|
270
|
+
* is completed.
|
|
253
271
|
* `false` by default.
|
|
254
272
|
*/
|
|
255
273
|
grantPermissions?: boolean;
|
|
@@ -282,7 +300,7 @@ export interface InstallApksOptions {
|
|
|
282
300
|
/**
|
|
283
301
|
* Set to true in order to grant all the
|
|
284
302
|
* permissions requested in the application's manifest automatically after the installation
|
|
285
|
-
* is completed
|
|
303
|
+
* is completed.
|
|
286
304
|
* `false` by default.
|
|
287
305
|
*/
|
|
288
306
|
grantPermissions?: boolean;
|
|
@@ -474,8 +492,7 @@ export interface InstallOptions {
|
|
|
474
492
|
/**
|
|
475
493
|
* Set to true in order to grant all the
|
|
476
494
|
* permissions requested in the application's manifest
|
|
477
|
-
* automatically after the installation is completed
|
|
478
|
-
* under Android 6+.
|
|
495
|
+
* automatically after the installation is completed.
|
|
479
496
|
* `false` by default.
|
|
480
497
|
*/
|
|
481
498
|
grantPermissions?: boolean;
|
|
@@ -517,8 +534,7 @@ export interface InstallOrUpgradeOptions {
|
|
|
517
534
|
/**
|
|
518
535
|
* Set to true in order to grant all the
|
|
519
536
|
* permissions requested in the application's manifest
|
|
520
|
-
* automatically after the installation is completed
|
|
521
|
-
* under Android 6+.
|
|
537
|
+
* automatically after the installation is completed.
|
|
522
538
|
* `false` by default.
|
|
523
539
|
*/
|
|
524
540
|
grantPermissions?: boolean;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import {util} from '@appium/support';
|
|
2
2
|
|
|
3
|
-
import {log} from '../../logger.js';
|
|
4
|
-
|
|
5
3
|
export interface BuildInstallArgsOptions {
|
|
6
4
|
replace?: boolean;
|
|
7
5
|
allowTestPackages?: boolean;
|
|
@@ -13,11 +11,11 @@ export interface BuildInstallArgsOptions {
|
|
|
13
11
|
/**
|
|
14
12
|
* Builds command-line arguments for `adb install`.
|
|
15
13
|
*
|
|
16
|
-
* @param
|
|
14
|
+
* @param _apiLevel - Unused. Kept for backward compatibility
|
|
17
15
|
* @param options - Install options mapped to adb flags
|
|
18
16
|
* @returns A list of install flags
|
|
19
17
|
*/
|
|
20
|
-
export function buildInstallArgs(
|
|
18
|
+
export function buildInstallArgs(_apiLevel: number, options: BuildInstallArgsOptions = {}): string[] {
|
|
21
19
|
const result: string[] = [];
|
|
22
20
|
|
|
23
21
|
if (!util.hasValue(options.replace) || options.replace) {
|
|
@@ -30,15 +28,7 @@ export function buildInstallArgs(apiLevel: number, options: BuildInstallArgsOpti
|
|
|
30
28
|
result.push('-s');
|
|
31
29
|
}
|
|
32
30
|
if (options.grantPermissions) {
|
|
33
|
-
|
|
34
|
-
log.debug(
|
|
35
|
-
`Skipping permissions grant option, since ` +
|
|
36
|
-
`the current API level ${apiLevel} does not support applications ` +
|
|
37
|
-
`permissions customization`,
|
|
38
|
-
);
|
|
39
|
-
} else {
|
|
40
|
-
result.push('-g');
|
|
41
|
-
}
|
|
31
|
+
result.push('-g');
|
|
42
32
|
}
|
|
43
33
|
if (options.partialInstall) {
|
|
44
34
|
result.push('-p');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium-adb",
|
|
3
|
-
"version": "17.0
|
|
3
|
+
"version": "17.1.0",
|
|
4
4
|
"description": "Android Debug Bridge interface",
|
|
5
5
|
"homepage": "https://appium.io",
|
|
6
6
|
"bugs": {
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"node": "^22.22.2 || ^24.15.0 || >=26.0.0",
|
|
65
65
|
"npm": ">=10"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "a3be7e0281080b2766492881ff84d545279c81e7"
|
|
68
68
|
}
|
|
@@ -3,6 +3,66 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [16.2.0](https://github.com/appium/appium-android/compare/appium-android-driver@16.1.18...appium-android-driver@16.2.0) (2026-12-04)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **driver-lib:** add mobile: sensorGet ([#203](https://github.com/appium/appium-android/issues/203)) ([f3887e6](https://github.com/appium/appium-android/commit/f3887e609362955ea722eccdf40d1e19211aae10))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## [16.1.18](https://github.com/appium/appium-android/compare/appium-android-driver@16.1.17...appium-android-driver@16.1.18) (2026-12-04)
|
|
14
|
+
|
|
15
|
+
**Note:** Version bump only for package appium-android-driver
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## [16.1.17](https://github.com/appium/appium-android/compare/appium-android-driver@16.1.16...appium-android-driver@16.1.17) (2026-12-04)
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* **driver-lib:** keep waiting for webviews with pages if waitForWebviewMs is set ([#201](https://github.com/appium/appium-android/issues/201)) ([133d4ca](https://github.com/appium/appium-android/commit/133d4cab1bd5b6c03161a19b18e65e522b10b051))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## [16.1.16](https://github.com/appium/appium-android/compare/appium-android-driver@16.1.15...appium-android-driver@16.1.16) (2026-12-04)
|
|
29
|
+
|
|
30
|
+
**Note:** Version bump only for package appium-android-driver
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## [16.1.15](https://github.com/appium/appium-android/compare/appium-android-driver@16.1.14...appium-android-driver@16.1.15) (2026-12-03)
|
|
37
|
+
|
|
38
|
+
### Bug Fixes
|
|
39
|
+
|
|
40
|
+
* **driver-lib:** skip CDP probes to devtools sockets with unaccepted connections ([#196](https://github.com/appium/appium-android/issues/196)) ([911a0c4](https://github.com/appium/appium-android/commit/911a0c48dca8d0d0c84a4cd3e8544f2b0b88f41b))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## [16.1.14](https://github.com/appium/appium-android/compare/appium-android-driver@16.1.13...appium-android-driver@16.1.14) (2026-12-03)
|
|
44
|
+
|
|
45
|
+
**Note:** Version bump only for package appium-android-driver
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## [16.1.13](https://github.com/appium/appium-android/compare/appium-android-driver@16.1.12...appium-android-driver@16.1.13) (2026-12-02)
|
|
52
|
+
|
|
53
|
+
**Note:** Version bump only for package appium-android-driver
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
## [16.1.12](https://github.com/appium/appium-android/compare/appium-android-driver@16.1.11...appium-android-driver@16.1.12) (2026-12-02)
|
|
60
|
+
|
|
61
|
+
### Miscellaneous Chores
|
|
62
|
+
|
|
63
|
+
* drop workarounds for Android API levels below 26 ([#194](https://github.com/appium/appium-android/issues/194)) ([1eb0783](https://github.com/appium/appium-android/commit/1eb0783f651078dbeec47c3b63fc91b85bbb7f15))
|
|
64
|
+
|
|
65
|
+
|
|
6
66
|
## [16.1.11](https://github.com/appium/appium-android/compare/appium-android-driver@16.1.10...appium-android-driver@16.1.11) (2026-12-02)
|
|
7
67
|
|
|
8
68
|
### Bug Fixes
|
|
@@ -147,8 +147,8 @@ export declare function installApp(this: AndroidDriver, appPath: string, opts: O
|
|
|
147
147
|
* @param useSdcard Set to true to install the app on sdcard instead of the device memory.
|
|
148
148
|
* `false` by default.
|
|
149
149
|
* @param grantPermissions Set to true in order to grant all the
|
|
150
|
-
* permissions requested in the application's manifest automatically after the installation is completed
|
|
151
|
-
*
|
|
150
|
+
* permissions requested in the application's manifest automatically after the installation is completed.
|
|
151
|
+
* `false` by default.
|
|
152
152
|
* @param replace Set it to false if you don't want the application to be upgraded/reinstalled
|
|
153
153
|
* if it is already present on the device. `true` by default.
|
|
154
154
|
* @param noIncremental Forcefully disables incremental installs if set to `true`.
|
|
@@ -224,8 +224,8 @@ export async function installApp(appPath, opts) {
|
|
|
224
224
|
* @param useSdcard Set to true to install the app on sdcard instead of the device memory.
|
|
225
225
|
* `false` by default.
|
|
226
226
|
* @param grantPermissions Set to true in order to grant all the
|
|
227
|
-
* permissions requested in the application's manifest automatically after the installation is completed
|
|
228
|
-
*
|
|
227
|
+
* permissions requested in the application's manifest automatically after the installation is completed.
|
|
228
|
+
* `false` by default.
|
|
229
229
|
* @param replace Set it to false if you don't want the application to be upgraded/reinstalled
|
|
230
230
|
* if it is already present on the device. `true` by default.
|
|
231
231
|
* @param noIncremental Forcefully disables incremental installs if set to `true`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../lib/commands/context/helpers.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAMjD,OAAO,KAAK,EAAC,aAAa,EAAE,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EAMhB,MAAM,aAAa,CAAC;AAIrB,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BlC,CAAC;AAEX,eAAO,MAAM,mBAAmB,uBAAuB,CAAC;AACxD,eAAO,MAAM,0BAA0B,2FAK7B,CAAC;AAKX,eAAO,MAAM,UAAU,eAAe,CAAC;AACvC,eAAO,MAAM,WAAW,YAAY,CAAC;AACrC,eAAO,MAAM,YAAY,aAAa,CAAC;AACvC,eAAO,MAAM,YAAY,aAAoB,CAAC;AAC9C,eAAO,MAAM,uBAAuB,QAAgD,CAAC;
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../lib/commands/context/helpers.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAMjD,OAAO,KAAK,EAAC,aAAa,EAAE,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EAMhB,MAAM,aAAa,CAAC;AAIrB,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BlC,CAAC;AAEX,eAAO,MAAM,mBAAmB,uBAAuB,CAAC;AACxD,eAAO,MAAM,0BAA0B,2FAK7B,CAAC;AAKX,eAAO,MAAM,UAAU,eAAe,CAAC;AACvC,eAAO,MAAM,WAAW,YAAY,CAAC;AACrC,eAAO,MAAM,YAAY,aAAa,CAAC;AACvC,eAAO,MAAM,YAAY,aAAoB,CAAC;AAC9C,eAAO,MAAM,uBAAuB,QAAgD,CAAC;AAwBrF;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,GACd,CAAC,OAAO,+BAA+B,CAAC,CAAC,MAAM,OAAO,+BAA+B,CAAC,CAKxF;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,aAAa,EACnB,eAAe,EAAE,eAAe,EAAE,EAClC,OAAO,GAAE,eAAe,GAAG;IAAC,eAAe,CAAC,EAAE,OAAO,CAAA;CAAM,GAC1D,MAAM,EAAE,CAkBV;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,GAAE,eAAoB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAuFpH;AAED;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7C,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,YAAY,CAAC,CA8EvB;AAED;;;;;;;GAOG;AACH,wBAAsB,yBAAyB,CAAC,CAAC,SAAS,YAAY,EACpE,IAAI,EAAE,aAAa,EACnB,YAAY,EAAE,CAAC,EACf,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,CAAC,CAAC,CAcZ;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAMvE;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB7E;AAyMD;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,aAAa,EACnB,GAAG,IAAI,EAAE,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,GACtD,OAAO,CAAC,GAAG,CAAC,CAKd;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE,EAAE,YAAY,GAAG,IAAI,CAkCjF"}
|