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 {
31
31
let device : IDevice = DeviceManger . getDefaultDevice ( args ) ;
32
32
if ( process . env [ "DEVICE_TOKEN" ] ) {
33
33
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 ;
36
38
}
39
+
37
40
// When isSauceLab specified we simply do nothing;
38
41
if ( args . isSauceLab || args . ignoreDeviceController ) {
39
42
DeviceManger . _emulators . set ( args . runType , device ) ;
40
-
41
43
return device ;
42
44
}
43
45
44
- const allDevices = ( await DeviceController . getDevices ( { platform : args . appiumCaps . platformName } ) ) ;
46
+ const allDevices = await DeviceController . getDevices ( { platform : args . appiumCaps . platformName } ) ;
45
47
if ( ! allDevices || allDevices === null || allDevices . length === 0 ) {
46
48
console . log ( "We couldn't find any devices. We will try to proceed to appium! Maybe avd manager is missing" )
47
49
console . log ( "Available devices:\n" , allDevices ) ;
Original file line number Diff line number Diff line change @@ -125,10 +125,14 @@ export class UIElement {
125
125
const actRect = await this . getRectangle ( ) ;
126
126
if ( this . _args . isIOS ) {
127
127
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
+ }
132
136
}
133
137
return actRect ;
134
138
}
You can’t perform that action at this time.
0 commit comments