Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/device-manager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { logError, logInfo, logWarn } from "./utils";
import { logError, logInfo, logWarn, shouldUserMobileDevicesController } from "./utils";
import { INsCapabilities } from "./interfaces/ns-capabilities";
import { IDeviceManager } from "./interfaces/device-manager";
import {
Expand Down Expand Up @@ -28,7 +28,7 @@ export class DeviceManager implements IDeviceManager {
DeviceManager.cleanUnsetProperties(device);
console.log("Default device: ", device);

if (!!process.env["USE_MOBILE_DEVICES_CONTROLLER_SERVER"]) {
if (shouldUserMobileDevicesController(args)) {
device = (await DeviceController.getDevices(device))[0];
logInfo("Device: ", device);
return device;
Expand Down
1 change: 1 addition & 0 deletions lib/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export declare const prepareDevice: (args: INsCapabilities, deviceManager: IDevi
export declare const prepareApp: (args: INsCapabilities) => Promise<INsCapabilities>;
export declare const sessionIds: (port: any) => Promise<any[]>;
export declare function encodeImageToBase64(path: any): string;
export declare const shouldUserMobileDevicesController: (args: INsCapabilities) => boolean;
export declare function logInfo(info: any, obj?: any): void;
export declare function logWarn(info: any, obj?: any): void;
export declare function logError(info: any, obj?: any): void;
Expand Down
9 changes: 9 additions & 0 deletions lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,15 @@ const convertObjToString = obj => {

return "";
}

export const shouldUserMobileDevicesController = (args: INsCapabilities)=>{
const useDsCS = process.env["USE_DEVICES_CONTROLLER_SERVER"] || false;
const useMDsCS = process.env["USE_MOBILE_DEVICES_CONTROLLER_SERVER"] || false;

return !args.isSauceLab && (new RegExp(`${useDsCS}`).test(`true`) || new RegExp(`${useMDsCS}`).test(`true`));
}


export function logInfo(info, obj = undefined) {
info += " " + convertObjToString(obj);
console.log(`${ConsoleColor.FgCyan}%s${ConsoleColor.Reset}`, info);
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{
"name": "SvetoslavTsenov",
"email": "tsenov@progress.com"
}
}
],
"bin": {
"nativescript-dev-appium": "./bin/nativescript-dev-appium",
Expand All @@ -37,18 +37,18 @@
"frame-comparer": "^2.0.1",
"glob": "^7.1.0",
"inquirer": "^6.2.0",
"mobile-devices-controller": "~3.1.5-2",
"mobile-devices-controller": "~4.0.0-1",
"wd": "~1.11.1",
"webdriverio": "~4.14.0",
"yargs": "~12.0.5"
},
"devDependencies": {
"@types/chai": "^4.1.7",
"@types/mocha": "^5.2.5",
"@types/node": "~10.12.18",
"typescript": "~3.1.6",
"mocha": "^5.2.0",
"chai": "^4.2.0",
"@types/mocha": "^5.2.5",
"@types/chai": "^4.1.7"
"mocha": "^5.2.0",
"typescript": "~3.1.6"
},
"scripts": {
"postinstall": "node ./postinstall.js",
Expand Down