Allow 'appium' automationName and particular platformName
MODIFY
lib/appium.js
lib/appium.js
@@ -178,7 +178,7 @@ class AppiumDriver extends BaseDriver {
// we don't necessarily have an `automationName` capability
let automationNameCap = caps.automationName;
- if (!_.isString(automationNameCap)) {
+ if (!_.isString(automationNameCap) || automationNameCap.toLowerCase() === 'appium') {
const driverSelector = PLATFORMS_MAP[platformName];
if (driverSelector) {
automationNameCap = driverSelector(caps);

MODIFY
test/driver-specs.js
test/driver-specs.js
@@ -9,6 +9,7 @@ import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import { XCUITestDriver } from 'appium-xcuitest-driver';
import { IosDriver } from 'appium-ios-driver';
+import { AndroidDriver } from 'appium-android-driver';
import { sleep } from 'asyncbox';
import { insertAppiumPrefixes } from '../lib/utils';
@@ -282,6 +283,15 @@ describe('AppiumDriver', function () {
const appium = new AppiumDriver({});
(() => { appium.getDriverAndVersionForCaps({}); }).should.throw(/platformName/);
});
+ it('should ignore automationName Appium', function () {
+ const appium = new AppiumDriver({});
+ const {driver} = appium.getDriverAndVersionForCaps({
+ platformName: 'Android',
+ automationName: 'Appium'
+ });
+ driver.should.be.an.instanceof(Function);
+ driver.should.equal(AndroidDriver);
+ });
it('should get XCUITestDriver driver for automationName of XCUITest', function () {
const appium = new AppiumDriver({});
const {driver} = appium.getDriverAndVersionForCaps({

Allow 'appium' automationName and particular platformName (#12415)