Skip to content

Commit dccb7ce

Browse files
chore: apply devce_token from env
1 parent a7cd21e commit dccb7ce

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

lib/device-manager.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export declare class DeviceManager implements IDeviceManager {
99
installApp(args: INsCapabilities): Promise<any>;
1010
uninstallApp(args: INsCapabilities): Promise<any>;
1111
static kill(device: IDevice): Promise<void>;
12-
static getDefaultDevice(args: INsCapabilities, deviceName?: string, token?: string, type?: DeviceType, platformVersion?: number): any;
12+
static getDefaultDevice(args: INsCapabilities, deviceName?: string, token?: string, type?: DeviceType, platformVersion?: number): IDevice;
1313
static setDontKeepActivities(args: INsCapabilities, driver: any, value: any): Promise<void>;
1414
static executeShellCommand(driver: any, commandAndargs: {
1515
command: string;
@@ -18,4 +18,5 @@ export declare class DeviceManager implements IDeviceManager {
1818
static getDensity(args: INsCapabilities, driver: any): Promise<void>;
1919
static applyDeviceAdditionsSettings(driver: any, args: INsCapabilities, sessionIfno: any): Promise<void>;
2020
getPackageId(device: IDevice, appPath: string): string;
21+
private static cleanUnsetProp;
2122
}

lib/device-manager.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ export class DeviceManager implements IDeviceManager {
3232
public async startDevice(args: INsCapabilities): Promise<IDevice> {
3333
args.appiumCaps.platformName = args.appiumCaps.platformName.toLowerCase();
3434
let device: IDevice = DeviceManager.getDefaultDevice(args);
35-
console.log("Default device: ", device);
3635
const token = process.env["DEVICE_TOKEN"] || process.env.npm_config_deviceToken;
37-
if (token) {
38-
device.token = device.token.replace("emulator-", "");
39-
device.name = process.env["DEVICE_NAME"] || device.name;
40-
DeviceManager.cleanUnsetProp(device);
36+
device.token = device.token.replace("emulator-", "");
37+
device.name = process.env["DEVICE_NAME"] || device.name;
38+
console.log("Default device: ", device);
39+
DeviceManager.cleanUnsetProp(device);
40+
41+
if (device.token) {
4142
device = await DeviceController.getDevices(device)[0];
4243
logInfo("Device: ", device);
4344
return device;

lib/image-helper.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export declare class ImageHelper {
1010
blockOutAreas: IRectangle[];
1111
imageOutputLimit(): ImageOptions;
1212
thresholdType(): ImageOptions;
13-
threshold(thresholdType: any): 10 | 0.01;
13+
threshold(thresholdType: any): 0.01 | 10;
1414
delta(): number;
1515
static cropImageDefault(_args: INsCapabilities): {
1616
x: number;

0 commit comments

Comments
 (0)