Skip to content

Commit 6abf357

Browse files
refactor: remove some caps that are no longer valid as server and etc.
1 parent 4d42d51 commit 6abf357

File tree

5 files changed

+7
-14
lines changed

5 files changed

+7
-14
lines changed

Diff for: lib/appium-driver.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ export class AppiumDriver {
194194
console.log(error);
195195
console.log("Rety launching appium driver!");
196196
if (error && error.message && error.message.includes("WebDriverAgent")) {
197-
let freePort = await findFreePort(100, args.appiumCaps.port, args);
197+
const freePort = await findFreePort(100, args.wdaLocalPort);
198198
console.log("args.appiumCaps['wdaLocalPort']", freePort);
199199
args.appiumCaps["wdaLocalPort"] = freePort;
200200
}

Diff for: lib/appium-server.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class AppiumServer {
6363

6464
log("Starting server...", this._args.verbose);
6565
const logLevel = this._args.verbose === true ? "debug" : "info";
66-
this.port = port || this._args.port;
66+
this.port = this._args.port || port;
6767
let retry = false;
6868

6969
this.startAppiumServer(logLevel);
@@ -74,7 +74,7 @@ export class AppiumServer {
7474
while (retries > 0 && !response) {
7575
retries--;
7676
this.port += 10;
77-
this.port = (await findFreePort(100, this.port, this._args));
77+
this.port = (await findFreePort(100, this.port));
7878

7979
this.startAppiumServer(logLevel);
8080
response = await waitForOutput(this._server, /listener started/, /Error: listen/, 60000, true);

Diff for: lib/parser.ts

+2-9
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const config = (() => {
1010
.option("testFolder", { describe: "e2e test folder name", default: "e2e", type: "string" })
1111
.option("appiumCapsLocation", { describe: "Capabilities", type: "string" })
1212
.option("sauceLab", { describe: "SauceLab", default: false, type: "boolean" })
13-
.option("port", { alias: "p", describe: "Appium port", type: "string" })
14-
.option("wdaLocalPort", { alias: "p", describe: "WDA port", type: "string" })
13+
.option("port", { alias: "p", describe: "Appium port", default: 8300, type: "number" })
14+
.option("wdaLocalPort", { alias: "wda", describe: "WDA port", default: 8410, type: "number" })
1515
.option("verbose", { alias: "v", describe: "Log actions", type: "boolean" })
1616
.option("path", { describe: "path", default: process.cwd(), type: "string" })
1717
.option("appPath", { describe: "application path", type: "string" })
@@ -20,13 +20,6 @@ const config = (() => {
2020
.option("reuseDevice", { describe: "Reusing device if available.", type: "boolean", default: false })
2121
.option("devMode", { alias: "dev-mode", describe: "Will skipp app instalation and will reuse the one installed on device!", type: "boolean", default: false })
2222
.option("ignoreDeviceController", { alias: "i-ns-device-controller", describe: "Use default appium options for running emulatos/ simulators.", type: "boolean", default: false })
23-
.option("useDeviceControllerServer", {
24-
alias: "use-ns-device-controller-server",
25-
describe: "Use server to boot, kill, subscribe or unsubscribe for devices. Also this flag could be specified in as an evn variable",
26-
type: "boolean",
27-
default: false
28-
})
29-
.option("deviceControllerServerPort", { describe: "Reusing device if available.", type: "boolean", default: false })
3023
.help()
3124
.argv;
3225

Diff for: lib/utils.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ export declare function calculateOffset(direction: any, y: number, yOffset: numb
3737
export declare function scroll(wd: any, driver: any, direction: Direction, isIOS: boolean, y: number, x: number, yOffset: number, xOffset: number, verbose: any): Promise<void>;
3838
export declare const addExt: (fileName: string, ext: string) => string;
3939
export declare const isPortAvailable: (port: any) => Promise<{}>;
40-
export declare const findFreePort: (retries: number, port: number, args: INsCapabilities) => Promise<number>;
40+
export declare const findFreePort: (retries?: number, port?: number) => Promise<number>;
4141
export declare function wait(milisecodns: any): void;

Diff for: lib/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ export const isPortAvailable = (port) => {
445445
});
446446
};
447447

448-
export const findFreePort = async (retries: number = 10, port: number = 3000, args: INsCapabilities) => {
448+
export const findFreePort = async (retries: number = 10, port: number = 3000) => {
449449
let p: number = port;
450450

451451
while (!(await isPortAvailable(p)) && retries > 0) {

0 commit comments

Comments
 (0)