Skip to content

Commit f24867e

Browse files
authored
Merge pull request #155 from japneetlambdatest/MLE-10074
build tag support for cypress tests
2 parents 792ee23 + 9a72081 commit f24867e

File tree

3 files changed

+50
-1
lines changed

3 files changed

+50
-1
lines changed

commands/utils/set_args.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,39 +262,57 @@ function sync_args_from_cmd(args) {
262262
if (!("downloads" in lt_config["run_settings"])) {
263263
lt_config["run_settings"]["downloads"] = "";
264264
}
265+
265266
//Check for cypress settings
266267
if ("cypress_settings" in args) {
267268
lt_config["run_settings"]["cypress_settings"] = args["cypress_settings"];
268269
} else if (!lt_config["run_settings"]["cypress_settings"]) {
269270
lt_config["run_settings"]["cypress_settings"] = "";
270271
}
272+
271273
//Check for geo location
272274
if ("geo_location" in args) {
273275
lt_config["run_settings"]["geo_location"] = args["geo_location"];
274276
} else if (!lt_config["run_settings"]["geo_location"]) {
275277
lt_config["run_settings"]["geo_location"] = "";
276278
}
279+
277280
//Check for stop on failure location
278281
if ("stop_on_failure" in args) {
279282
lt_config["run_settings"]["stop_on_failure"] = true;
280283
} else if (!lt_config["run_settings"]["stop_on_failure"]) {
281284
lt_config["run_settings"]["stop_on_failure"] = false;
282285
}
286+
283287
if (
284288
lt_config.run_settings.project_name &&
285289
!lt_config.run_settings.project_key
286290
) {
287291
lt_config.run_settings.project_key = lt_config.run_settings.project_name;
288292
}
293+
289294
if (
290295
!lt_config.run_settings.project_name &&
291296
lt_config.run_settings.project_key
292297
) {
293298
lt_config.run_settings.project_name = lt_config.run_settings.project_key;
294299
}
300+
295301
if (lt_config.run_settings.project_autocreate == undefined) {
296302
lt_config.run_settings.project_autocreate = true;
297303
}
304+
305+
//set build tags from args
306+
if ("build-tags" in args) {
307+
lt_config["run_settings"]["build_tags"] = args["build-tags"].split(",");
308+
} else if (
309+
lt_config["run_settings"]["build_tags"] != undefined &&
310+
lt_config["run_settings"]["build_tags"] != ""
311+
) {
312+
lt_config["run_settings"]["build_tags"] =
313+
lt_config["run_settings"]["build_tags"].split(",");
314+
}
315+
298316
//get specs from current directory if specs are not passed in config or cli
299317
if (
300318
(lt_config["run_settings"]["specs"] == undefined ||

commands/utils/validate.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,32 @@ module.exports = validate_config = function (lt_config, validation_configs) {
283283
}
284284
}
285285

286+
//Validate Build Tags
287+
//1) less than 5
288+
//2) each tag should be less than 50 characters
289+
if (lt_config.run_settings.build_tags) {
290+
if (lt_config.run_settings.build_tags.length > 5) {
291+
reject("Build Tags can not be more than 5");
292+
}
293+
for (let i = 0; i < lt_config.run_settings.build_tags.length; i++) {
294+
if (lt_config.run_settings.build_tags[i].length > 50) {
295+
reject("Build Tags can not have over 50 characters");
296+
}
297+
}
298+
}
299+
//Validate Test Tags
300+
//1) less than 6
301+
//2) each tag should be less than 50 characters
302+
if (lt_config.run_settings.tags) {
303+
if (lt_config.run_settings.tags.length > 6) {
304+
reject("Test Tags can not be more than 6");
305+
}
306+
for (let i = 0; i < lt_config.run_settings.tags.length; i++) {
307+
if (lt_config.run_settings.tags[i].length > 50) {
308+
reject("Test Tags can not have over 50 characters");
309+
}
310+
}
311+
}
286312
resolve("Validated the Config");
287313
});
288314
};

index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const argv = require("yargs")
3939
})
4040
.option("t", {
4141
alias: "tags",
42-
describe: "build tags",
42+
describe: "test tags",
4343
type: "string",
4444
})
4545
.option("p", {
@@ -116,6 +116,11 @@ const argv = require("yargs")
116116
alias: "stop_on_failure",
117117
describe: "Stop other tests if any test in session gets errored out",
118118
type: "bool",
119+
})
120+
.option("bt", {
121+
alias: "build-tags",
122+
describe: "build tags",
123+
type: "string",
119124
});
120125
},
121126
function (argv) {

0 commit comments

Comments
 (0)