in lib/appium/AppiumRunner.js [333:378]
function getPackagePath (options) {
if (options.sauce) return options.sauceAppPath;
const fullAppPath = getFullAppPath(options.appPath);
switch (options.platform) {
case utilities.ANDROID: {
let packagePath = null;
const maybePackagePaths = [
path.join(fullAppPath, 'platforms', 'android', 'app', 'build', 'outputs', 'apk', 'debug', 'app-debug.apk'),
path.join(fullAppPath, 'platforms', 'android', 'app', 'build', 'outputs', 'apk', 'android-debug.apk'),
path.join(fullAppPath, 'platforms', 'android', 'build', 'outputs', 'apk', 'debug', 'app-debug.apk')
];
maybePackagePaths.forEach((p) => {
if (fs.existsSync(p)) {
packagePath = p;
}
});
if (packagePath != null) {
return packagePath;
}
throw new Error('Could not find apk');
}
case utilities.IOS: {
const searchDir = options.device
? path.join(fullAppPath, 'platforms', 'ios', 'build', 'device')
: path.join(fullAppPath, 'platforms', 'ios', 'build', 'emulator');
const mask = options.device ? '.ipa$' : '.app$';
const files = fs.readdirSync(searchDir)
.filter(file => file.match(new RegExp(mask)));
logger.normal(`paramedic-appium: Looking for the app package in "${searchDir}" with the filter of "${mask}"`);
if (files && files.length > 0) {
logger.normal('paramedic-appium: Found the app package: ' + files[0]);
return path.resolve(searchDir, files[0]);
}
throw new Error('Could not find the app package');
}
}
}