appium-android-driver 7.8.2 → 8.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 +32 -0
- package/build/lib/commands/app-management.d.ts +129 -5
- package/build/lib/commands/app-management.d.ts.map +1 -1
- package/build/lib/commands/app-management.js +433 -128
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/appearance.d.ts +17 -4
- package/build/lib/commands/appearance.d.ts.map +1 -1
- package/build/lib/commands/appearance.js +32 -33
- package/build/lib/commands/appearance.js.map +1 -1
- package/build/lib/commands/context/cache.d.ts +19 -0
- package/build/lib/commands/context/cache.d.ts.map +1 -0
- package/build/lib/commands/context/cache.js +32 -0
- package/build/lib/commands/context/cache.js.map +1 -0
- package/build/lib/commands/context/exports.d.ts +141 -0
- package/build/lib/commands/context/exports.d.ts.map +1 -0
- package/build/lib/commands/context/exports.js +351 -0
- package/build/lib/commands/context/exports.js.map +1 -0
- package/build/lib/commands/context/helpers.d.ts +98 -0
- package/build/lib/commands/context/helpers.d.ts.map +1 -0
- package/build/lib/commands/context/helpers.js +715 -0
- package/build/lib/commands/context/helpers.js.map +1 -0
- package/build/lib/commands/device/common.d.ts +23 -0
- package/build/lib/commands/device/common.d.ts.map +1 -0
- package/build/lib/commands/device/common.js +230 -0
- package/build/lib/commands/device/common.js.map +1 -0
- package/build/lib/commands/device/emulator-actions.d.ts +114 -0
- package/build/lib/commands/device/emulator-actions.d.ts.map +1 -0
- package/build/lib/commands/device/emulator-actions.js +197 -0
- package/build/lib/commands/device/emulator-actions.js.map +1 -0
- package/build/lib/commands/device/emulator-console.d.ts +7 -0
- package/build/lib/commands/device/emulator-console.d.ts.map +1 -0
- package/build/lib/commands/device/emulator-console.js +24 -0
- package/build/lib/commands/device/emulator-console.js.map +1 -0
- package/build/lib/commands/device/utils.d.ts +50 -0
- package/build/lib/commands/device/utils.d.ts.map +1 -0
- package/build/lib/commands/device/utils.js +238 -0
- package/build/lib/commands/device/utils.js.map +1 -0
- package/build/lib/commands/deviceidle.d.ts +8 -5
- package/build/lib/commands/deviceidle.d.ts.map +1 -1
- package/build/lib/commands/deviceidle.js +31 -37
- package/build/lib/commands/deviceidle.js.map +1 -1
- package/build/lib/commands/element.d.ts +99 -5
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js +152 -116
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/execute.d.ts +12 -4
- package/build/lib/commands/execute.d.ts.map +1 -1
- package/build/lib/commands/execute.js +83 -78
- package/build/lib/commands/execute.js.map +1 -1
- package/build/lib/commands/file-actions.d.ts +42 -5
- package/build/lib/commands/file-actions.d.ts.map +1 -1
- package/build/lib/commands/file-actions.js +230 -194
- package/build/lib/commands/file-actions.js.map +1 -1
- package/build/lib/commands/find.d.ts +5 -4
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js +7 -10
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/commands/geolocation.d.ts +45 -0
- package/build/lib/commands/geolocation.d.ts.map +1 -0
- package/build/lib/commands/geolocation.js +182 -0
- package/build/lib/commands/geolocation.js.map +1 -0
- package/build/lib/commands/ime.d.ts +25 -5
- package/build/lib/commands/ime.d.ts.map +1 -1
- package/build/lib/commands/ime.js +59 -42
- package/build/lib/commands/ime.js.map +1 -1
- package/build/lib/commands/intent.d.ts +56 -5
- package/build/lib/commands/intent.d.ts.map +1 -1
- package/build/lib/commands/intent.js +135 -83
- package/build/lib/commands/intent.js.map +1 -1
- package/build/lib/commands/keyboard.d.ts +58 -4
- package/build/lib/commands/keyboard.d.ts.map +1 -1
- package/build/lib/commands/keyboard.js +119 -17
- package/build/lib/commands/keyboard.js.map +1 -1
- package/build/lib/commands/lock/exports.d.ts +301 -0
- package/build/lib/commands/lock/exports.d.ts.map +1 -0
- package/build/lib/commands/lock/exports.js +121 -0
- package/build/lib/commands/lock/exports.js.map +1 -0
- package/build/lib/commands/lock/helpers.d.ts +349 -0
- package/build/lib/commands/lock/helpers.d.ts.map +1 -0
- package/build/lib/commands/lock/helpers.js +375 -0
- package/build/lib/commands/lock/helpers.js.map +1 -0
- package/build/lib/commands/log.d.ts +59 -5
- package/build/lib/commands/log.d.ts.map +1 -1
- package/build/lib/commands/log.js +150 -140
- package/build/lib/commands/log.js.map +1 -1
- package/build/lib/commands/media-projection.d.ts +16 -5
- package/build/lib/commands/media-projection.d.ts.map +1 -1
- package/build/lib/commands/media-projection.js +69 -58
- package/build/lib/commands/media-projection.js.map +1 -1
- package/build/lib/commands/memory.d.ts +9 -5
- package/build/lib/commands/memory.d.ts.map +1 -1
- package/build/lib/commands/memory.js +19 -24
- package/build/lib/commands/memory.js.map +1 -1
- package/build/lib/commands/misc.d.ts +42 -0
- package/build/lib/commands/misc.d.ts.map +1 -0
- package/build/lib/commands/misc.js +100 -0
- package/build/lib/commands/misc.js.map +1 -0
- package/build/lib/commands/network.d.ts +61 -5
- package/build/lib/commands/network.d.ts.map +1 -1
- package/build/lib/commands/network.js +196 -189
- package/build/lib/commands/network.js.map +1 -1
- package/build/lib/commands/performance.d.ts +67 -27
- package/build/lib/commands/performance.d.ts.map +1 -1
- package/build/lib/commands/performance.js +105 -80
- package/build/lib/commands/performance.js.map +1 -1
- package/build/lib/commands/permissions.d.ts +12 -6
- package/build/lib/commands/permissions.d.ts.map +1 -1
- package/build/lib/commands/permissions.js +65 -62
- package/build/lib/commands/permissions.js.map +1 -1
- package/build/lib/commands/recordscreen.d.ts +44 -5
- package/build/lib/commands/recordscreen.d.ts.map +1 -1
- package/build/lib/commands/recordscreen.js +131 -126
- package/build/lib/commands/recordscreen.js.map +1 -1
- package/build/lib/commands/resources.d.ts +16 -0
- package/build/lib/commands/resources.d.ts.map +1 -0
- package/build/lib/commands/resources.js +91 -0
- package/build/lib/commands/resources.js.map +1 -0
- package/build/lib/commands/shell.d.ts +8 -5
- package/build/lib/commands/shell.d.ts.map +1 -1
- package/build/lib/commands/shell.js +29 -33
- package/build/lib/commands/shell.js.map +1 -1
- package/build/lib/commands/streamscreen.d.ts +34 -6
- package/build/lib/commands/streamscreen.d.ts.map +1 -1
- package/build/lib/commands/streamscreen.js +166 -162
- package/build/lib/commands/streamscreen.js.map +1 -1
- package/build/lib/commands/system-bars.d.ts +18 -13
- package/build/lib/commands/system-bars.d.ts.map +1 -1
- package/build/lib/commands/system-bars.js +68 -64
- package/build/lib/commands/system-bars.js.map +1 -1
- package/build/lib/commands/time.d.ts +14 -0
- package/build/lib/commands/time.d.ts.map +1 -0
- package/build/lib/commands/time.js +39 -0
- package/build/lib/commands/time.js.map +1 -0
- package/build/lib/commands/touch.d.ts +99 -6
- package/build/lib/commands/touch.d.ts.map +1 -1
- package/build/lib/commands/touch.js +399 -280
- package/build/lib/commands/touch.js.map +1 -1
- package/build/lib/commands/types.d.ts +115 -3
- package/build/lib/commands/types.d.ts.map +1 -1
- package/build/lib/doctor/checks.d.ts.map +1 -1
- package/build/lib/doctor/checks.js +4 -4
- package/build/lib/doctor/checks.js.map +1 -1
- package/build/lib/driver.d.ts +224 -27
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +232 -7
- package/build/lib/driver.js.map +1 -1
- package/build/lib/index.d.ts +1 -4
- package/build/lib/index.d.ts.map +1 -1
- package/build/lib/index.js +1 -13
- package/build/lib/index.js.map +1 -1
- package/build/lib/logger.js.map +1 -1
- package/build/lib/method-map.d.ts +0 -23
- package/build/lib/method-map.d.ts.map +1 -1
- package/build/lib/method-map.js +0 -11
- package/build/lib/method-map.js.map +1 -1
- package/build/lib/utils.d.ts +12 -0
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +38 -2
- package/build/lib/utils.js.map +1 -1
- package/lib/commands/app-management.js +470 -145
- package/lib/commands/appearance.js +29 -36
- package/lib/commands/context/cache.js +29 -0
- package/lib/commands/context/exports.js +379 -0
- package/lib/commands/context/helpers.js +802 -0
- package/lib/commands/device/common.js +264 -0
- package/lib/commands/device/emulator-actions.js +194 -0
- package/lib/commands/device/emulator-console.js +24 -0
- package/lib/commands/device/utils.js +285 -0
- package/lib/commands/deviceidle.js +31 -44
- package/lib/commands/element.js +149 -142
- package/lib/commands/execute.js +86 -87
- package/lib/commands/file-actions.js +249 -222
- package/lib/commands/find.ts +13 -19
- package/lib/commands/geolocation.js +179 -0
- package/lib/commands/ime.js +53 -45
- package/lib/commands/intent.js +149 -91
- package/lib/commands/keyboard.js +114 -17
- package/lib/commands/lock/exports.js +139 -0
- package/lib/commands/lock/helpers.js +379 -0
- package/lib/commands/log.js +170 -166
- package/lib/commands/media-projection.js +75 -70
- package/lib/commands/memory.js +17 -29
- package/lib/commands/misc.js +94 -0
- package/lib/commands/network.js +209 -223
- package/lib/commands/performance.js +88 -73
- package/lib/commands/permissions.js +83 -84
- package/lib/commands/recordscreen.js +171 -170
- package/lib/commands/resources.js +96 -0
- package/lib/commands/shell.js +28 -42
- package/lib/commands/streamscreen.js +207 -206
- package/lib/commands/system-bars.js +76 -77
- package/lib/commands/time.js +36 -0
- package/lib/commands/touch.js +442 -346
- package/lib/commands/types.ts +142 -10
- package/lib/doctor/checks.js +24 -16
- package/lib/driver.ts +454 -12
- package/lib/index.ts +1 -13
- package/lib/logger.js +1 -1
- package/lib/method-map.js +0 -11
- package/lib/utils.js +40 -3
- package/package.json +1 -1
- package/build/lib/commands/actions.d.ts +0 -8
- package/build/lib/commands/actions.d.ts.map +0 -1
- package/build/lib/commands/actions.js +0 -207
- package/build/lib/commands/actions.js.map +0 -1
- package/build/lib/commands/alert.d.ts +0 -8
- package/build/lib/commands/alert.d.ts.map +0 -1
- package/build/lib/commands/alert.js +0 -29
- package/build/lib/commands/alert.js.map +0 -1
- package/build/lib/commands/context.d.ts +0 -10
- package/build/lib/commands/context.d.ts.map +0 -1
- package/build/lib/commands/context.js +0 -431
- package/build/lib/commands/context.js.map +0 -1
- package/build/lib/commands/emu-console.d.ts +0 -7
- package/build/lib/commands/emu-console.d.ts.map +0 -1
- package/build/lib/commands/emu-console.js +0 -27
- package/build/lib/commands/emu-console.js.map +0 -1
- package/build/lib/commands/general.d.ts +0 -9
- package/build/lib/commands/general.d.ts.map +0 -1
- package/build/lib/commands/general.js +0 -293
- package/build/lib/commands/general.js.map +0 -1
- package/build/lib/commands/index.d.ts +0 -28
- package/build/lib/commands/index.d.ts.map +0 -1
- package/build/lib/commands/index.js +0 -57
- package/build/lib/commands/index.js.map +0 -1
- package/build/lib/commands/mixins.d.ts +0 -747
- package/build/lib/commands/mixins.d.ts.map +0 -1
- package/build/lib/commands/mixins.js +0 -19
- package/build/lib/commands/mixins.js.map +0 -1
- package/build/lib/helpers/android.d.ts +0 -163
- package/build/lib/helpers/android.d.ts.map +0 -1
- package/build/lib/helpers/android.js +0 -818
- package/build/lib/helpers/android.js.map +0 -1
- package/build/lib/helpers/index.d.ts +0 -7
- package/build/lib/helpers/index.d.ts.map +0 -1
- package/build/lib/helpers/index.js +0 -29
- package/build/lib/helpers/index.js.map +0 -1
- package/build/lib/helpers/types.d.ts +0 -122
- package/build/lib/helpers/types.d.ts.map +0 -1
- package/build/lib/helpers/types.js +0 -3
- package/build/lib/helpers/types.js.map +0 -1
- package/build/lib/helpers/unlock.d.ts +0 -32
- package/build/lib/helpers/unlock.d.ts.map +0 -1
- package/build/lib/helpers/unlock.js +0 -273
- package/build/lib/helpers/unlock.js.map +0 -1
- package/build/lib/helpers/webview.d.ts +0 -74
- package/build/lib/helpers/webview.d.ts.map +0 -1
- package/build/lib/helpers/webview.js +0 -442
- package/build/lib/helpers/webview.js.map +0 -1
- package/lib/commands/actions.js +0 -244
- package/lib/commands/alert.js +0 -34
- package/lib/commands/context.js +0 -507
- package/lib/commands/emu-console.js +0 -31
- package/lib/commands/general.js +0 -343
- package/lib/commands/index.ts +0 -54
- package/lib/commands/mixins.ts +0 -976
- package/lib/helpers/android.ts +0 -1153
- package/lib/helpers/index.ts +0 -6
- package/lib/helpers/types.ts +0 -136
- package/lib/helpers/unlock.ts +0 -329
- package/lib/helpers/webview.ts +0 -604
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.patternUnlock = exports.verifyUnlock = exports.getPatternActions = exports.getPatternKeyPosition = exports.passwordUnlock = exports.pinUnlockWithKeyEvent = exports.pinUnlock = exports.fingerprintUnlock = exports.stringKeyToArr = exports.encodePassword = exports.fastUnlock = exports.validateUnlockCapabilities = exports.toCredentialType = exports.INPUT_KEYS_WAIT_TIME = exports.UNLOCK_WAIT_TIME = exports.KEYCODE_NUMPAD_ENTER = exports.FINGERPRINT_UNLOCK = exports.PATTERN_UNLOCK = exports.PASSWORD_UNLOCK = exports.PIN_UNLOCK_KEY_EVENT = exports.PIN_UNLOCK = void 0;
|
|
7
|
+
const support_1 = require("@appium/support");
|
|
8
|
+
const asyncbox_1 = require("asyncbox");
|
|
9
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
10
|
+
exports.PIN_UNLOCK = 'pin';
|
|
11
|
+
exports.PIN_UNLOCK_KEY_EVENT = 'pinWithKeyEvent';
|
|
12
|
+
exports.PASSWORD_UNLOCK = 'password';
|
|
13
|
+
exports.PATTERN_UNLOCK = 'pattern';
|
|
14
|
+
exports.FINGERPRINT_UNLOCK = 'fingerprint';
|
|
15
|
+
const UNLOCK_TYPES = /** @type {const} */ ([
|
|
16
|
+
exports.PIN_UNLOCK,
|
|
17
|
+
exports.PIN_UNLOCK_KEY_EVENT,
|
|
18
|
+
exports.PASSWORD_UNLOCK,
|
|
19
|
+
exports.PATTERN_UNLOCK,
|
|
20
|
+
exports.FINGERPRINT_UNLOCK,
|
|
21
|
+
]);
|
|
22
|
+
exports.KEYCODE_NUMPAD_ENTER = 66;
|
|
23
|
+
exports.UNLOCK_WAIT_TIME = 100;
|
|
24
|
+
exports.INPUT_KEYS_WAIT_TIME = 100;
|
|
25
|
+
const NUMBER_ZERO_KEYCODE = 7;
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param {any} value
|
|
29
|
+
* @returns {value is string}
|
|
30
|
+
*/
|
|
31
|
+
function isNonEmptyString(value) {
|
|
32
|
+
return typeof value === 'string' && value !== '';
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Wait for the display to be unlocked.
|
|
36
|
+
* Some devices automatically accept typed 'pin' and 'password' code
|
|
37
|
+
* without pressing the Enter key. But some devices need it.
|
|
38
|
+
* This method waits a few seconds first for such automatic acceptance case.
|
|
39
|
+
* If the device is still locked, then this method will try to send
|
|
40
|
+
* the enter key code.
|
|
41
|
+
*
|
|
42
|
+
* @param {import('appium-adb').ADB} adb The instance of ADB
|
|
43
|
+
*/
|
|
44
|
+
async function waitForUnlock(adb) {
|
|
45
|
+
await (0, asyncbox_1.sleep)(exports.UNLOCK_WAIT_TIME);
|
|
46
|
+
if (!(await adb.isScreenLocked())) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
await adb.keyevent(exports.KEYCODE_NUMPAD_ENTER);
|
|
50
|
+
await (0, asyncbox_1.sleep)(exports.UNLOCK_WAIT_TIME);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
*
|
|
54
|
+
* @param {import('../types').UnlockType} unlockType
|
|
55
|
+
* @returns {string}
|
|
56
|
+
*/
|
|
57
|
+
function toCredentialType(unlockType) {
|
|
58
|
+
const result = {
|
|
59
|
+
[exports.PIN_UNLOCK]: 'pin',
|
|
60
|
+
[exports.PIN_UNLOCK_KEY_EVENT]: 'pin',
|
|
61
|
+
[exports.PASSWORD_UNLOCK]: 'password',
|
|
62
|
+
[exports.PATTERN_UNLOCK]: 'pattern',
|
|
63
|
+
}[unlockType];
|
|
64
|
+
if (result) {
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
throw new Error(`Unlock type '${unlockType}' is not known`);
|
|
68
|
+
}
|
|
69
|
+
exports.toCredentialType = toCredentialType;
|
|
70
|
+
/**
|
|
71
|
+
* @template {AndroidDriverCaps} T
|
|
72
|
+
* @param {T} caps
|
|
73
|
+
* @returns {T}
|
|
74
|
+
*/
|
|
75
|
+
function validateUnlockCapabilities(caps) {
|
|
76
|
+
const { unlockKey, unlockType } = caps ?? {};
|
|
77
|
+
if (!isNonEmptyString(unlockType)) {
|
|
78
|
+
throw new Error('A non-empty unlock key value must be provided');
|
|
79
|
+
}
|
|
80
|
+
if ([exports.PIN_UNLOCK, exports.PIN_UNLOCK_KEY_EVENT, exports.FINGERPRINT_UNLOCK].includes(unlockType)) {
|
|
81
|
+
if (!/^[0-9]+$/.test(lodash_1.default.trim(unlockKey))) {
|
|
82
|
+
throw new Error(`Unlock key value '${unlockKey}' must only consist of digits`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else if (unlockType === exports.PATTERN_UNLOCK) {
|
|
86
|
+
if (!/^[1-9]{2,9}$/.test(lodash_1.default.trim(unlockKey))) {
|
|
87
|
+
throw new Error(`Unlock key value '${unlockKey}' must only include from two to nine digits in range 1..9`);
|
|
88
|
+
}
|
|
89
|
+
if (/([1-9]).*?\1/.test(lodash_1.default.trim(unlockKey))) {
|
|
90
|
+
throw new Error(`Unlock key value '${unlockKey}' must define a valid pattern where repeats are not allowed`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else if (unlockType === exports.PASSWORD_UNLOCK) {
|
|
94
|
+
// Dont trim password key, you can use blank spaces in your android password
|
|
95
|
+
// ¯\_(ツ)_/¯
|
|
96
|
+
if (!/.{4,}/g.test(String(unlockKey))) {
|
|
97
|
+
throw new Error(`The minimum allowed length of unlock key value '${unlockKey}' is 4 characters`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
throw new Error(`Invalid unlock type '${unlockType}'. ` +
|
|
102
|
+
`Only the following unlock types are supported: ${UNLOCK_TYPES}`);
|
|
103
|
+
}
|
|
104
|
+
return caps;
|
|
105
|
+
}
|
|
106
|
+
exports.validateUnlockCapabilities = validateUnlockCapabilities;
|
|
107
|
+
/**
|
|
108
|
+
* @this {AndroidDriver}
|
|
109
|
+
* @param {import('../types').FastUnlockOptions} opts
|
|
110
|
+
*/
|
|
111
|
+
async function fastUnlock(opts) {
|
|
112
|
+
const { credential, credentialType } = opts;
|
|
113
|
+
this.log.info(`Unlocking the device via ADB using ${credentialType} credential '${credential}'`);
|
|
114
|
+
const wasLockEnabled = await this.adb.isLockEnabled();
|
|
115
|
+
if (wasLockEnabled) {
|
|
116
|
+
await this.adb.clearLockCredential(credential);
|
|
117
|
+
// not sure why, but the device's screen still remains locked
|
|
118
|
+
// if a preliminary wake up cycle has not been performed
|
|
119
|
+
await this.adb.cycleWakeUp();
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
this.log.info('No active lock has been detected. Proceeding to the keyguard dismissal');
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
await this.adb.dismissKeyguard();
|
|
126
|
+
}
|
|
127
|
+
finally {
|
|
128
|
+
if (wasLockEnabled) {
|
|
129
|
+
await this.adb.setLockCredential(credentialType, credential);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
exports.fastUnlock = fastUnlock;
|
|
134
|
+
/**
|
|
135
|
+
*
|
|
136
|
+
* @param {string} key
|
|
137
|
+
* @returns {string}
|
|
138
|
+
*/
|
|
139
|
+
function encodePassword(key) {
|
|
140
|
+
return `${key}`.replace(/\s/gi, '%s');
|
|
141
|
+
}
|
|
142
|
+
exports.encodePassword = encodePassword;
|
|
143
|
+
/**
|
|
144
|
+
*
|
|
145
|
+
* @param {string} key
|
|
146
|
+
* @returns {string[]}
|
|
147
|
+
*/
|
|
148
|
+
function stringKeyToArr(key) {
|
|
149
|
+
return `${key}`.trim().replace(/\s+/g, '').split(/\s*/);
|
|
150
|
+
}
|
|
151
|
+
exports.stringKeyToArr = stringKeyToArr;
|
|
152
|
+
/**
|
|
153
|
+
* @this {AndroidDriver}
|
|
154
|
+
* @param {AndroidDriverCaps} capabilities
|
|
155
|
+
* @returns {Promise<void>}
|
|
156
|
+
*/
|
|
157
|
+
async function fingerprintUnlock(capabilities) {
|
|
158
|
+
if ((await this.adb.getApiLevel()) < 23) {
|
|
159
|
+
throw new Error('Fingerprint unlock only works for Android 6+ emulators');
|
|
160
|
+
}
|
|
161
|
+
await this.adb.fingerprint(String(capabilities.unlockKey));
|
|
162
|
+
await (0, asyncbox_1.sleep)(exports.UNLOCK_WAIT_TIME);
|
|
163
|
+
}
|
|
164
|
+
exports.fingerprintUnlock = fingerprintUnlock;
|
|
165
|
+
/**
|
|
166
|
+
* @this {AndroidDriver}
|
|
167
|
+
* @param {AndroidDriverCaps} capabilities
|
|
168
|
+
* @returns {Promise<void>}
|
|
169
|
+
*/
|
|
170
|
+
async function pinUnlock(capabilities) {
|
|
171
|
+
this.log.info(`Trying to unlock device using pin ${capabilities.unlockKey}`);
|
|
172
|
+
await this.adb.dismissKeyguard();
|
|
173
|
+
const keys = stringKeyToArr(String(capabilities.unlockKey));
|
|
174
|
+
if ((await this.adb.getApiLevel()) >= 21) {
|
|
175
|
+
const els = await this.findElOrEls('id', 'com.android.systemui:id/digit_text', true);
|
|
176
|
+
if (lodash_1.default.isEmpty(els)) {
|
|
177
|
+
// fallback to pin with key event
|
|
178
|
+
return await pinUnlockWithKeyEvent.bind(this)(capabilities);
|
|
179
|
+
}
|
|
180
|
+
const pins = {};
|
|
181
|
+
for (const el of els) {
|
|
182
|
+
const text = await this.getAttribute('text', support_1.util.unwrapElement(el));
|
|
183
|
+
pins[text] = el;
|
|
184
|
+
}
|
|
185
|
+
for (const pin of keys) {
|
|
186
|
+
const el = pins[pin];
|
|
187
|
+
await this.click(support_1.util.unwrapElement(el));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
for (const pin of keys) {
|
|
192
|
+
const el = await this.findElOrEls('id', `com.android.keyguard:id/key${pin}`, false);
|
|
193
|
+
if (el === null) {
|
|
194
|
+
// fallback to pin with key event
|
|
195
|
+
return await pinUnlockWithKeyEvent.bind(this)(capabilities);
|
|
196
|
+
}
|
|
197
|
+
await this.click(support_1.util.unwrapElement(el));
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
await waitForUnlock(this.adb);
|
|
201
|
+
}
|
|
202
|
+
exports.pinUnlock = pinUnlock;
|
|
203
|
+
/**
|
|
204
|
+
* @this {AndroidDriver}
|
|
205
|
+
* @param {AndroidDriverCaps} capabilities
|
|
206
|
+
* @returns {Promise<void>}
|
|
207
|
+
*/
|
|
208
|
+
async function pinUnlockWithKeyEvent(capabilities) {
|
|
209
|
+
this.log.info(`Trying to unlock device using pin with keycode ${capabilities.unlockKey}`);
|
|
210
|
+
await this.adb.dismissKeyguard();
|
|
211
|
+
const keys = stringKeyToArr(String(capabilities.unlockKey));
|
|
212
|
+
// Some device does not have system key ids like 'com.android.keyguard:id/key'
|
|
213
|
+
// Then, sending keyevents are more reliable to unlock the screen.
|
|
214
|
+
for (const pin of keys) {
|
|
215
|
+
// 'pin' is number (0-9) in string.
|
|
216
|
+
// Number '0' is keycode '7'. number '9' is keycode '16'.
|
|
217
|
+
await this.adb.shell(['input', 'keyevent', String(parseInt(pin, 10) + NUMBER_ZERO_KEYCODE)]);
|
|
218
|
+
}
|
|
219
|
+
await waitForUnlock(this.adb);
|
|
220
|
+
}
|
|
221
|
+
exports.pinUnlockWithKeyEvent = pinUnlockWithKeyEvent;
|
|
222
|
+
/**
|
|
223
|
+
* @this {AndroidDriver}
|
|
224
|
+
* @param {AndroidDriverCaps} capabilities
|
|
225
|
+
* @returns {Promise<void>}
|
|
226
|
+
*/
|
|
227
|
+
async function passwordUnlock(capabilities) {
|
|
228
|
+
const { unlockKey } = capabilities;
|
|
229
|
+
this.log.info(`Trying to unlock device using password ${unlockKey}`);
|
|
230
|
+
await this.adb.dismissKeyguard();
|
|
231
|
+
// Replace blank spaces with %s
|
|
232
|
+
const key = encodePassword(String(unlockKey));
|
|
233
|
+
// Why adb ? It was less flaky
|
|
234
|
+
await this.adb.shell(['input', 'text', key]);
|
|
235
|
+
// Why sleeps ? Avoid some flakyness waiting for the input to receive the keys
|
|
236
|
+
await (0, asyncbox_1.sleep)(exports.INPUT_KEYS_WAIT_TIME);
|
|
237
|
+
await this.adb.shell(['input', 'keyevent', String(exports.KEYCODE_NUMPAD_ENTER)]);
|
|
238
|
+
// Waits a bit for the device to be unlocked
|
|
239
|
+
await waitForUnlock(this.adb);
|
|
240
|
+
}
|
|
241
|
+
exports.passwordUnlock = passwordUnlock;
|
|
242
|
+
/**
|
|
243
|
+
*
|
|
244
|
+
* @param {number} key
|
|
245
|
+
* @param {import('@appium/types').Position} initPos
|
|
246
|
+
* @param {number} piece
|
|
247
|
+
* @returns {import('@appium/types').Position}
|
|
248
|
+
*/
|
|
249
|
+
function getPatternKeyPosition(key, initPos, piece) {
|
|
250
|
+
/*
|
|
251
|
+
How the math works:
|
|
252
|
+
We have 9 buttons divided in 3 columns and 3 rows inside the lockPatternView,
|
|
253
|
+
every button has a position on the screen corresponding to the lockPatternView since
|
|
254
|
+
it is the parent view right at the middle of each column or row.
|
|
255
|
+
*/
|
|
256
|
+
const cols = 3;
|
|
257
|
+
const pins = 9;
|
|
258
|
+
const xPos = (key, x, piece) => Math.round(x + (key % cols || cols) * piece - piece / 2);
|
|
259
|
+
const yPos = (key, y, piece) => Math.round(y + (Math.ceil((key % pins || pins) / cols) * piece - piece / 2));
|
|
260
|
+
return {
|
|
261
|
+
x: xPos(key, initPos.x, piece),
|
|
262
|
+
y: yPos(key, initPos.y, piece),
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
exports.getPatternKeyPosition = getPatternKeyPosition;
|
|
266
|
+
/**
|
|
267
|
+
* @param {string[]|number[]} keys
|
|
268
|
+
* @param {import('@appium/types').Position} initPos
|
|
269
|
+
* @param {number} piece
|
|
270
|
+
* @returns {import('../types').TouchAction[]}
|
|
271
|
+
*/
|
|
272
|
+
function getPatternActions(keys, initPos, piece) {
|
|
273
|
+
/** @type {import('../types').TouchAction[]} */
|
|
274
|
+
const actions = [];
|
|
275
|
+
/** @type {number[]} */
|
|
276
|
+
const intKeys = keys.map((key) => (lodash_1.default.isString(key) ? lodash_1.default.parseInt(key) : key));
|
|
277
|
+
/** @type {import('@appium/types').Position|undefined} */
|
|
278
|
+
let lastPos;
|
|
279
|
+
for (const key of intKeys) {
|
|
280
|
+
const keyPos = getPatternKeyPosition(key, initPos, piece);
|
|
281
|
+
if (!lastPos) {
|
|
282
|
+
actions.push({ action: 'press', options: { element: undefined, x: keyPos.x, y: keyPos.y } });
|
|
283
|
+
lastPos = keyPos;
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
const moveTo = { x: 0, y: 0 };
|
|
287
|
+
const diffX = keyPos.x - lastPos.x;
|
|
288
|
+
if (diffX > 0) {
|
|
289
|
+
moveTo.x = piece;
|
|
290
|
+
if (Math.abs(diffX) > piece) {
|
|
291
|
+
moveTo.x += piece;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
else if (diffX < 0) {
|
|
295
|
+
moveTo.x = -1 * piece;
|
|
296
|
+
if (Math.abs(diffX) > piece) {
|
|
297
|
+
moveTo.x -= piece;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
const diffY = keyPos.y - lastPos.y;
|
|
301
|
+
if (diffY > 0) {
|
|
302
|
+
moveTo.y = piece;
|
|
303
|
+
if (Math.abs(diffY) > piece) {
|
|
304
|
+
moveTo.y += piece;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
else if (diffY < 0) {
|
|
308
|
+
moveTo.y = -1 * piece;
|
|
309
|
+
if (Math.abs(diffY) > piece) {
|
|
310
|
+
moveTo.y -= piece;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
actions.push({
|
|
314
|
+
action: 'moveTo',
|
|
315
|
+
// @ts-ignore lastPos should be defined
|
|
316
|
+
options: { element: undefined, x: moveTo.x + lastPos.x, y: moveTo.y + lastPos.y },
|
|
317
|
+
});
|
|
318
|
+
lastPos = keyPos;
|
|
319
|
+
}
|
|
320
|
+
actions.push({ action: 'release' });
|
|
321
|
+
return actions;
|
|
322
|
+
}
|
|
323
|
+
exports.getPatternActions = getPatternActions;
|
|
324
|
+
/**
|
|
325
|
+
* @this {AndroidDriver}
|
|
326
|
+
* @param {number?} [timeoutMs=null]
|
|
327
|
+
*/
|
|
328
|
+
async function verifyUnlock(timeoutMs = null) {
|
|
329
|
+
try {
|
|
330
|
+
await (0, asyncbox_1.waitForCondition)(async () => !(await this.adb.isScreenLocked()), {
|
|
331
|
+
waitMs: timeoutMs ?? 2000,
|
|
332
|
+
intervalMs: 500,
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
catch (ign) {
|
|
336
|
+
throw new Error('The device has failed to be unlocked');
|
|
337
|
+
}
|
|
338
|
+
this.log.info('The device has been successfully unlocked');
|
|
339
|
+
}
|
|
340
|
+
exports.verifyUnlock = verifyUnlock;
|
|
341
|
+
/**
|
|
342
|
+
* @this {AndroidDriver}
|
|
343
|
+
* @param {AndroidDriverCaps} capabilities
|
|
344
|
+
*/
|
|
345
|
+
async function patternUnlock(capabilities) {
|
|
346
|
+
const { unlockKey } = capabilities;
|
|
347
|
+
this.log.info(`Trying to unlock device using pattern ${unlockKey}`);
|
|
348
|
+
await this.adb.dismissKeyguard();
|
|
349
|
+
const keys = stringKeyToArr(String(unlockKey));
|
|
350
|
+
/* We set the device pattern buttons as number of a regular phone
|
|
351
|
+
* | • • • | | 1 2 3 |
|
|
352
|
+
* | • • • | --> | 4 5 6 |
|
|
353
|
+
* | • • • | | 7 8 9 |
|
|
354
|
+
|
|
355
|
+
The pattern view buttons are not seeing by the uiautomator since they are
|
|
356
|
+
included inside a FrameLayout, so we are going to try clicking on the buttons
|
|
357
|
+
using the parent view bounds and math.
|
|
358
|
+
*/
|
|
359
|
+
const apiLevel = await this.adb.getApiLevel();
|
|
360
|
+
const el = await this.findElOrEls('id', `com.android.${apiLevel >= 21 ? 'systemui' : 'keyguard'}:id/lockPatternView`, false);
|
|
361
|
+
const initPos = await this.getLocation(support_1.util.unwrapElement(el));
|
|
362
|
+
const size = await this.getSize(support_1.util.unwrapElement(el));
|
|
363
|
+
// Get actions to perform
|
|
364
|
+
const actions = getPatternActions(keys, initPos, size.width / 3);
|
|
365
|
+
// Perform gesture
|
|
366
|
+
await this.performTouch(actions);
|
|
367
|
+
// Waits a bit for the device to be unlocked
|
|
368
|
+
await (0, asyncbox_1.sleep)(exports.UNLOCK_WAIT_TIME);
|
|
369
|
+
}
|
|
370
|
+
exports.patternUnlock = patternUnlock;
|
|
371
|
+
/**
|
|
372
|
+
* @typedef {import('@appium/types').Capabilities<import('../../constraints').AndroidDriverConstraints>} AndroidDriverCaps
|
|
373
|
+
* @typedef {import('../../driver').AndroidDriver} AndroidDriver
|
|
374
|
+
*/
|
|
375
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../lib/commands/lock/helpers.js"],"names":[],"mappings":";;;;;;AAAA,6CAAqC;AACrC,uCAAiD;AACjD,oDAAuB;AAEV,QAAA,UAAU,GAAG,KAAK,CAAC;AACnB,QAAA,oBAAoB,GAAG,iBAAiB,CAAC;AACzC,QAAA,eAAe,GAAG,UAAU,CAAC;AAC7B,QAAA,cAAc,GAAG,SAAS,CAAC;AAC3B,QAAA,kBAAkB,GAAG,aAAa,CAAC;AAChD,MAAM,YAAY,GAAG,qBAAqB,CAAC,CAAC;IAC1C,kBAAU;IACV,4BAAoB;IACpB,uBAAe;IACf,sBAAc;IACd,0BAAkB;CACnB,CAAC,CAAC;AACU,QAAA,oBAAoB,GAAG,EAAE,CAAC;AAC1B,QAAA,gBAAgB,GAAG,GAAG,CAAC;AACvB,QAAA,oBAAoB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
|
|
1
|
-
export default LogMixin;
|
|
2
|
-
export type ADB = import('appium-adb').ADB;
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Starts Android logcat broadcast websocket on the same host and port
|
|
3
|
+
* where Appium server is running at `/ws/session/:sessionId:/appium/logcat` endpoint. The method
|
|
4
|
+
* will return immediately if the web socket is already listening.
|
|
5
|
+
*
|
|
6
|
+
* Each connected websocket listener will receive logcat log lines
|
|
7
|
+
* as soon as they are visible to Appium.
|
|
8
|
+
*
|
|
9
|
+
* @this {import('../driver').AndroidDriver}
|
|
10
|
+
* @returns {Promise<void>}
|
|
11
|
+
*/
|
|
12
|
+
export function mobileStartLogsBroadcast(this: import("../driver").AndroidDriver): Promise<void>;
|
|
13
|
+
export class mobileStartLogsBroadcast {
|
|
14
|
+
_logcatWebsocketListener: ((logRecord: import("appium-adb").LogcatRecord) => void) | undefined;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Stops the previously started logcat broadcasting wesocket server.
|
|
18
|
+
* This method will return immediately if no server is running.
|
|
19
|
+
*
|
|
20
|
+
* @this {import('../driver').AndroidDriver}
|
|
21
|
+
* @returns {Promise<void>}
|
|
22
|
+
*/
|
|
23
|
+
export function mobileStopLogsBroadcast(this: import("../driver").AndroidDriver): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* @this {import('../driver').AndroidDriver}
|
|
26
|
+
* @returns {Promise<string[]>}
|
|
27
|
+
*/
|
|
28
|
+
export function getLogTypes(this: import("../driver").AndroidDriver): Promise<string[]>;
|
|
29
|
+
/**
|
|
30
|
+
* @this {import('../driver').AndroidDriver}
|
|
31
|
+
* @param {string} logType
|
|
32
|
+
* @returns {Promise<any>}
|
|
6
33
|
*/
|
|
7
|
-
|
|
34
|
+
export function getLog(this: import("../driver").AndroidDriver, logType: string): Promise<any>;
|
|
35
|
+
export namespace supportedLogTypes {
|
|
36
|
+
namespace logcat {
|
|
37
|
+
let description: string;
|
|
38
|
+
function getter(self: import("../driver").AndroidDriver): string[];
|
|
39
|
+
}
|
|
40
|
+
namespace bugreport {
|
|
41
|
+
let description_1: string;
|
|
42
|
+
export { description_1 as description };
|
|
43
|
+
export function getter_1(self: import("../driver").AndroidDriver): Promise<{
|
|
44
|
+
timestamp: number;
|
|
45
|
+
level: string;
|
|
46
|
+
message: string;
|
|
47
|
+
}[]>;
|
|
48
|
+
export { getter_1 as getter };
|
|
49
|
+
}
|
|
50
|
+
namespace server {
|
|
51
|
+
let description_2: string;
|
|
52
|
+
export { description_2 as description };
|
|
53
|
+
export function getter_2(self: import("../driver").AndroidDriver): {
|
|
54
|
+
timestamp: number;
|
|
55
|
+
level: string;
|
|
56
|
+
message: string;
|
|
57
|
+
}[];
|
|
58
|
+
export { getter_2 as getter };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export type ADB = import('appium-adb').ADB;
|
|
8
62
|
//# sourceMappingURL=log.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../lib/commands/log.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../lib/commands/log.js"],"names":[],"mappings":"AAqDA;;;;;;;;;;GAUG;AACH,mFAFa,QAAQ,IAAI,CAAC,CAwDzB;;IA3BK,+FAIC;;AAyBP;;;;;;GAMG;AACH,kFAFa,QAAQ,IAAI,CAAC,CAczB;AAED;;;GAGG;AACH,sEAFa,QAAQ,MAAM,EAAE,CAAC,CAc7B;AAED;;;;GAIG;AACH,yEAHW,MAAM,GACJ,QAAQ,GAAG,CAAC,CAUxB;;;;QA7JW,mEAAuD;;;;;QASvD;;;;aAIP;;;;;;QASO;;;;YAYP;;;;kBAwJQ,OAAO,YAAY,EAAE,GAAG"}
|