File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed
Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -31,17 +31,19 @@ export class DeviceManger implements IDeviceManager {
3131 let device : IDevice = DeviceManger . getDefaultDevice ( args ) ;
3232 if ( process . env [ "DEVICE_TOKEN" ] ) {
3333 device . token = process . env [ "DEVICE_TOKEN" ] ;
34- console . log ( "Device" , device ) ;
35- return device ;
34+ const allDevices = await DeviceController . getDevices ( { platform : args . appiumCaps . platformName } ) ;
35+ const foundDevice = DeviceController . filter ( allDevices , { token : device . token } ) [ 0 ] ;
36+ console . log ( "Device: " , foundDevice ) ;
37+ return foundDevice ;
3638 }
39+
3740 // When isSauceLab specified we simply do nothing;
3841 if ( args . isSauceLab || args . ignoreDeviceController ) {
3942 DeviceManger . _emulators . set ( args . runType , device ) ;
40-
4143 return device ;
4244 }
4345
44- const allDevices = ( await DeviceController . getDevices ( { platform : args . appiumCaps . platformName } ) ) ;
46+ const allDevices = await DeviceController . getDevices ( { platform : args . appiumCaps . platformName } ) ;
4547 if ( ! allDevices || allDevices === null || allDevices . length === 0 ) {
4648 console . log ( "We couldn't find any devices. We will try to proceed to appium! Maybe avd manager is missing" )
4749 console . log ( "Available devices:\n" , allDevices ) ;
Original file line number Diff line number Diff line change @@ -125,10 +125,14 @@ export class UIElement {
125125 const actRect = await this . getRectangle ( ) ;
126126 if ( this . _args . isIOS ) {
127127 const density = this . _args . device . config . density ;
128- actRect . x *= density ;
129- actRect . y *= density ;
130- actRect . width *= density ;
131- actRect . height *= density ;
128+ if ( density ) {
129+ actRect . x *= density ;
130+ actRect . y *= density ;
131+ actRect . width *= density ;
132+ actRect . height *= density ;
133+ } else {
134+ throw new Error ( "Device's density is undefined!" ) ;
135+ }
132136 }
133137 return actRect ;
134138 }
You can’t perform that action at this time.
0 commit comments