Skip to content

Commit

Permalink
Merge pull request #112 from LambdaTest/dev
Browse files Browse the repository at this point in the history
Release 2.3.0
  • Loading branch information
japneetlambdatest authored Feb 25, 2022
2 parents 62d74d2 + 6082dad commit dea68f0
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 4 deletions.
2 changes: 1 addition & 1 deletion commands/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = function (args) {
.sync_args_from_cmd(args)
.then(function (lt_config) {
//validate the config options
validate(lt_config)
validate(lt_config, resp)
.then(function () {
batcher
.make_batches(lt_config)
Expand Down
7 changes: 7 additions & 0 deletions commands/utils/set_args.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,13 @@ function sync_args_from_cmd(args) {
if (!("downloads" in lt_config["run_settings"])) {
lt_config["run_settings"]["downloads"] = "";
}
//Check for cypress settings
if ("cypress_settings" in args) {
lt_config["run_settings"]["cypress_settings"] = args["cypress_settings"];
} else if (!lt_config["run_settings"]["cypress_settings"]) {
lt_config["run_settings"]["cypress_settings"] = "";
}

//get specs from current directory if specs are not passed in config or cli
if (
(lt_config["run_settings"]["specs"] == undefined ||
Expand Down
29 changes: 27 additions & 2 deletions commands/utils/validate.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const fs = require("fs");
const constants = require("./constants.js");
module.exports = validate_config = function (lt_config) {
module.exports = validate_config = function (lt_config, validation_configs) {
return new Promise(function (resolve, reject) {
//validate auth keys are present
if (
Expand Down Expand Up @@ -168,15 +168,40 @@ module.exports = validate_config = function (lt_config) {
for (folder in download_folders) {
console.log(download_folders[folder]);
if (download_folders[folder][0] != ".") {
reject("Error!! dowloads folder path is not relative ", folder);
reject("Error!! dowloads folder path is not relative " + folder);
}
}
}

if (lt_config["run_settings"]["cypress_settings"] != "") {
let settings = lt_config["run_settings"]["cypress_settings"].split(";");
//let setting_names = [];
let settings_flag = true;
let setting_param = "";
for (let i = 0; i < settings.length; i++) {
if (
validation_configs.blacklistCommands.includes(
settings[i].split(" ")[0]
)
) {
settings_flag = false;
setting_param = settings[i].split(" ")[0];
break;
}
}
if (settings_flag == false) {
reject(
"Error!! Following cypress param is not allowed " + setting_param
);
}
}

if ("smart_ui" in lt_config.run_settings) {
if (!("project" in lt_config.run_settings.smart_ui)) {
reject("Smart UI project name is missing");
} else if (lt_config.run_settings.smart_ui.project == "") {
reject("Smart UI porject name can not be blank");

}
}
resolve("Validated the Config");
Expand Down
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ const argv = require("yargs")
alias: "exit-on-failure",
describe: "Exit With Code 1 on failure",
type: "string",
})
.option("cy", {
alias: "cypress_settings",
describe: "Pass Cypress Settings",
type: "string",
});
},
function (argv) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lambdatest-cypress-cli",
"version": "2.2.0",
"version": "2.3.0",
"description": "The lambdatest-cypress-cli is LambdaTest's command-line interface (CLI) aimed to help you run your Cypress tests on LambdaTest platform.",
"homepage": "https://github.com/LambdaTest/lambdatest-cypress-cli",
"author": "LambdaTest <[email protected]>",
Expand Down

0 comments on commit dea68f0

Please sign in to comment.