@@ -141,7 +141,7 @@ function getAllFileNames(folder) {
141141// return files;
142142// }
143143
144- export function shutdown ( processToKill : childProcess . ChildProcess , verbose ) {
144+ export function shutdown ( processToKill : any , verbose ) {
145145 try {
146146 if ( processToKill && processToKill !== null ) {
147147 if ( isWin ( ) ) {
@@ -307,22 +307,39 @@ export function getAppPath(caps: INsCapabilities) {
307307 }
308308 } else {
309309 const iosPlatformsPath = 'platforms/ios/build' ;
310- const appType = caps . runType || caps . device . type === DeviceType . SIMULATOR ? "sim" : "device" ;
311- basePath = appType . includes ( "device" ) ? `${ iosPlatformsPath } /device/**/*.ipa` : `${ iosPlatformsPath } /emulator/**/*.app` ;
310+ // possible paths
311+ // "Release-iphoneos"
312+ // "Release-iphonesimulator"
313+ // "Debug-iphoneos"
314+ // "Debug-iphonesimulator"
315+ // "device"
316+ // "emulator"
317+ if ( caps . device && caps . device . type ) {
318+ basePath = caps . device . type === DeviceType . DEVICE ? `${ iosPlatformsPath } /**/*.ipa` : `${ iosPlatformsPath } /**/*.app` ;
319+ } else if ( caps . runType . startsWith ( "dev" ) ) {
320+ basePath = `${ iosPlatformsPath } /**/*.ipa` ;
321+ } else {
322+ basePath = `${ iosPlatformsPath } /**/*.app` ;
323+ }
312324 }
313325 }
314326
315327 let apps = glob . sync ( basePath ) ;
316-
317328 if ( ! apps || apps . length === 0 ) {
318- apps = glob . sync ( `${ caps . projectDir } ` )
319- . filter ( function ( file ) {
320- return file . endsWith ( ".ipa" ) || file . endsWith ( ".app" ) || file . endsWith ( ".apk" )
321- } ) ;
329+ if ( caps . isAndroid ) {
330+ apps = glob . sync ( `${ caps . projectDir } /**/*.apk` ) ;
331+ }
332+ if ( caps . isIOS ) {
333+ if ( caps . runType . startsWith ( "dev" ) ) {
334+ apps = glob . sync ( `${ caps . projectDir } /**/*.app` ) ;
335+ } else {
336+ apps = glob . sync ( `${ caps . projectDir } /**/*.ipa` ) ;
337+ }
338+ }
322339 }
323340
324341 if ( ! apps || apps . length === 0 ) {
325- logError ( `No 'app' capability provided or the convension for 'runType'${ caps . runType } is not as excpeced !
342+ logError ( `No 'app' capability provided or the convention for 'runType'${ caps . runType } is not as expected !
326343 In order to automatically search and locate app package please use 'device' in your 'runType' name. E.g --runType device.iPhone7.iOS110, --runType sim.iPhone7.iOS110 or
327344 specify correct app path` ) ;
328345 }
@@ -582,7 +599,7 @@ const convertObjToString = obj => {
582599 return "" ;
583600}
584601
585- export const shouldUserMobileDevicesController = ( args : INsCapabilities ) => {
602+ export const shouldUserMobileDevicesController = ( args : INsCapabilities ) => {
586603 const useDsCS = process . env [ "USE_DEVICES_CONTROLLER_SERVER" ] || false ;
587604 const useMDsCS = process . env [ "USE_MOBILE_DEVICES_CONTROLLER_SERVER" ] || false ;
588605
0 commit comments