Skip to content

Commit 642faa2

Browse files
Merge pull request #224 from japneetlambdatest/CYP-600
validations added and DP changes
2 parents 9d982dc + 2adec77 commit 642faa2

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

commands/utils/set_args.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,12 @@ function sync_args_from_cmd(args) {
202202
lt_config["tunnel_settings"]["tunnel_name"] = "";
203203
}
204204

205+
// to avoid passing tunnel name to upstream service if tunnel is false
206+
if (lt_config["tunnel_settings"]["tunnel"]==false){
207+
lt_config["tunnel_settings"]["tunnel_name"]=null
208+
}
209+
210+
205211
//add browsers from cli
206212
if ("browsers" in args) {
207213
browsers = args["browsers"].split(",");
@@ -401,6 +407,15 @@ function sync_args_from_cmd(args) {
401407
console.log("resolution set to ", args.res);
402408
lt_config.run_settings.resolution = args.res;
403409
}
410+
//Set values for Dedicated proxy
411+
if ("dedicated_proxy" in args) {
412+
lt_config["run_settings"]["dedicated_proxy"] = true
413+
? args["dedicated_proxy"] == "true"
414+
: false;
415+
} else if (!lt_config["run_settings"]["dedicated_proxy"]) {
416+
lt_config["run_settings"]["dedicated_proxy"] = false;
417+
}
418+
404419
//get specs from current directory if specs are not passed in config or cli
405420
if (
406421
(lt_config["run_settings"]["specs"] == undefined ||

commands/utils/validate.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,27 @@ module.exports = validate_config = function (lt_config, validation_configs) {
365365
});
366366
}
367367

368+
//validate if dedicated proxy field contains expected value
369+
if ("dedicated_proxy" in lt_config["run_settings"]) {
370+
if (!(typeof lt_config["run_settings"]["dedicated_proxy"] === "boolean")) {
371+
reject("Error!! boolean value is expected in dedicated_proxy key");
372+
}
373+
}
374+
375+
//validate if dedicatedproxy and tunnel are not passed simultaniously
376+
if (lt_config["run_settings"]["dedicated_proxy"]==true && lt_config["run_settings"]["geo_location"] !=""){
377+
reject("Error!! Dedicated Proxy and Geolocation can not be passed in same run")
378+
}
379+
//validate if tunnel and geo are not passed simultaniously
380+
if (lt_config["tunnel_settings"]["tunnel"]==true && lt_config["run_settings"]["geo_location"] !=""){
381+
reject("Error!! Tunnel and Geolocation can not be passed in same run")
382+
}
383+
//validate if dedicatedproxy and geo are not passed simultaniously
384+
if (lt_config["tunnel_settings"]["tunnel"]==true && lt_config["run_settings"]["dedicated_proxy"]==true){
385+
reject("Error!! Tunnel and Dedicated Proxy can not be passed in same run")
386+
}
387+
388+
if(lt_config)
368389
resolve(cypress_version);
369390
});
370391
};

index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@ const argv = require("yargs")
179179
alias: "resolution",
180180
describe: "machine resolution",
181181
type: "string",
182+
})
183+
.option("dp", {
184+
alias: "dedicated_proxy",
185+
describe: "dedicated proxy",
186+
type: "bool",
182187
});
183188
},
184189
function (argv) {

0 commit comments

Comments
 (0)