appium-android-driver 12.4.9 → 12.4.11
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 +12 -0
- package/build/lib/commands/app-management.d.ts.map +1 -1
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/appearance.d.ts +9 -9
- package/build/lib/commands/appearance.d.ts.map +1 -1
- package/build/lib/commands/appearance.js +6 -7
- package/build/lib/commands/appearance.js.map +1 -1
- package/build/lib/commands/bluetooth.d.ts +13 -7
- package/build/lib/commands/bluetooth.d.ts.map +1 -1
- package/build/lib/commands/bluetooth.js +6 -10
- package/build/lib/commands/bluetooth.js.map +1 -1
- package/build/lib/commands/deviceidle.d.ts +9 -5
- package/build/lib/commands/deviceidle.d.ts.map +1 -1
- package/build/lib/commands/deviceidle.js +5 -9
- package/build/lib/commands/deviceidle.js.map +1 -1
- package/build/lib/commands/element.d.ts +90 -66
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js +74 -53
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/execute.d.ts +12 -8
- package/build/lib/commands/execute.d.ts.map +1 -1
- package/build/lib/commands/execute.js +13 -18
- package/build/lib/commands/execute.js.map +1 -1
- package/build/lib/commands/gestures.d.ts +8 -5
- package/build/lib/commands/gestures.d.ts.map +1 -1
- package/build/lib/commands/gestures.js +5 -6
- package/build/lib/commands/gestures.js.map +1 -1
- package/build/lib/commands/image-injection.d.ts +10 -11
- package/build/lib/commands/image-injection.d.ts.map +1 -1
- package/build/lib/commands/image-injection.js +7 -16
- package/build/lib/commands/image-injection.js.map +1 -1
- package/build/lib/commands/ime.d.ts +23 -17
- package/build/lib/commands/ime.d.ts.map +1 -1
- package/build/lib/commands/ime.js +20 -17
- package/build/lib/commands/ime.js.map +1 -1
- package/build/lib/commands/keyboard.d.ts +55 -39
- package/build/lib/commands/keyboard.d.ts.map +1 -1
- package/build/lib/commands/keyboard.js +47 -33
- package/build/lib/commands/keyboard.js.map +1 -1
- package/build/lib/commands/legacy.d.ts +16 -7
- package/build/lib/commands/legacy.d.ts.map +1 -1
- package/build/lib/commands/legacy.js +12 -6
- package/build/lib/commands/legacy.js.map +1 -1
- package/build/lib/commands/log.d.ts +7 -7
- package/build/lib/commands/log.d.ts.map +1 -1
- package/build/lib/commands/log.js +0 -1
- package/build/lib/commands/log.js.map +1 -1
- package/build/lib/commands/media-projection.d.ts +32 -36
- package/build/lib/commands/media-projection.d.ts.map +1 -1
- package/build/lib/commands/media-projection.js +27 -54
- package/build/lib/commands/media-projection.js.map +1 -1
- package/build/lib/commands/memory.d.ts +7 -7
- package/build/lib/commands/memory.d.ts.map +1 -1
- package/build/lib/commands/memory.js +4 -8
- package/build/lib/commands/memory.js.map +1 -1
- package/build/lib/commands/misc.d.ts +38 -26
- package/build/lib/commands/misc.d.ts.map +1 -1
- package/build/lib/commands/misc.js +31 -24
- package/build/lib/commands/misc.js.map +1 -1
- package/build/lib/commands/nfc.d.ts +7 -7
- package/build/lib/commands/nfc.d.ts.map +1 -1
- package/build/lib/commands/nfc.js +6 -10
- package/build/lib/commands/nfc.js.map +1 -1
- 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 +47 -19
- package/build/lib/commands/permissions.d.ts.map +1 -1
- package/build/lib/commands/permissions.js +21 -36
- package/build/lib/commands/permissions.js.map +1 -1
- package/build/lib/commands/resources.d.ts +16 -16
- package/build/lib/commands/resources.d.ts.map +1 -1
- package/build/lib/commands/resources.js +12 -38
- package/build/lib/commands/resources.js.map +1 -1
- package/build/lib/commands/shell.d.ts.map +1 -1
- package/build/lib/commands/shell.js +1 -1
- package/build/lib/commands/shell.js.map +1 -1
- package/build/lib/commands/system-bars.d.ts +27 -21
- package/build/lib/commands/system-bars.d.ts.map +1 -1
- package/build/lib/commands/system-bars.js +23 -40
- package/build/lib/commands/system-bars.js.map +1 -1
- package/build/lib/commands/time.d.ts +17 -14
- package/build/lib/commands/time.d.ts.map +1 -1
- package/build/lib/commands/time.js +13 -13
- package/build/lib/commands/time.js.map +1 -1
- package/build/lib/commands/types.d.ts +17 -0
- package/build/lib/commands/types.d.ts.map +1 -1
- package/lib/commands/app-management.ts +3 -3
- package/lib/commands/{appearance.js → appearance.ts} +17 -9
- package/lib/commands/{bluetooth.js → bluetooth.ts} +13 -11
- package/lib/commands/{deviceidle.js → deviceidle.ts} +13 -12
- package/lib/commands/element.ts +234 -0
- package/lib/commands/{execute.js → execute.ts} +24 -19
- package/lib/commands/gestures.ts +19 -0
- package/lib/commands/{image-injection.js → image-injection.ts} +17 -19
- package/lib/commands/ime.ts +79 -0
- package/lib/commands/keyboard.ts +163 -0
- package/lib/commands/legacy.ts +41 -0
- package/lib/commands/log.ts +9 -9
- package/lib/commands/{media-projection.js → media-projection.ts} +69 -68
- package/lib/commands/memory.ts +29 -0
- package/lib/commands/misc.ts +118 -0
- package/lib/commands/{nfc.js → nfc.ts} +12 -11
- package/lib/commands/performance.ts +2 -1
- package/lib/commands/{permissions.js → permissions.ts} +58 -50
- package/lib/commands/{resources.js → resources.ts} +44 -52
- package/lib/commands/shell.ts +2 -1
- package/lib/commands/{system-bars.js → system-bars.ts} +59 -50
- package/lib/commands/{time.js → time.ts} +26 -16
- package/lib/commands/types.ts +27 -0
- package/package.json +1 -1
- package/lib/commands/element.js +0 -158
- package/lib/commands/gestures.js +0 -15
- package/lib/commands/ime.js +0 -64
- package/lib/commands/keyboard.js +0 -119
- package/lib/commands/legacy.js +0 -28
- package/lib/commands/memory.js +0 -27
- package/lib/commands/misc.js +0 -92
|
@@ -1,33 +1,61 @@
|
|
|
1
|
+
import type { AndroidDriver } from '../driver';
|
|
2
|
+
declare const PM_ACTION: Readonly<{
|
|
3
|
+
readonly GRANT: "grant";
|
|
4
|
+
readonly REVOKE: "revoke";
|
|
5
|
+
}>;
|
|
6
|
+
declare const APPOPS_ACTION: Readonly<{
|
|
7
|
+
readonly ALLOW: "allow";
|
|
8
|
+
readonly DENY: "deny";
|
|
9
|
+
readonly IGNORE: "ignore";
|
|
10
|
+
readonly DEFAULT: "default";
|
|
11
|
+
}>;
|
|
12
|
+
declare const PERMISSION_TARGET: Readonly<{
|
|
13
|
+
readonly PM: "pm";
|
|
14
|
+
readonly APPOPS: "appops";
|
|
15
|
+
}>;
|
|
16
|
+
declare const PERMISSIONS_TYPE: Readonly<{
|
|
17
|
+
readonly DENIED: "denied";
|
|
18
|
+
readonly GRANTED: "granted";
|
|
19
|
+
readonly REQUESTED: "requested";
|
|
20
|
+
}>;
|
|
1
21
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
22
|
+
* Changes permissions for an Android application.
|
|
23
|
+
*
|
|
24
|
+
* @param permissions If `target` is set to 'pm':
|
|
4
25
|
* The full name of the permission to be changed
|
|
5
26
|
* or a list of permissions. Check https://developer.android.com/reference/android/Manifest.permission
|
|
6
|
-
* to get the full list of standard Android
|
|
27
|
+
* to get the full list of standard Android permission names. Mandatory argument.
|
|
7
28
|
* If 'all' magic string is passed then the chosen action is going to be applied to all
|
|
8
|
-
*
|
|
29
|
+
* permissions requested/granted by 'appPackage'.
|
|
9
30
|
* If `target` is set to 'appops':
|
|
10
31
|
* The full name of the appops permission to be changed
|
|
11
32
|
* or a list of permissions. Check AppOpsManager.java sources to get the full list of
|
|
12
33
|
* available appops permission names. Mandatory argument.
|
|
13
34
|
* Examples: 'ACTIVITY_RECOGNITION', 'SMS_FINANCIAL_TRANSACTIONS', 'READ_SMS', 'ACCESS_NOTIFICATIONS'.
|
|
14
35
|
* The 'all' magic string is unsupported.
|
|
15
|
-
* @param
|
|
16
|
-
* package name under test
|
|
17
|
-
* @param
|
|
18
|
-
* one of `APPOPS_ACTION` values
|
|
19
|
-
* @param
|
|
20
|
-
* 'adb_shell' server security option to be enabled.
|
|
36
|
+
* @param appPackage The application package to set change permissions on. Defaults to the
|
|
37
|
+
* package name under test.
|
|
38
|
+
* @param action One of `PM_ACTION` values if `target` is set to 'pm', otherwise
|
|
39
|
+
* one of `APPOPS_ACTION` values.
|
|
40
|
+
* @param target Either 'pm' or 'appops'. The 'appops' one requires
|
|
41
|
+
* 'adb_shell' server security option to be enabled. Defaults to 'pm'.
|
|
42
|
+
* @returns Promise that resolves when permissions are changed.
|
|
43
|
+
* @throws {errors.InvalidArgumentError} If permissions argument is missing, empty, or invalid.
|
|
21
44
|
*/
|
|
22
|
-
export function mobileChangePermissions(this:
|
|
45
|
+
export declare function mobileChangePermissions(this: AndroidDriver, permissions: string | string[], appPackage?: string, action?: PMAction | AppOpsAction, target?: PermissionTarget): Promise<void>;
|
|
23
46
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* @param
|
|
27
|
-
*
|
|
28
|
-
*
|
|
47
|
+
* Gets permissions for an Android application.
|
|
48
|
+
*
|
|
49
|
+
* @param type One of possible permission types to get. Defaults to 'requested'.
|
|
50
|
+
* @param appPackage The application package to get permissions for.
|
|
51
|
+
* Defaults to the package name under test.
|
|
52
|
+
* @returns Promise that resolves to an array of permission names.
|
|
53
|
+
* @throws {errors.InvalidArgumentError} If the permission type is unknown.
|
|
29
54
|
*/
|
|
30
|
-
export function mobileGetPermissions(this:
|
|
31
|
-
|
|
32
|
-
|
|
55
|
+
export declare function mobileGetPermissions(this: AndroidDriver, type?: PermissionsType, appPackage?: string): Promise<string[]>;
|
|
56
|
+
type PMAction = typeof PM_ACTION[keyof typeof PM_ACTION];
|
|
57
|
+
type AppOpsAction = typeof APPOPS_ACTION[keyof typeof APPOPS_ACTION];
|
|
58
|
+
type PermissionTarget = typeof PERMISSION_TARGET[keyof typeof PERMISSION_TARGET];
|
|
59
|
+
type PermissionsType = typeof PERMISSIONS_TYPE[keyof typeof PERMISSIONS_TYPE];
|
|
60
|
+
export {};
|
|
33
61
|
//# sourceMappingURL=permissions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../lib/commands/permissions.
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../lib/commands/permissions.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC;AAG7C,QAAA,MAAM,SAAS;;;EAGJ,CAAC;AACZ,QAAA,MAAM,aAAa;;;;;EAKR,CAAC;AACZ,QAAA,MAAM,iBAAiB;;;EAGZ,CAAC;AACZ,QAAA,MAAM,gBAAgB;;;;EAIX,CAAC;AAEZ;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,aAAa,EACnB,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,EAC9B,UAAU,CAAC,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,QAAQ,GAAG,YAAY,EAChC,MAAM,GAAE,gBAAuC,GAC9C,OAAO,CAAC,IAAI,CAAC,CA2Bf;AAED;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,aAAa,EACnB,IAAI,GAAE,eAA4C,EAClD,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,EAAE,CAAC,CAoBnB;AAoED,KAAK,QAAQ,GAAG,OAAO,SAAS,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AACzD,KAAK,YAAY,GAAG,OAAO,aAAa,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AACrE,KAAK,gBAAgB,GAAG,OAAO,iBAAiB,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AACjF,KAAK,eAAe,GAAG,OAAO,gBAAgB,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -30,25 +30,28 @@ const PERMISSIONS_TYPE = Object.freeze({
|
|
|
30
30
|
REQUESTED: 'requested',
|
|
31
31
|
});
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
33
|
+
* Changes permissions for an Android application.
|
|
34
|
+
*
|
|
35
|
+
* @param permissions If `target` is set to 'pm':
|
|
35
36
|
* The full name of the permission to be changed
|
|
36
37
|
* or a list of permissions. Check https://developer.android.com/reference/android/Manifest.permission
|
|
37
|
-
* to get the full list of standard Android
|
|
38
|
+
* to get the full list of standard Android permission names. Mandatory argument.
|
|
38
39
|
* If 'all' magic string is passed then the chosen action is going to be applied to all
|
|
39
|
-
*
|
|
40
|
+
* permissions requested/granted by 'appPackage'.
|
|
40
41
|
* If `target` is set to 'appops':
|
|
41
42
|
* The full name of the appops permission to be changed
|
|
42
43
|
* or a list of permissions. Check AppOpsManager.java sources to get the full list of
|
|
43
44
|
* available appops permission names. Mandatory argument.
|
|
44
45
|
* Examples: 'ACTIVITY_RECOGNITION', 'SMS_FINANCIAL_TRANSACTIONS', 'READ_SMS', 'ACCESS_NOTIFICATIONS'.
|
|
45
46
|
* The 'all' magic string is unsupported.
|
|
46
|
-
* @param
|
|
47
|
-
* package name under test
|
|
48
|
-
* @param
|
|
49
|
-
* one of `APPOPS_ACTION` values
|
|
50
|
-
* @param
|
|
51
|
-
* 'adb_shell' server security option to be enabled.
|
|
47
|
+
* @param appPackage The application package to set change permissions on. Defaults to the
|
|
48
|
+
* package name under test.
|
|
49
|
+
* @param action One of `PM_ACTION` values if `target` is set to 'pm', otherwise
|
|
50
|
+
* one of `APPOPS_ACTION` values.
|
|
51
|
+
* @param target Either 'pm' or 'appops'. The 'appops' one requires
|
|
52
|
+
* 'adb_shell' server security option to be enabled. Defaults to 'pm'.
|
|
53
|
+
* @returns Promise that resolves when permissions are changed.
|
|
54
|
+
* @throws {errors.InvalidArgumentError} If permissions argument is missing, empty, or invalid.
|
|
52
55
|
*/
|
|
53
56
|
async function mobileChangePermissions(permissions, appPackage, action, target = PERMISSION_TARGET.PM) {
|
|
54
57
|
appPackage ??= this.opts.appPackage;
|
|
@@ -72,17 +75,16 @@ async function mobileChangePermissions(permissions, appPackage, action, target =
|
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
77
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* @param
|
|
78
|
-
*
|
|
79
|
-
*
|
|
78
|
+
* Gets permissions for an Android application.
|
|
79
|
+
*
|
|
80
|
+
* @param type One of possible permission types to get. Defaults to 'requested'.
|
|
81
|
+
* @param appPackage The application package to get permissions for.
|
|
82
|
+
* Defaults to the package name under test.
|
|
83
|
+
* @returns Promise that resolves to an array of permission names.
|
|
84
|
+
* @throws {errors.InvalidArgumentError} If the permission type is unknown.
|
|
80
85
|
*/
|
|
81
86
|
async function mobileGetPermissions(type = PERMISSIONS_TYPE.REQUESTED, appPackage) {
|
|
82
87
|
appPackage ??= this.opts.appPackage;
|
|
83
|
-
/**
|
|
84
|
-
* @type {(pkg: string) => Promise<string[]>}
|
|
85
|
-
*/
|
|
86
88
|
let actionFunc;
|
|
87
89
|
switch (lodash_1.default.toLower(type)) {
|
|
88
90
|
case PERMISSIONS_TYPE.REQUESTED:
|
|
@@ -98,15 +100,9 @@ async function mobileGetPermissions(type = PERMISSIONS_TYPE.REQUESTED, appPackag
|
|
|
98
100
|
throw new driver_1.errors.InvalidArgumentError(`Unknown permissions type '${type}'. ` +
|
|
99
101
|
`Only ${JSON.stringify(lodash_1.default.values(PERMISSIONS_TYPE))} types are supported`);
|
|
100
102
|
}
|
|
101
|
-
return await actionFunc(
|
|
103
|
+
return await actionFunc(appPackage);
|
|
102
104
|
}
|
|
103
105
|
// #region Internal helpers
|
|
104
|
-
/**
|
|
105
|
-
* @this {AndroidDriver}
|
|
106
|
-
* @param {string|string[]} permissions
|
|
107
|
-
* @param {string} appPackage
|
|
108
|
-
* @param {PM_ACTION[keyof PM_ACTION]} action
|
|
109
|
-
*/
|
|
110
106
|
async function changePermissionsViaPm(permissions, appPackage, action) {
|
|
111
107
|
if (!lodash_1.default.values(PM_ACTION).includes(action)) {
|
|
112
108
|
throw new driver_1.errors.InvalidArgumentError(`Unknown action '${action}'. ` +
|
|
@@ -135,12 +131,6 @@ async function changePermissionsViaPm(permissions, appPackage, action) {
|
|
|
135
131
|
await bluebird_1.default.all(affectedPermissions.map((name) => this.adb.revokePermission(appPackage, name)));
|
|
136
132
|
}
|
|
137
133
|
}
|
|
138
|
-
/**
|
|
139
|
-
* @this {AndroidDriver}
|
|
140
|
-
* @param {string|string[]} permissions
|
|
141
|
-
* @param {string} appPackage
|
|
142
|
-
* @param {APPOPS_ACTION[keyof APPOPS_ACTION]} action
|
|
143
|
-
*/
|
|
144
134
|
async function changePermissionsViaAppops(permissions, appPackage, action) {
|
|
145
135
|
if (!lodash_1.default.values(APPOPS_ACTION).includes(action)) {
|
|
146
136
|
throw new driver_1.errors.InvalidArgumentError(`Unknown action '${action}'. ` +
|
|
@@ -154,9 +144,4 @@ async function changePermissionsViaAppops(permissions, appPackage, action) {
|
|
|
154
144
|
const promises = (lodash_1.default.isArray(permissions) ? permissions : [permissions]).map((permission) => this.adb.shell(['appops', 'set', appPackage, permission, action]));
|
|
155
145
|
await bluebird_1.default.all(promises);
|
|
156
146
|
}
|
|
157
|
-
// #endregion
|
|
158
|
-
/**
|
|
159
|
-
* @typedef {import('appium-adb').ADB} ADB
|
|
160
|
-
* @typedef {import('../driver').AndroidDriver} AndroidDriver
|
|
161
|
-
*/
|
|
162
147
|
//# sourceMappingURL=permissions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../../lib/commands/permissions.
|
|
1
|
+
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../../lib/commands/permissions.ts"],"names":[],"mappings":";;;;;AAmDA,0DAiCC;AAWD,oDAwBC;AAvHD,0CAAqC;AACrC,wDAAyB;AACzB,oDAAuB;AACvB,oCAA2C;AAG3C,MAAM,qBAAqB,GAAG,KAAK,CAAC;AACpC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9B,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;CACR,CAAC,CAAC;AAC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AAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CACzF,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAClE,CAAC;IACF,MAAM,kBAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
+
import type { StringRecord } from '@appium/types';
|
|
2
|
+
import type { AndroidDriver } from '../driver';
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @
|
|
4
|
+
* Gets the localized strings from the application.
|
|
5
|
+
*
|
|
6
|
+
* @param language The language code to retrieve strings for. If not provided,
|
|
7
|
+
* the device's current language will be used.
|
|
8
|
+
* @returns Promise that resolves to a mapping of string keys to their localized values.
|
|
5
9
|
*/
|
|
6
|
-
export function getStrings(this:
|
|
10
|
+
export declare function getStrings(this: AndroidDriver, language?: string | null): Promise<StringRecord>;
|
|
7
11
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
-
* @
|
|
12
|
+
* Ensures the device locale is set to the specified language, country, and optional script.
|
|
13
|
+
*
|
|
14
|
+
* @param language The language code (e.g., 'en', 'fr').
|
|
15
|
+
* @param country The country code (e.g., 'US', 'FR').
|
|
16
|
+
* @param script Optional script code.
|
|
17
|
+
* @returns Promise that resolves when the locale is set and verified.
|
|
18
|
+
* @throws {Error} If the locale cannot be set or verified.
|
|
13
19
|
*/
|
|
14
|
-
export function ensureDeviceLocale(this:
|
|
15
|
-
export type Locale = {
|
|
16
|
-
language: string;
|
|
17
|
-
country: string;
|
|
18
|
-
script?: string | undefined;
|
|
19
|
-
};
|
|
20
|
-
export type ADB = import("appium-adb").ADB;
|
|
20
|
+
export declare function ensureDeviceLocale(this: AndroidDriver, language: string, country: string, script?: string): Promise<void>;
|
|
21
21
|
//# sourceMappingURL=resources.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../lib/commands/resources.
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../lib/commands/resources.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAC,aAAa,EAAoB,MAAM,WAAW,CAAC;AAGhE;;;;;;GAMG;AACH,wBAAsB,UAAU,CAC9B,IAAI,EAAE,aAAa,EACnB,QAAQ,GAAE,MAAM,GAAG,IAAW,GAC7B,OAAO,CAAC,YAAY,CAAC,CAiBvB;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAqBf"}
|
|
@@ -8,9 +8,11 @@ exports.ensureDeviceLocale = ensureDeviceLocale;
|
|
|
8
8
|
const lodash_1 = __importDefault(require("lodash"));
|
|
9
9
|
const support_1 = require("@appium/support");
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* @
|
|
11
|
+
* Gets the localized strings from the application.
|
|
12
|
+
*
|
|
13
|
+
* @param language The language code to retrieve strings for. If not provided,
|
|
14
|
+
* the device's current language will be used.
|
|
15
|
+
* @returns Promise that resolves to a mapping of string keys to their localized values.
|
|
14
16
|
*/
|
|
15
17
|
async function getStrings(language = null) {
|
|
16
18
|
if (!language) {
|
|
@@ -19,9 +21,7 @@ async function getStrings(language = null) {
|
|
|
19
21
|
}
|
|
20
22
|
// Clients require the resulting mapping to have both keys
|
|
21
23
|
// and values of type string
|
|
22
|
-
/** @param {import('@appium/types').StringRecord} mapping */
|
|
23
24
|
const preprocessStringsMap = (mapping) => {
|
|
24
|
-
/** @type {import('@appium/types').StringRecord} */
|
|
25
25
|
const result = {};
|
|
26
26
|
for (const [key, value] of lodash_1.default.toPairs(mapping)) {
|
|
27
27
|
result[key] = lodash_1.default.isString(value) ? value : JSON.stringify(value);
|
|
@@ -31,11 +31,13 @@ async function getStrings(language = null) {
|
|
|
31
31
|
return preprocessStringsMap(await extractStringsFromResources.bind(this)(language));
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
38
|
-
* @
|
|
34
|
+
* Ensures the device locale is set to the specified language, country, and optional script.
|
|
35
|
+
*
|
|
36
|
+
* @param language The language code (e.g., 'en', 'fr').
|
|
37
|
+
* @param country The country code (e.g., 'US', 'FR').
|
|
38
|
+
* @param script Optional script code.
|
|
39
|
+
* @returns Promise that resolves when the locale is set and verified.
|
|
40
|
+
* @throws {Error} If the locale cannot be set or verified.
|
|
39
41
|
*/
|
|
40
42
|
async function ensureDeviceLocale(language, country, script) {
|
|
41
43
|
try {
|
|
@@ -47,7 +49,6 @@ async function ensureDeviceLocale(language, country, script) {
|
|
|
47
49
|
catch (e) {
|
|
48
50
|
this.log.debug(e.stack);
|
|
49
51
|
let errMsg = `Cannot set the device locale to '${toLocaleAbbr({ language, country, script })}'.`;
|
|
50
|
-
/** @type {string[]} */
|
|
51
52
|
let suggestions = [];
|
|
52
53
|
try {
|
|
53
54
|
suggestions = (await fetchLocaleSuggestions.bind(this)(language, country)).map(toLocaleAbbr);
|
|
@@ -62,15 +63,8 @@ async function ensureDeviceLocale(language, country, script) {
|
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
// #region Internal helpers
|
|
65
|
-
/**
|
|
66
|
-
* @this {import('../driver').AndroidDriver}
|
|
67
|
-
* @param {string?} [language]
|
|
68
|
-
* @param {import('../driver').AndroidDriverOpts?} [opts=null]
|
|
69
|
-
* @returns {Promise<import('@appium/types').StringRecord>};
|
|
70
|
-
*/
|
|
71
66
|
async function extractStringsFromResources(language, opts = null) {
|
|
72
67
|
const caps = opts ?? this.opts;
|
|
73
|
-
/** @type {string|undefined} */
|
|
74
68
|
let app = caps.app;
|
|
75
69
|
let tmpRoot;
|
|
76
70
|
try {
|
|
@@ -94,18 +88,6 @@ async function extractStringsFromResources(language, opts = null) {
|
|
|
94
88
|
}
|
|
95
89
|
}
|
|
96
90
|
}
|
|
97
|
-
/**
|
|
98
|
-
* @typedef {Object} Locale
|
|
99
|
-
* @property {string} language
|
|
100
|
-
* @property {string} country
|
|
101
|
-
* @property {string} [script]
|
|
102
|
-
*/
|
|
103
|
-
/**
|
|
104
|
-
* @this {import('../driver').AndroidDriver}
|
|
105
|
-
* @param {string} [language]
|
|
106
|
-
* @param {string} [country]
|
|
107
|
-
* @returns {Promise<Locale[]>}
|
|
108
|
-
*/
|
|
109
91
|
async function fetchLocaleSuggestions(language, country) {
|
|
110
92
|
const supportedLocales = await this.settingsApp.listSupportedLocales();
|
|
111
93
|
const suggestedLocales = supportedLocales
|
|
@@ -113,16 +95,8 @@ async function fetchLocaleSuggestions(language, country) {
|
|
|
113
95
|
|| lodash_1.default.toLower(country) === lodash_1.default.toLower(locale.country));
|
|
114
96
|
return lodash_1.default.isEmpty(suggestedLocales) ? supportedLocales : suggestedLocales;
|
|
115
97
|
}
|
|
116
|
-
/**
|
|
117
|
-
*
|
|
118
|
-
* @param {Locale} locale
|
|
119
|
-
* @returns {string}
|
|
120
|
-
*/
|
|
121
98
|
function toLocaleAbbr({ language, country, script }) {
|
|
122
99
|
return `${language}_${country}${script ? ('-' + script) : ''}`;
|
|
123
100
|
}
|
|
124
101
|
// #endregion
|
|
125
|
-
/**
|
|
126
|
-
* @typedef {import('appium-adb').ADB} ADB
|
|
127
|
-
*/
|
|
128
102
|
//# sourceMappingURL=resources.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../../lib/commands/resources.
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../../lib/commands/resources.ts"],"names":[],"mappings":";;;;;AAaA,gCAoBC;AAWD,gDA0BC;AAtED,oDAAuB;AACvB,6CAA4C;AAK5C;;;;;;GAMG;AACI,KAAK,UAAU,UAAU,CAE9B,WAA0B,IAAI;IAE9B,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC;QAC9C,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,iDAAiD,QAAQ,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED,0DAA0D;IAC1D,4BAA4B;IAC5B,MAAM,oBAAoB,GAAG,CAAC,OAAqB,EAAgB,EAAE;QACnE,MAAM,MAAM,GAAiB,EAAE,CAAC;QAChC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,gBAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9C,MAAM,CAAC,GAAG,CAAC,GAAG,gBAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAClE,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAEF,OAAO,oBAAoB,CAAC,MAAM,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtF,CAAC;AAED;;;;;;;;GAQG;AACI,KAAK,UAAU,kBAAkB,CAEtC,QAAgB,EAChB,OAAe,EACf,MAAe;IAEf,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAElE,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,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3E,CAAC;AAED,SAAS,YAAY,CAAC,EAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAS;IACvD,OAAO,GAAG,QAAQ,IAAI,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AACjE,CAAC;AAED,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../lib/commands/shell.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../lib/commands/shell.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,WAAW,CAAC,CAAC,SAAS,OAAO,EACjD,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,MAAM,EAAO,EACnB,OAAO,GAAE,MAAc,EACvB,aAAa,CAAC,EAAE,CAAC,GAChB,OAAO,CAAC,CAAC,SAAS,IAAI,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;CAAE,GAAG,MAAM,CAAC,CA4BxE"}
|
|
@@ -50,7 +50,7 @@ async function mobileShell(command, args = [], timeout = 20000, includeStderr) {
|
|
|
50
50
|
return stdout;
|
|
51
51
|
}
|
|
52
52
|
catch (e) {
|
|
53
|
-
const err =
|
|
53
|
+
const err = e;
|
|
54
54
|
throw this.log.errorWithException(`Cannot execute the '${command}' shell command. ` +
|
|
55
55
|
`Original error: ${err.message}. ` +
|
|
56
56
|
`StdOut: ${err.stdout}. StdErr: ${err.stderr}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../../lib/commands/shell.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../../lib/commands/shell.ts"],"names":[],"mappings":";;;;;AA4BA,kCAiC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;YAClC,WAAW,GAAG,CAAC,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,CACjD,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,41 +1,47 @@
|
|
|
1
|
+
import type { StringRecord } from '@appium/types';
|
|
2
|
+
import type { AndroidDriver } from '../driver';
|
|
3
|
+
import type { StatusBarCommand, WindowProperties } from './types';
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
5
|
+
* Gets the system bars (status bar and navigation bar) properties.
|
|
6
|
+
*
|
|
7
|
+
* @returns Promise that resolves to an object containing statusBar and navigationBar properties.
|
|
8
|
+
* @throws {Error} If system bars details cannot be retrieved or parsed.
|
|
4
9
|
*/
|
|
5
|
-
export function getSystemBars(this:
|
|
10
|
+
export declare function getSystemBars(this: AndroidDriver): Promise<StringRecord>;
|
|
6
11
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @param
|
|
12
|
+
* Performs a status bar command.
|
|
13
|
+
*
|
|
14
|
+
* @param command The status bar command to perform.
|
|
15
|
+
* @param component The name of the tile component.
|
|
11
16
|
* It is only required for `(add|remove|click)Tile` commands.
|
|
12
17
|
* Example value: `com.package.name/.service.QuickSettingsTileComponent`
|
|
13
|
-
* @returns
|
|
18
|
+
* @returns Promise that resolves to the command output string.
|
|
19
|
+
* @throws {errors.InvalidArgumentError} If the command is unknown.
|
|
14
20
|
*/
|
|
15
|
-
export function mobilePerformStatusBarCommand(this:
|
|
21
|
+
export declare function mobilePerformStatusBarCommand(this: AndroidDriver, command: StatusBarCommand, component?: string): Promise<string>;
|
|
16
22
|
/**
|
|
17
23
|
* Parses window properties from adb dumpsys output
|
|
18
24
|
*
|
|
19
|
-
* @
|
|
20
|
-
* @param
|
|
21
|
-
* @param {Array<string>} props The list of particular window property lines.
|
|
25
|
+
* @param name The name of the window whose properties are being parsed
|
|
26
|
+
* @param props The list of particular window property lines.
|
|
22
27
|
* Check the corresponding unit tests for more details on the input format.
|
|
23
|
-
* @returns
|
|
28
|
+
* @returns Parsed properties object
|
|
24
29
|
* @throws {Error} If there was an issue while parsing the properties string
|
|
25
30
|
*/
|
|
26
|
-
export function parseWindowProperties(this:
|
|
31
|
+
export declare function parseWindowProperties(this: AndroidDriver, name: string, props: string[]): WindowProperties;
|
|
27
32
|
/**
|
|
28
33
|
* Extracts status and navigation bar information from the window manager output.
|
|
29
34
|
*
|
|
30
|
-
* @
|
|
31
|
-
* @param {string} lines Output from dumpsys command.
|
|
35
|
+
* @param lines Output from dumpsys command.
|
|
32
36
|
* Check the corresponding unit tests for more details on the input format.
|
|
33
|
-
* @return
|
|
37
|
+
* @return An object containing two items where keys are statusBar and navigationBar,
|
|
34
38
|
* and values are corresponding WindowProperties objects
|
|
35
39
|
* @throws {Error} If no window properties could be parsed
|
|
36
40
|
*/
|
|
37
|
-
export function parseWindows(this:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
export declare function parseWindows(this: AndroidDriver, lines: string): SystemBarsResult;
|
|
42
|
+
interface SystemBarsResult {
|
|
43
|
+
statusBar?: WindowProperties;
|
|
44
|
+
navigationBar?: WindowProperties;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
41
47
|
//# sourceMappingURL=system-bars.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-bars.d.ts","sourceRoot":"","sources":["../../../lib/commands/system-bars.
|
|
1
|
+
{"version":3,"file":"system-bars.d.ts","sourceRoot":"","sources":["../../../lib/commands/system-bars.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAC,gBAAgB,EAAE,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAoBhE;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,YAAY,CAAC,CAUvB;AAED;;;;;;;;;GASG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,gBAAgB,EACzB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,CAgCjB;AAID;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EAAE,GACd,gBAAgB,CAmBlB;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,MAAM,GACZ,gBAAgB,CAmDlB;AAID,UAAU,gBAAgB;IACxB,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,aAAa,CAAC,EAAE,gBAAgB,CAAC;CAClC"}
|