appium-android-driver 15.0.0-beta.2 → 15.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 +38 -8
- package/build/lib/commands/app-management.d.ts +26 -0
- package/build/lib/commands/app-management.d.ts.map +1 -1
- package/build/lib/commands/app-management.js +4 -3
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/appearance.d.ts +7 -0
- package/build/lib/commands/appearance.d.ts.map +1 -1
- package/build/lib/commands/appearance.js.map +1 -1
- package/build/lib/commands/bluetooth.d.ts +6 -0
- package/build/lib/commands/bluetooth.d.ts.map +1 -1
- package/build/lib/commands/bluetooth.js +1 -1
- package/build/lib/commands/bluetooth.js.map +1 -1
- package/build/lib/commands/context/exports.d.ts +25 -0
- package/build/lib/commands/context/exports.d.ts.map +1 -1
- package/build/lib/commands/context/exports.js +10 -6
- package/build/lib/commands/context/exports.js.map +1 -1
- package/build/lib/commands/device/common.d.ts +9 -0
- package/build/lib/commands/device/common.d.ts.map +1 -1
- package/build/lib/commands/device/common.js +1 -1
- package/build/lib/commands/device/common.js.map +1 -1
- package/build/lib/commands/device/emulator-actions.d.ts +22 -0
- package/build/lib/commands/device/emulator-actions.d.ts.map +1 -1
- package/build/lib/commands/device/emulator-actions.js.map +1 -1
- package/build/lib/commands/device/emulator-console.d.ts +6 -0
- package/build/lib/commands/device/emulator-console.d.ts.map +1 -1
- package/build/lib/commands/device/emulator-console.js.map +1 -1
- package/build/lib/commands/device/utils.js +3 -3
- package/build/lib/commands/device/utils.js.map +1 -1
- package/build/lib/commands/deviceidle.d.ts +6 -0
- package/build/lib/commands/deviceidle.d.ts.map +1 -1
- package/build/lib/commands/deviceidle.js +1 -1
- package/build/lib/commands/deviceidle.js.map +1 -1
- package/build/lib/commands/element.d.ts +20 -0
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js +0 -1
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/execute.d.ts +6 -0
- package/build/lib/commands/execute.d.ts.map +1 -1
- package/build/lib/commands/execute.js.map +1 -1
- package/build/lib/commands/file-actions.d.ts +9 -0
- package/build/lib/commands/file-actions.d.ts.map +1 -1
- package/build/lib/commands/file-actions.js.map +1 -1
- package/build/lib/commands/find.d.ts +8 -0
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/commands/geolocation.d.ts +13 -0
- package/build/lib/commands/geolocation.d.ts.map +1 -1
- package/build/lib/commands/geolocation.js +2 -2
- package/build/lib/commands/geolocation.js.map +1 -1
- package/build/lib/commands/gestures.d.ts +6 -0
- package/build/lib/commands/gestures.d.ts.map +1 -1
- package/build/lib/commands/gestures.js.map +1 -1
- package/build/lib/commands/image-injection.d.ts +6 -0
- package/build/lib/commands/image-injection.d.ts.map +1 -1
- package/build/lib/commands/image-injection.js.map +1 -1
- package/build/lib/commands/ime.d.ts +11 -0
- package/build/lib/commands/ime.d.ts.map +1 -1
- package/build/lib/commands/ime.js.map +1 -1
- package/build/lib/commands/intent.d.ts +10 -0
- package/build/lib/commands/intent.d.ts.map +1 -1
- package/build/lib/commands/intent.js +4 -4
- package/build/lib/commands/intent.js.map +1 -1
- package/build/lib/commands/keyboard.d.ts +12 -0
- package/build/lib/commands/keyboard.d.ts.map +1 -1
- package/build/lib/commands/keyboard.js.map +1 -1
- package/build/lib/commands/legacy.d.ts +8 -0
- package/build/lib/commands/legacy.d.ts.map +1 -1
- package/build/lib/commands/legacy.js.map +1 -1
- package/build/lib/commands/lock/exports.d.ts +9 -0
- package/build/lib/commands/lock/exports.d.ts.map +1 -1
- package/build/lib/commands/lock/exports.js.map +1 -1
- package/build/lib/commands/lock/helpers.js +1 -1
- package/build/lib/commands/lock/helpers.js.map +1 -1
- package/build/lib/commands/log.d.ts +8 -13
- package/build/lib/commands/log.d.ts.map +1 -1
- package/build/lib/commands/log.js +4 -32
- package/build/lib/commands/log.js.map +1 -1
- package/build/lib/commands/media-projection.d.ts +8 -0
- package/build/lib/commands/media-projection.d.ts.map +1 -1
- package/build/lib/commands/media-projection.js.map +1 -1
- package/build/lib/commands/memory.d.ts +6 -0
- package/build/lib/commands/memory.d.ts.map +1 -1
- package/build/lib/commands/memory.js.map +1 -1
- package/build/lib/commands/misc.d.ts +12 -0
- package/build/lib/commands/misc.d.ts.map +1 -1
- package/build/lib/commands/misc.js.map +1 -1
- package/build/lib/commands/network.d.ts +15 -0
- package/build/lib/commands/network.d.ts.map +1 -1
- package/build/lib/commands/network.js +2 -2
- package/build/lib/commands/network.js.map +1 -1
- package/build/lib/commands/nfc.d.ts +6 -0
- package/build/lib/commands/nfc.d.ts.map +1 -1
- package/build/lib/commands/nfc.js +1 -1
- package/build/lib/commands/nfc.js.map +1 -1
- package/build/lib/commands/performance.d.ts +8 -0
- package/build/lib/commands/performance.d.ts.map +1 -1
- package/build/lib/commands/performance.js.map +1 -1
- package/build/lib/commands/permissions.d.ts +7 -0
- package/build/lib/commands/permissions.d.ts.map +1 -1
- package/build/lib/commands/permissions.js +3 -3
- package/build/lib/commands/permissions.js.map +1 -1
- package/build/lib/commands/recordscreen.d.ts +7 -0
- package/build/lib/commands/recordscreen.d.ts.map +1 -1
- package/build/lib/commands/recordscreen.js.map +1 -1
- package/build/lib/commands/resources.d.ts +7 -0
- package/build/lib/commands/resources.d.ts.map +1 -1
- package/build/lib/commands/resources.js +1 -1
- package/build/lib/commands/resources.js.map +1 -1
- package/build/lib/commands/shell.d.ts +9 -0
- package/build/lib/commands/shell.d.ts.map +1 -1
- package/build/lib/commands/shell.js.map +1 -1
- package/build/lib/commands/streamscreen.d.ts +7 -0
- package/build/lib/commands/streamscreen.d.ts.map +1 -1
- package/build/lib/commands/streamscreen.js.map +1 -1
- package/build/lib/commands/system-bars.d.ts +7 -0
- package/build/lib/commands/system-bars.d.ts.map +1 -1
- package/build/lib/commands/system-bars.js +2 -2
- package/build/lib/commands/system-bars.js.map +1 -1
- package/build/lib/commands/time.d.ts +7 -0
- package/build/lib/commands/time.d.ts.map +1 -1
- package/build/lib/commands/time.js.map +1 -1
- package/build/lib/constraints.d.ts +16 -3
- package/build/lib/constraints.d.ts.map +1 -1
- package/build/lib/constraints.js +16 -3
- package/build/lib/constraints.js.map +1 -1
- package/build/lib/driver.d.ts +36 -201
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +253 -168
- package/build/lib/driver.js.map +1 -1
- package/build/lib/utils.js +1 -1
- package/build/lib/utils.js.map +1 -1
- package/lib/commands/app-management.ts +33 -3
- package/lib/commands/appearance.ts +8 -0
- package/lib/commands/bluetooth.ts +8 -1
- package/lib/commands/context/exports.ts +46 -6
- package/lib/commands/device/common.ts +11 -1
- package/lib/commands/device/emulator-actions.ts +23 -0
- package/lib/commands/device/emulator-console.ts +9 -0
- package/lib/commands/device/utils.ts +3 -3
- package/lib/commands/deviceidle.ts +8 -1
- package/lib/commands/element.ts +21 -0
- package/lib/commands/execute.ts +7 -0
- package/lib/commands/file-actions.ts +10 -0
- package/lib/commands/find.ts +9 -0
- package/lib/commands/geolocation.ts +22 -2
- package/lib/commands/gestures.ts +7 -0
- package/lib/commands/image-injection.ts +9 -0
- package/lib/commands/ime.ts +12 -0
- package/lib/commands/intent.ts +25 -4
- package/lib/commands/keyboard.ts +15 -0
- package/lib/commands/legacy.ts +9 -0
- package/lib/commands/lock/exports.ts +10 -0
- package/lib/commands/lock/helpers.ts +1 -1
- package/lib/commands/log.ts +20 -35
- package/lib/commands/media-projection.ts +15 -0
- package/lib/commands/memory.ts +7 -0
- package/lib/commands/misc.ts +15 -0
- package/lib/commands/network.ts +18 -2
- package/lib/commands/nfc.ts +8 -1
- package/lib/commands/performance.ts +13 -0
- package/lib/commands/permissions.ts +15 -3
- package/lib/commands/recordscreen.ts +8 -0
- package/lib/commands/resources.ts +9 -1
- package/lib/commands/shell.ts +12 -0
- package/lib/commands/streamscreen.ts +12 -0
- package/lib/commands/system-bars.ts +12 -2
- package/lib/commands/time.ts +8 -0
- package/lib/constraints.ts +16 -3
- package/lib/driver.ts +289 -212
- package/lib/utils.ts +1 -1
- package/package.json +1 -1
|
@@ -6,9 +6,24 @@ import type {HTTPMethod, StringRecord} from '@appium/types';
|
|
|
6
6
|
import type {ADB} from 'appium-adb';
|
|
7
7
|
import dayjs from 'dayjs';
|
|
8
8
|
|
|
9
|
+
import type {AndroidDriverConstraints} from '../constraints.js';
|
|
9
10
|
import type {AndroidDriver} from '../driver.js';
|
|
10
11
|
import type {FormFields} from './types.js';
|
|
11
12
|
|
|
13
|
+
declare module '../driver.js' {
|
|
14
|
+
interface AndroidDriver<C extends AndroidDriverConstraints> {
|
|
15
|
+
mobileIsMediaProjectionRecordingRunning(
|
|
16
|
+
...args: Parameters<typeof mobileIsMediaProjectionRecordingRunning>
|
|
17
|
+
): ReturnType<typeof mobileIsMediaProjectionRecordingRunning>;
|
|
18
|
+
mobileStartMediaProjectionRecording(
|
|
19
|
+
...args: Parameters<typeof mobileStartMediaProjectionRecording>
|
|
20
|
+
): ReturnType<typeof mobileStartMediaProjectionRecording>;
|
|
21
|
+
mobileStopMediaProjectionRecording(
|
|
22
|
+
...args: Parameters<typeof mobileStopMediaProjectionRecording>
|
|
23
|
+
): ReturnType<typeof mobileStopMediaProjectionRecording>;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
12
27
|
// https://github.com/appium/io.appium.settings#internal-audio--video-recording
|
|
13
28
|
const DEFAULT_EXT = '.mp4';
|
|
14
29
|
const MIN_API_LEVEL = 29;
|
package/lib/commands/memory.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import {errors} from 'appium/driver.js';
|
|
2
2
|
|
|
3
|
+
import type {AndroidDriverConstraints} from '../constraints.js';
|
|
3
4
|
import type {AndroidDriver} from '../driver.js';
|
|
4
5
|
import type {TrimMemoryLevel} from './types.js';
|
|
5
6
|
|
|
7
|
+
declare module '../driver.js' {
|
|
8
|
+
interface AndroidDriver<C extends AndroidDriverConstraints> {
|
|
9
|
+
mobileSendTrimMemory(...args: Parameters<typeof mobileSendTrimMemory>): ReturnType<typeof mobileSendTrimMemory>;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
6
13
|
/**
|
|
7
14
|
* Simulates the onTrimMemory() event for the given package.
|
|
8
15
|
* Read https://developer.android.com/topic/performance/memory
|
package/lib/commands/misc.ts
CHANGED
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
import type {Size, Rect, StringRecord} from '@appium/types';
|
|
2
2
|
import {errors} from 'appium/driver.js';
|
|
3
3
|
|
|
4
|
+
import type {AndroidDriverConstraints} from '../constraints.js';
|
|
4
5
|
import type {AndroidDriver} from '../driver.js';
|
|
5
6
|
import type {SmsListResult, ListSmsOpts} from './types.js';
|
|
6
7
|
|
|
8
|
+
declare module '../driver.js' {
|
|
9
|
+
interface AndroidDriver<C extends AndroidDriverConstraints> {
|
|
10
|
+
getWindowRect(...args: Parameters<typeof getWindowRect>): ReturnType<typeof getWindowRect>;
|
|
11
|
+
getWindowSize(...args: Parameters<typeof getWindowSize>): ReturnType<typeof getWindowSize>;
|
|
12
|
+
getDisplayDensity(...args: Parameters<typeof getDisplayDensity>): ReturnType<typeof getDisplayDensity>;
|
|
13
|
+
mobileGetNotifications(
|
|
14
|
+
...args: Parameters<typeof mobileGetNotifications>
|
|
15
|
+
): ReturnType<typeof mobileGetNotifications>;
|
|
16
|
+
mobileListSms(...args: Parameters<typeof mobileListSms>): ReturnType<typeof mobileListSms>;
|
|
17
|
+
openNotifications(...args: Parameters<typeof openNotifications>): ReturnType<typeof openNotifications>;
|
|
18
|
+
setUrl(...args: Parameters<typeof setUrl>): ReturnType<typeof setUrl>;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
7
22
|
/**
|
|
8
23
|
* Gets the window size.
|
|
9
24
|
*
|
package/lib/commands/network.ts
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
import {util} from '@appium/support';
|
|
2
2
|
import {errors} from 'appium/driver.js';
|
|
3
3
|
|
|
4
|
+
import type {AndroidDriverConstraints} from '../constraints.js';
|
|
4
5
|
import type {AndroidDriver} from '../driver.js';
|
|
5
6
|
import type {ServiceType, GetConnectivityResult} from './types.js';
|
|
6
7
|
|
|
8
|
+
declare module '../driver.js' {
|
|
9
|
+
interface AndroidDriver<C extends AndroidDriverConstraints> {
|
|
10
|
+
getNetworkConnection(...args: Parameters<typeof getNetworkConnection>): ReturnType<typeof getNetworkConnection>;
|
|
11
|
+
isWifiOn(...args: Parameters<typeof isWifiOn>): ReturnType<typeof isWifiOn>;
|
|
12
|
+
mobileGetConnectivity(...args: Parameters<typeof mobileGetConnectivity>): ReturnType<typeof mobileGetConnectivity>;
|
|
13
|
+
mobileSetConnectivity(...args: Parameters<typeof mobileSetConnectivity>): ReturnType<typeof mobileSetConnectivity>;
|
|
14
|
+
setNetworkConnection(...args: Parameters<typeof setNetworkConnection>): ReturnType<typeof setNetworkConnection>;
|
|
15
|
+
setWifiState(...args: Parameters<typeof setWifiState>): ReturnType<typeof setWifiState>;
|
|
16
|
+
setDataState(...args: Parameters<typeof setDataState>): ReturnType<typeof setDataState>;
|
|
17
|
+
toggleData(...args: Parameters<typeof toggleData>): ReturnType<typeof toggleData>;
|
|
18
|
+
toggleFlightMode(...args: Parameters<typeof toggleFlightMode>): ReturnType<typeof toggleFlightMode>;
|
|
19
|
+
toggleWiFi(...args: Parameters<typeof toggleWiFi>): ReturnType<typeof toggleWiFi>;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
7
23
|
const AIRPLANE_MODE_MASK = 0b001;
|
|
8
24
|
const WIFI_MASK = 0b010;
|
|
9
25
|
const DATA_MASK = 0b100;
|
|
@@ -120,9 +136,9 @@ export async function mobileGetConnectivity(
|
|
|
120
136
|
const unsupportedServices = svcs.filter((svc) => !SUPPORTED_SERVICE_NAMES.includes(svc));
|
|
121
137
|
if (unsupportedServices.length > 0) {
|
|
122
138
|
throw new errors.InvalidArgumentError(
|
|
123
|
-
`${util.pluralize('Service name', unsupportedServices.length, false)} ${unsupportedServices} ` +
|
|
139
|
+
`${util.pluralize('Service name', unsupportedServices.length, false)} ${unsupportedServices.join(', ')} ` +
|
|
124
140
|
`${unsupportedServices.length === 1 ? 'is' : 'are'} not known. Only the following services are ` +
|
|
125
|
-
`suported: ${SUPPORTED_SERVICE_NAMES}`,
|
|
141
|
+
`suported: ${SUPPORTED_SERVICE_NAMES.join(', ')}`,
|
|
126
142
|
);
|
|
127
143
|
}
|
|
128
144
|
|
package/lib/commands/nfc.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import {errors} from 'appium/driver.js';
|
|
2
2
|
|
|
3
|
+
import type {AndroidDriverConstraints} from '../constraints.js';
|
|
3
4
|
import type {AndroidDriver} from '../driver.js';
|
|
4
5
|
import type {NfcAction} from './types.js';
|
|
5
6
|
|
|
7
|
+
declare module '../driver.js' {
|
|
8
|
+
interface AndroidDriver<C extends AndroidDriverConstraints> {
|
|
9
|
+
mobileNfc(...args: Parameters<typeof mobileNfc>): ReturnType<typeof mobileNfc>;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
6
13
|
const SUPPORTED_ACTIONS = {
|
|
7
14
|
ENABLE: 'enable',
|
|
8
15
|
DISABLE: 'disable',
|
|
@@ -27,7 +34,7 @@ export async function mobileNfc(this: AndroidDriver, action: NfcAction): Promise
|
|
|
27
34
|
break;
|
|
28
35
|
default:
|
|
29
36
|
throw new errors.InvalidArgumentError(
|
|
30
|
-
`You must provide a valid 'action' argument. Supported actions are: ${Object.values(SUPPORTED_ACTIONS)}`,
|
|
37
|
+
`You must provide a valid 'action' argument. Supported actions are: ${Object.values(SUPPORTED_ACTIONS).join(', ')}`,
|
|
31
38
|
);
|
|
32
39
|
}
|
|
33
40
|
}
|
|
@@ -2,9 +2,22 @@ import {util} from '@appium/support';
|
|
|
2
2
|
import {retryInterval} from 'asyncbox';
|
|
3
3
|
import type {ExecError} from 'teen_process';
|
|
4
4
|
|
|
5
|
+
import type {AndroidDriverConstraints} from '../constraints.js';
|
|
5
6
|
import type {AndroidDriver} from '../driver.js';
|
|
6
7
|
import type {PerformanceDataType} from './types.js';
|
|
7
8
|
|
|
9
|
+
declare module '../driver.js' {
|
|
10
|
+
interface AndroidDriver<C extends AndroidDriverConstraints> {
|
|
11
|
+
getPerformanceData(...args: Parameters<typeof getPerformanceData>): ReturnType<typeof getPerformanceData>;
|
|
12
|
+
getPerformanceDataTypes(
|
|
13
|
+
...args: Parameters<typeof getPerformanceDataTypes>
|
|
14
|
+
): ReturnType<typeof getPerformanceDataTypes>;
|
|
15
|
+
mobileGetPerformanceData(
|
|
16
|
+
...args: Parameters<typeof mobileGetPerformanceData>
|
|
17
|
+
): ReturnType<typeof mobileGetPerformanceData>;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
8
21
|
export const NETWORK_KEYS = [
|
|
9
22
|
['bucketStart', 'activeTime', 'rxBytes', 'rxPackets', 'txBytes', 'txPackets', 'operations', 'bucketDuration'],
|
|
10
23
|
['st', 'activeTime', 'rb', 'rp', 'tb', 'tp', 'op', 'bucketDuration'],
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import {util} from '@appium/support';
|
|
2
2
|
import {errors} from 'appium/driver.js';
|
|
3
3
|
|
|
4
|
+
import type {AndroidDriverConstraints} from '../constraints.js';
|
|
4
5
|
import type {AndroidDriver} from '../driver.js';
|
|
5
6
|
import {ADB_SHELL_FEATURE} from '../utils.js';
|
|
6
7
|
|
|
8
|
+
declare module '../driver.js' {
|
|
9
|
+
interface AndroidDriver<C extends AndroidDriverConstraints> {
|
|
10
|
+
mobileChangePermissions(
|
|
11
|
+
...args: Parameters<typeof mobileChangePermissions>
|
|
12
|
+
): ReturnType<typeof mobileChangePermissions>;
|
|
13
|
+
mobileGetPermissions(...args: Parameters<typeof mobileGetPermissions>): ReturnType<typeof mobileGetPermissions>;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
7
17
|
const ALL_PERMISSIONS_MAGIC = 'all';
|
|
8
18
|
const PM_ACTION = Object.freeze({
|
|
9
19
|
GRANT: 'grant',
|
|
@@ -87,7 +97,9 @@ export async function mobileChangePermissions(
|
|
|
87
97
|
action?.toLowerCase() as AppOpsAction,
|
|
88
98
|
);
|
|
89
99
|
default:
|
|
90
|
-
throw new errors.InvalidArgumentError(
|
|
100
|
+
throw new errors.InvalidArgumentError(
|
|
101
|
+
`'target' argument must be one of: ${Object.values(PERMISSION_TARGET).join(', ')}`,
|
|
102
|
+
);
|
|
91
103
|
}
|
|
92
104
|
}
|
|
93
105
|
/**
|
|
@@ -138,7 +150,7 @@ async function changePermissionsViaPm(
|
|
|
138
150
|
|
|
139
151
|
let affectedPermissions = Array.isArray(permissions) ? permissions : [permissions];
|
|
140
152
|
if (typeof permissions === 'string' && permissions.toLowerCase() === ALL_PERMISSIONS_MAGIC) {
|
|
141
|
-
const dumpsys = await this.adb.shell(['dumpsys', 'package', appPackage]);
|
|
153
|
+
const dumpsys = await this.adb.shell(['dumpsys', 'package', util.quote(appPackage)]);
|
|
142
154
|
const grantedPermissions = await this.adb.getGrantedPermissions(appPackage, dumpsys);
|
|
143
155
|
if (action === PM_ACTION.GRANT) {
|
|
144
156
|
const reqPermissons = await this.adb.getReqPermissions(appPackage, dumpsys);
|
|
@@ -178,7 +190,7 @@ async function changePermissionsViaAppops(
|
|
|
178
190
|
}
|
|
179
191
|
|
|
180
192
|
const promises = (Array.isArray(permissions) ? permissions : [permissions]).map((permission) =>
|
|
181
|
-
this.adb.shell(['appops', 'set', appPackage, permission, action]),
|
|
193
|
+
this.adb.shell(['appops', 'set', util.quote(appPackage), util.quote(permission), action]),
|
|
182
194
|
);
|
|
183
195
|
await Promise.all(promises);
|
|
184
196
|
}
|
|
@@ -6,9 +6,17 @@ import type {ADB} from 'appium-adb';
|
|
|
6
6
|
import {waitForCondition} from 'asyncbox';
|
|
7
7
|
import {exec} from 'teen_process';
|
|
8
8
|
|
|
9
|
+
import type {AndroidDriverConstraints} from '../constraints.js';
|
|
9
10
|
import type {AndroidDriver} from '../driver.js';
|
|
10
11
|
import type {StartScreenRecordingOpts, StopScreenRecordingOpts, ScreenRecordingProperties} from './types.js';
|
|
11
12
|
|
|
13
|
+
declare module '../driver.js' {
|
|
14
|
+
interface AndroidDriver<C extends AndroidDriverConstraints> {
|
|
15
|
+
startRecordingScreen(...args: Parameters<typeof startRecordingScreen>): ReturnType<typeof startRecordingScreen>;
|
|
16
|
+
stopRecordingScreen(...args: Parameters<typeof stopRecordingScreen>): ReturnType<typeof stopRecordingScreen>;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
12
20
|
const RETRY_PAUSE = 300;
|
|
13
21
|
const RETRY_TIMEOUT = 5000;
|
|
14
22
|
const MAX_RECORDING_TIME_SEC = 60 * 3;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import {fs, tempDir, util} from '@appium/support';
|
|
2
2
|
import type {StringRecord} from '@appium/types';
|
|
3
3
|
|
|
4
|
+
import type {AndroidDriverConstraints} from '../constraints.js';
|
|
4
5
|
import type {AndroidDriver, AndroidDriverOpts} from '../driver.js';
|
|
5
6
|
import type {Locale} from './types.js';
|
|
6
7
|
|
|
8
|
+
declare module '../driver.js' {
|
|
9
|
+
interface AndroidDriver<C extends AndroidDriverConstraints> {
|
|
10
|
+
getStrings(...args: Parameters<typeof getStrings>): ReturnType<typeof getStrings>;
|
|
11
|
+
ensureDeviceLocale(...args: Parameters<typeof ensureDeviceLocale>): ReturnType<typeof ensureDeviceLocale>;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
7
15
|
/**
|
|
8
16
|
* Gets the localized strings from the application.
|
|
9
17
|
*
|
|
@@ -68,7 +76,7 @@ export async function ensureDeviceLocale(
|
|
|
68
76
|
this.log.debug((e1 as Error).stack);
|
|
69
77
|
}
|
|
70
78
|
if (suggestions.length > 0) {
|
|
71
|
-
errMsg += ` You may want to apply one of the following locales instead: ${suggestions}`;
|
|
79
|
+
errMsg += ` You may want to apply one of the following locales instead: ${suggestions.join(', ')}`;
|
|
72
80
|
}
|
|
73
81
|
throw new Error(errMsg, {cause: e});
|
|
74
82
|
}
|
package/lib/commands/shell.ts
CHANGED
|
@@ -3,9 +3,21 @@ import {errors} from 'appium/driver.js';
|
|
|
3
3
|
import {exec} from 'teen_process';
|
|
4
4
|
import type {ExecError} from 'teen_process';
|
|
5
5
|
|
|
6
|
+
import type {AndroidDriverConstraints} from '../constraints.js';
|
|
6
7
|
import type {AndroidDriver} from '../driver.js';
|
|
7
8
|
import {ADB_SHELL_FEATURE} from '../utils.js';
|
|
8
9
|
|
|
10
|
+
declare module '../driver.js' {
|
|
11
|
+
interface AndroidDriver<C extends AndroidDriverConstraints> {
|
|
12
|
+
mobileShell<T extends boolean>(
|
|
13
|
+
command: string,
|
|
14
|
+
args?: string[],
|
|
15
|
+
timeout?: number,
|
|
16
|
+
includeStderr?: T,
|
|
17
|
+
): Promise<T extends true ? {stdout: string; stderr: string} : string>;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
9
21
|
/**
|
|
10
22
|
* Executes a shell command on the device via ADB.
|
|
11
23
|
*
|
|
@@ -10,9 +10,21 @@ import {waitForCondition} from 'asyncbox';
|
|
|
10
10
|
import {checkPortStatus} from 'portscanner';
|
|
11
11
|
import {SubProcess, exec} from 'teen_process';
|
|
12
12
|
|
|
13
|
+
import type {AndroidDriverConstraints} from '../constraints.js';
|
|
13
14
|
import type {AndroidDriver} from '../driver.js';
|
|
14
15
|
import type {DeviceInfo, InitGStreamerPipelineOpts} from './types.js';
|
|
15
16
|
|
|
17
|
+
declare module '../driver.js' {
|
|
18
|
+
interface AndroidDriver<C extends AndroidDriverConstraints> {
|
|
19
|
+
mobileStartScreenStreaming(
|
|
20
|
+
...args: Parameters<typeof mobileStartScreenStreaming>
|
|
21
|
+
): ReturnType<typeof mobileStartScreenStreaming>;
|
|
22
|
+
mobileStopScreenStreaming(
|
|
23
|
+
...args: Parameters<typeof mobileStopScreenStreaming>
|
|
24
|
+
): ReturnType<typeof mobileStopScreenStreaming>;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
16
28
|
const RECORDING_INTERVAL_SEC = 5;
|
|
17
29
|
const STREAMING_STARTUP_TIMEOUT_MS = 5000;
|
|
18
30
|
const GSTREAMER_BINARY = `gst-launch-1.0${system.isWindows() ? '.exe' : ''}`;
|
|
@@ -2,9 +2,19 @@ import {util} from '@appium/support';
|
|
|
2
2
|
import type {StringRecord} from '@appium/types';
|
|
3
3
|
import {errors} from 'appium/driver.js';
|
|
4
4
|
|
|
5
|
+
import type {AndroidDriverConstraints} from '../constraints.js';
|
|
5
6
|
import type {AndroidDriver} from '../driver.js';
|
|
6
7
|
import type {StatusBarCommand, WindowProperties} from './types.js';
|
|
7
8
|
|
|
9
|
+
declare module '../driver.js' {
|
|
10
|
+
interface AndroidDriver<C extends AndroidDriverConstraints> {
|
|
11
|
+
getSystemBars(...args: Parameters<typeof getSystemBars>): ReturnType<typeof getSystemBars>;
|
|
12
|
+
mobilePerformStatusBarCommand(
|
|
13
|
+
...args: Parameters<typeof mobilePerformStatusBarCommand>
|
|
14
|
+
): ReturnType<typeof mobilePerformStatusBarCommand>;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
8
18
|
const WINDOW_TITLE_PATTERN = /^\s+Window\s#\d+\sWindow\{[0-9a-f]+\s\w+\s([\w-]+)\}:$/;
|
|
9
19
|
const FRAME_PATTERN = /\bm?[Ff]rame=\[([0-9.-]+),([0-9.-]+)\]\[([0-9.-]+),([0-9.-]+)\]/;
|
|
10
20
|
// https://github.com/appium/appium-uiautomator2-driver/issues/904
|
|
@@ -88,7 +98,7 @@ export async function mobilePerformStatusBarCommand(
|
|
|
88
98
|
if (!action) {
|
|
89
99
|
throw new errors.InvalidArgumentError(
|
|
90
100
|
`The '${command}' status bar command is unknown. Only the following commands ` +
|
|
91
|
-
`are supported: ${Object.keys(statusBarCommands)}`,
|
|
101
|
+
`are supported: ${Object.keys(statusBarCommands).join(', ')}`,
|
|
92
102
|
);
|
|
93
103
|
}
|
|
94
104
|
return await action();
|
|
@@ -181,7 +191,7 @@ export function parseWindows(this: AndroidDriver, lines: string): SystemBarsResu
|
|
|
181
191
|
this.log.info(
|
|
182
192
|
`No windows have been found whose title matches to ` +
|
|
183
193
|
`'${namePrefix}'. Assuming it is invisible. ` +
|
|
184
|
-
`Only the following windows are available: ${Object.keys(windows)}`,
|
|
194
|
+
`Only the following windows are available: ${Object.keys(windows).join(', ')}`,
|
|
185
195
|
);
|
|
186
196
|
result[window as keyof SystemBarsResult] = structuredClone(DEFAULT_WINDOW_PROPERTIES);
|
|
187
197
|
}
|
package/lib/commands/time.ts
CHANGED
|
@@ -2,8 +2,16 @@ import dayjs from 'dayjs';
|
|
|
2
2
|
import customParseFormat from 'dayjs/plugin/customParseFormat.js';
|
|
3
3
|
import utc from 'dayjs/plugin/utc.js';
|
|
4
4
|
|
|
5
|
+
import type {AndroidDriverConstraints} from '../constraints.js';
|
|
5
6
|
import type {AndroidDriver} from '../driver.js';
|
|
6
7
|
|
|
8
|
+
declare module '../driver.js' {
|
|
9
|
+
interface AndroidDriver<C extends AndroidDriverConstraints> {
|
|
10
|
+
getDeviceTime(...args: Parameters<typeof getDeviceTime>): ReturnType<typeof getDeviceTime>;
|
|
11
|
+
mobileGetDeviceTime(...args: Parameters<typeof mobileGetDeviceTime>): ReturnType<typeof mobileGetDeviceTime>;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
7
15
|
dayjs.extend(utc);
|
|
8
16
|
dayjs.extend(customParseFormat);
|
|
9
17
|
|
package/lib/constraints.ts
CHANGED
|
@@ -151,9 +151,6 @@ export const ANDROID_DRIVER_CONSTRAINTS = {
|
|
|
151
151
|
recreateChromeDriverSessions: {
|
|
152
152
|
isBoolean: true,
|
|
153
153
|
},
|
|
154
|
-
autoLaunch: {
|
|
155
|
-
isBoolean: true,
|
|
156
|
-
},
|
|
157
154
|
nativeWebScreenshot: {
|
|
158
155
|
isBoolean: true,
|
|
159
156
|
},
|
|
@@ -209,6 +206,22 @@ export const ANDROID_DRIVER_CONSTRAINTS = {
|
|
|
209
206
|
localeScript: {
|
|
210
207
|
isString: true,
|
|
211
208
|
},
|
|
209
|
+
locale: {
|
|
210
|
+
isString: true,
|
|
211
|
+
},
|
|
212
|
+
language: {
|
|
213
|
+
isString: true,
|
|
214
|
+
},
|
|
215
|
+
autoWebview: {
|
|
216
|
+
isBoolean: true,
|
|
217
|
+
},
|
|
218
|
+
orientation: {
|
|
219
|
+
isString: true,
|
|
220
|
+
inclusionCaseInsensitive: ['LANDSCAPE', 'PORTRAIT'],
|
|
221
|
+
},
|
|
222
|
+
udid: {
|
|
223
|
+
isString: true,
|
|
224
|
+
},
|
|
212
225
|
skipDeviceInitialization: {
|
|
213
226
|
isBoolean: true,
|
|
214
227
|
},
|