Add automationName deprecation warning for Android
MODIFY
lib/appium.js
lib/appium.js
@@ -8,6 +8,8 @@ import {
inspectObject, parseCapsForInnerDriver, getPackageVersion,
pullSettings } from './utils';
import semver from 'semver';
+import wrap from 'word-wrap';
+import { EOL } from 'os';
const PLATFORMS = {
@@ -85,8 +87,30 @@ const PLATFORMS_MAP = {
[PLATFORMS.FAKE]: () => AUTOMATION_NAMES.FAKE,
[PLATFORMS.ANDROID]: (caps) => {
const platformVersion = semver.valid(semver.coerce(caps.platformVersion));
- log.warn(`DeprecationWarning: 'automationName' capability was not provided. ` +
- `Future versions of Appium will require 'automationName' capability to be set for Android sessions.`);
+
+ // Warn users that default automation is going to change to UiAutomator2 for 1.14
+ // and will become required on Appium 2.0
+ const logDividerLength = 70; // Fit in command line
+
+ const automationWarning = [
+ `The 'automationName' capability was not provided in the desired capabilities for this Android session`,
+ `Setting 'automationName=UiAutomator1' by default and using the UiAutomator1 Driver`,
+ `The next minor version of Appium (1.14.x) will set 'automationName=UiAutomator2' by default and use the UiAutomator2 Driver`,
+ `The next major version of Appium (2.x) will **require** the 'automationName' capability to be set for all sessions on all platforms`,
+ `If you are happy with 'UiAutomator1' and do not wish to upgrade Android drivers, please add 'automationName=UiAutomator1' to your desired capabilities`,
+ `For more information about drivers, please visit http://appium.io/docs/en/about-appium/intro/ and explore the 'Drivers' menu`
+ ];
+
+ let divider = `${EOL}${_.repeat('=', logDividerLength)}${EOL}`;
+ let automationWarningString = divider;
+ automationWarningString += ` DEPRECATION WARNING:` + EOL;
+ for (let log of automationWarning) {
+ automationWarningString += EOL + wrap(log, {width: logDividerLength - 2}) + EOL;
+ }
+ automationWarningString += divider;
+
+ // Recommend users to upgrade to UiAutomator2 if they're using Android >= 6
+ log.warn(automationWarningString);
log.info(`Setting automation to '${AUTOMATION_NAMES.UIAUTOMATOR1}'. `);
if (platformVersion && semver.satisfies(platformVersion, '>=6.0.0')) {
log.warn(`Consider setting 'automationName' capability to '${AUTOMATION_NAMES.UIAUTOMATOR2}' ` +

MODIFY
package.json
package.json
"semver": "^6.0.0",
"source-map-support": "0.x",
"teen_process": "1.x",
- "winston": "3.x"
+ "winston": "3.x",
+ "word-wrap": "^1.2.3"
},
"scripts": {
"clean": "rm -rf node_modules && rm -f package-lock.json && npm install",

Add automationName deprecation warning for Android (#12481)