appium-android-driver 9.6.0 → 9.6.2
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
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## [9.6.2](https://github.com/appium/appium-android-driver/compare/v9.6.1...v9.6.2) (2024-05-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* typo ([a2260ca](https://github.com/appium/appium-android-driver/commit/a2260ca96bd112176b4093b804481736d7f22741))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Miscellaneous Chores
|
|
10
|
+
|
|
11
|
+
* Improve the error message shown if an unsupported device locale is provided ([#937](https://github.com/appium/appium-android-driver/issues/937)) ([757a14a](https://github.com/appium/appium-android-driver/commit/757a14a653e22591eb0ba4f32329a95acd401a19))
|
|
12
|
+
|
|
13
|
+
## [9.6.1](https://github.com/appium/appium-android-driver/compare/v9.6.0...v9.6.1) (2024-05-16)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Miscellaneous Chores
|
|
17
|
+
|
|
18
|
+
* Update dev dependencies ([3357384](https://github.com/appium/appium-android-driver/commit/33573847a5abaf3a7e9fdeab929910f16b0c39c9))
|
|
19
|
+
|
|
1
20
|
## [9.6.0](https://github.com/appium/appium-android-driver/compare/v9.5.0...v9.6.0) (2024-05-11)
|
|
2
21
|
|
|
3
22
|
|
|
@@ -12,5 +12,10 @@ export function getStrings(this: import("../driver").AndroidDriver, language?: s
|
|
|
12
12
|
* @returns {Promise<void>}}
|
|
13
13
|
*/
|
|
14
14
|
export function ensureDeviceLocale(this: import("../driver").AndroidDriver, language: string, country: string, script?: string | undefined): Promise<void>;
|
|
15
|
+
export type Locale = {
|
|
16
|
+
language: string;
|
|
17
|
+
country: string;
|
|
18
|
+
script?: string | undefined;
|
|
19
|
+
};
|
|
15
20
|
export type ADB = import('appium-adb').ADB;
|
|
16
21
|
//# sourceMappingURL=resources.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../lib/commands/resources.js"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,2GAFa,QAAQ,OAAO,eAAe,EAAE,YAAY,CAAC,CAqBzD;AAED;;;;;;GAMG;AACH,sFALW,MAAM,WACN,MAAM,gCAEJ,QAAQ,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../lib/commands/resources.js"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,2GAFa,QAAQ,OAAO,eAAe,EAAE,YAAY,CAAC,CAqBzD;AAED;;;;;;GAMG;AACH,sFALW,MAAM,WACN,MAAM,gCAEJ,QAAQ,IAAI,CAAC,CAwBzB;;cA0Ca,MAAM;aACN,MAAM;;;kBAgCP,OAAO,YAAY,EAAE,GAAG"}
|
|
@@ -38,12 +38,27 @@ exports.getStrings = getStrings;
|
|
|
38
38
|
* @returns {Promise<void>}}
|
|
39
39
|
*/
|
|
40
40
|
async function ensureDeviceLocale(language, country, script) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
try {
|
|
42
|
+
await this.settingsApp.setDeviceLocale(language, country, script);
|
|
43
|
+
if (!(await this.adb.ensureCurrentLocale(language, country, script))) {
|
|
44
|
+
throw new Error('Locale verification has failed');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
this.log.debug(e.stack);
|
|
49
|
+
let errMsg = `Cannot set the device locale to '${toLocaleAbbr({ language, country, script })}'.`;
|
|
50
|
+
/** @type {string[]} */
|
|
51
|
+
let suggestions = [];
|
|
52
|
+
try {
|
|
53
|
+
suggestions = (await fetchLocaleSuggestions.bind(this)(language, country)).map(toLocaleAbbr);
|
|
54
|
+
}
|
|
55
|
+
catch (e1) {
|
|
56
|
+
this.log.debug(e1.stack);
|
|
57
|
+
}
|
|
58
|
+
if (!lodash_1.default.isEmpty(suggestions)) {
|
|
59
|
+
errMsg += ` You may want to apply one of the following locales instead: ${suggestions}`;
|
|
60
|
+
}
|
|
61
|
+
throw new Error(errMsg);
|
|
47
62
|
}
|
|
48
63
|
}
|
|
49
64
|
exports.ensureDeviceLocale = ensureDeviceLocale;
|
|
@@ -80,6 +95,33 @@ async function extractStringsFromResources(language, opts = null) {
|
|
|
80
95
|
}
|
|
81
96
|
}
|
|
82
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* @typedef {Object} Locale
|
|
100
|
+
* @property {string} language
|
|
101
|
+
* @property {string} country
|
|
102
|
+
* @property {string} [script]
|
|
103
|
+
*/
|
|
104
|
+
/**
|
|
105
|
+
* @this {import('../driver').AndroidDriver}
|
|
106
|
+
* @param {string} [language]
|
|
107
|
+
* @param {string} [country]
|
|
108
|
+
* @returns {Promise<Locale[]>}
|
|
109
|
+
*/
|
|
110
|
+
async function fetchLocaleSuggestions(language, country) {
|
|
111
|
+
const supportedLocales = await this.settingsApp.listSupportedLocales();
|
|
112
|
+
const suggestedLocales = supportedLocales
|
|
113
|
+
.filter((locale) => lodash_1.default.toLower(language) === lodash_1.default.toLower(locale.language)
|
|
114
|
+
|| lodash_1.default.toLower(country) === lodash_1.default.toLower(locale.country));
|
|
115
|
+
return lodash_1.default.isEmpty(suggestedLocales) ? supportedLocales : suggestedLocales;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
*
|
|
119
|
+
* @param {Locale} locale
|
|
120
|
+
* @returns {string}
|
|
121
|
+
*/
|
|
122
|
+
function toLocaleAbbr({ language, country, script }) {
|
|
123
|
+
return `${language}_${country}${script ? ('-' + script) : ''}`;
|
|
124
|
+
}
|
|
83
125
|
// #endregion
|
|
84
126
|
/**
|
|
85
127
|
* @typedef {import('appium-adb').ADB} ADB
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../../lib/commands/resources.js"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,6CAA4C;AAE5C;;;;GAIG;AACI,KAAK,UAAU,UAAU,CAAC,QAAQ,GAAG,IAAI;IAC9C,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,4DAA4D;IAC5D,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,EAAE;QACvC,mDAAmD;QACnD,MAAM,MAAM,GAAG,EAAE,CAAC;QAClB,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;AAnBD,gCAmBC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,kBAAkB,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM;IAChE,MAAM,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../../lib/commands/resources.js"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,6CAA4C;AAE5C;;;;GAIG;AACI,KAA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OAAO,EAAE,MAAM,EAAC;IAC/C,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;AAEb;;GAEG"}
|
|
@@ -35,13 +35,26 @@ export async function getStrings(language = null) {
|
|
|
35
35
|
* @returns {Promise<void>}}
|
|
36
36
|
*/
|
|
37
37
|
export async function ensureDeviceLocale(language, country, script) {
|
|
38
|
-
|
|
38
|
+
try {
|
|
39
|
+
await this.settingsApp.setDeviceLocale(language, country, script);
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
if (!(await this.adb.ensureCurrentLocale(language, country, script))) {
|
|
42
|
+
throw new Error('Locale verification has failed');
|
|
43
|
+
}
|
|
44
|
+
} catch (e) {
|
|
45
|
+
this.log.debug(e.stack);
|
|
46
|
+
let errMsg = `Cannot set the device locale to '${toLocaleAbbr({language, country, script})}'.`;
|
|
47
|
+
/** @type {string[]} */
|
|
48
|
+
let suggestions = [];
|
|
49
|
+
try {
|
|
50
|
+
suggestions = (await fetchLocaleSuggestions.bind(this)(language, country)).map(toLocaleAbbr);
|
|
51
|
+
} catch (e1) {
|
|
52
|
+
this.log.debug(e1.stack);
|
|
53
|
+
}
|
|
54
|
+
if (!_.isEmpty(suggestions)) {
|
|
55
|
+
errMsg += ` You may want to apply one of the following locales instead: ${suggestions}`;
|
|
56
|
+
}
|
|
57
|
+
throw new Error(errMsg);
|
|
45
58
|
}
|
|
46
59
|
}
|
|
47
60
|
|
|
@@ -83,6 +96,38 @@ async function extractStringsFromResources(language, opts = null) {
|
|
|
83
96
|
}
|
|
84
97
|
}
|
|
85
98
|
|
|
99
|
+
/**
|
|
100
|
+
* @typedef {Object} Locale
|
|
101
|
+
* @property {string} language
|
|
102
|
+
* @property {string} country
|
|
103
|
+
* @property {string} [script]
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @this {import('../driver').AndroidDriver}
|
|
108
|
+
* @param {string} [language]
|
|
109
|
+
* @param {string} [country]
|
|
110
|
+
* @returns {Promise<Locale[]>}
|
|
111
|
+
*/
|
|
112
|
+
async function fetchLocaleSuggestions(language, country) {
|
|
113
|
+
const supportedLocales = await this.settingsApp.listSupportedLocales();
|
|
114
|
+
const suggestedLocales = supportedLocales
|
|
115
|
+
.filter((locale) =>
|
|
116
|
+
_.toLower(language) === _.toLower(locale.language)
|
|
117
|
+
|| _.toLower(country) === _.toLower(locale.country)
|
|
118
|
+
);
|
|
119
|
+
return _.isEmpty(suggestedLocales) ? supportedLocales : suggestedLocales;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
*
|
|
124
|
+
* @param {Locale} locale
|
|
125
|
+
* @returns {string}
|
|
126
|
+
*/
|
|
127
|
+
function toLocaleAbbr({language, country, script}) {
|
|
128
|
+
return `${language}_${country}${script ? ('-' + script) : ''}`;
|
|
129
|
+
}
|
|
130
|
+
|
|
86
131
|
// #endregion
|
|
87
132
|
|
|
88
133
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium-android-driver",
|
|
3
|
-
"version": "9.6.
|
|
3
|
+
"version": "9.6.2",
|
|
4
4
|
"description": "Android UiAutomator and Chrome support for Appium",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"appium",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"asyncbox": "^3.0.0",
|
|
56
56
|
"axios": "^1.x",
|
|
57
57
|
"bluebird": "^3.4.7",
|
|
58
|
-
"io.appium.settings": "^5.
|
|
58
|
+
"io.appium.settings": "^5.9.1",
|
|
59
59
|
"lodash": "^4.17.4",
|
|
60
60
|
"lru-cache": "^10.0.1",
|
|
61
61
|
"moment": "^2.24.0",
|
|
@@ -92,12 +92,6 @@
|
|
|
92
92
|
"chai": "^4.1.2",
|
|
93
93
|
"chai-as-promised": "^7.1.1",
|
|
94
94
|
"conventional-changelog-conventionalcommits": "^7.0.1",
|
|
95
|
-
"eslint": "^8.40.0",
|
|
96
|
-
"eslint-config-prettier": "^9.0.0",
|
|
97
|
-
"eslint-import-resolver-typescript": "^3.5.5",
|
|
98
|
-
"eslint-plugin-import": "^2.27.5",
|
|
99
|
-
"eslint-plugin-mocha": "^10.1.0",
|
|
100
|
-
"eslint-plugin-promise": "^6.1.1",
|
|
101
95
|
"mocha": "^10.0.0",
|
|
102
96
|
"prettier": "^3.0.1",
|
|
103
97
|
"rimraf": "^5.0.0",
|