File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 11import _ from 'lodash' ;
22import { buildSafariPreferences } from './app-utils' ;
3- import { utilities } from 'appium-ios -device' ;
3+ import { getConnectedDevices } from './real -device' ;
44
55const DEFAULT_APP_INSTALLATION_TIMEOUT_MS = 8 * 60 * 1000 ;
66
@@ -114,11 +114,11 @@ export function applySafariStartupArgs() {
114114 */
115115export async function detectUdid ( ) {
116116 this . log . debug ( 'Auto-detecting real device udid...' ) ;
117- const udids = await utilities . getConnectedDevices ( ) ;
117+ const udids = await getConnectedDevices ( ) ;
118118 if ( _ . isEmpty ( udids ) ) {
119119 throw new Error ( 'No real devices are connected to the host' ) ;
120120 }
121- const udid = _ . last ( udids ) ;
121+ const udid = udids [ udids . length - 1 ] ;
122122 if ( udids . length > 1 ) {
123123 this . log . info ( `Multiple devices found: ${ udids . join ( ', ' ) } ` ) ;
124124 this . log . info ( `Choosing '${ udid } '. Consider settings the 'udid' capability if another device must be selected` ) ;
Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ const INSTALLATION_STAGING_DIR = 'PublicStaging';
1616 * @returns {Promise<string[]> }
1717 */
1818export async function getConnectedDevices ( ) {
19+ if ( [ 'yes' , 'true' , '1' ] . includes ( _ . toLower ( process . env . APPIUM_XCUITEST_PREFER_DEVICECTL ) ) ) {
20+ return ( await new Devicectl ( '' ) . listDevices ( ) )
21+ . map ( ( { hardwareProperties} ) => hardwareProperties ?. udid )
22+ . filter ( Boolean ) ;
23+ }
1924 return await utilities . getConnectedDevices ( ) ;
2025}
2126
Original file line number Diff line number Diff line change 9898 "lru-cache" : " ^11.1.0" ,
9999 "moment" : " ^2.29.4" ,
100100 "moment-timezone" : " ^0.x" ,
101- "node-devicectl" : " ^1.0.1 " ,
101+ "node-devicectl" : " ^1.1.0 " ,
102102 "node-simctl" : " ^8.0.0" ,
103103 "portscanner" : " ^2.2.0" ,
104104 "semver" : " ^7.5.4" ,
You can’t perform that action at this time.
0 commit comments