in lib/appium/helpers/wdHelper.js [35:115]
module.exports.getDriver = function (platform) {
let normalizedPlatform;
let automationName;
let driverConfig = {};
let serverConfig = {};
let driver;
switch (platform.toLowerCase()) {
case utilities.ANDROID:
normalizedPlatform = 'Android';
automationName = 'Appium';
break;
case utilities.IOS:
normalizedPlatform = 'iOS';
automationName = 'XCUITest';
break;
default:
throw new Error(`Unknown Platform: ${platform}`);
}
global.WD.configureHttp({
timeout: utilities.WD_TIMEOUT,
retryDelay: utilities.WD_RETRY_DELAY,
retries: utilities.WD_RETRIES
});
if (global.USE_SAUCE) {
serverConfig = {
host: global.SAUCE_SERVER_HOST,
port: global.SAUCE_SERVER_PORT
};
driverConfig = global.SAUCE_CAPS;
driver = global.WD.promiseChainRemote(serverConfig.host, serverConfig.port, global.SAUCE_USER, global.SAUCE_KEY);
} else {
serverConfig = {
host: APPIUM_SERVER_HOST,
port: APPIUM_SERVER_PORT
};
driverConfig = {
browserName: '',
platformName: normalizedPlatform,
platformVersion: global.PLATFORM_VERSION || '',
deviceName: global.DEVICE_NAME || '',
app: global.PACKAGE_PATH,
autoAcceptAlerts: true,
automationName
};
if (platform.toLowerCase() === utilities.IOS) {
driverConfig.wdaLaunchTimeout = 150000;
}
if (global.UDID) {
driverConfig.udid = global.UDID;
}
driver = global.WD.promiseChainRemote(serverConfig);
}
module.exports.configureLogging(driver);
const spamDots = setInterval(function () {
process.stdout.write('.');
}, 1000);
return driver
.init(driverConfig)
.setImplicitWaitTimeout(IMPLICIT_WAIT_TIMEOUT)
.then(function () {
clearInterval(spamDots);
process.stdout.write('\n');
}, function (error) {
clearInterval(spamDots);
process.stdout.write('\n');
throw (error);
});
};