Skip to content

3.0.7 #212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Nov 29, 2022
Merged

3.0.7 #212

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
44 changes: 26 additions & 18 deletions commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,38 @@ function create_file(file_path, content) {
}

function create_ltconfig_file(args) {
let config = require('./utils/default_config.js')
let content = JSON.stringify(config, null, 3);
if (args._.length == 1) {
create_file(constants.LT_CONFIG_NAME, content)
let cv=9.6
if("cv" in args){
cv=args["cv"]
}
else if (args._.length > 1) {
let config =parseInt(cv)>=10?require('./utils/default_config_10.js'):require('./utils/default_config_9.js')
config.run_settings.npm_dependencies.cypress=cv.toString()
let content = JSON.stringify(config, null, 3);
if ("config-file-name" in args && args["config-file-name"] !=""){
//check if file or directory exists
if (fs.existsSync(args._[1])) {
let stats = fs.statSync(args._[1]);
if (fs.existsSync(args["config-file-name"])) {
let stats = fs.statSync(args["config-file-name"]);
if (stats.isFile()) {
make_file(args._[1], content)
create_file(args["config-file-name"], content)
}
else {
create_file(path.join(args._[1], constants.LT_CONFIG_NAME), content)
create_file(path.join(args["config-file-name"], constants.LT_CONFIG_NAME), content)
}
}
else {
filename = path.basename(args._[1])
filename = path.basename(args["config-file-name"])
var re = new RegExp(".+\\..+");
if (re.test(filename)) {
fs.mkdirSync(path.dirname(args._[1]), { recursive: true });
create_file(args._[1], content)
}
else {
fs.mkdirSync(args._[1], { recursive: true });
create_file(path.join(args._[1], constants.LT_CONFIG_NAME), content)
fs.mkdirSync(path.dirname(args["config-file-name"]), { recursive: true });
create_file(args["config-file-name"], content)
}else {
fs.mkdirSync(args["config-file-name"], { recursive: true });
create_file(path.join(args["config-file-name"], constants.LT_CONFIG_NAME), content)
}
}
}else{
console.log("Picking the default config file name ",constants.LT_CONFIG_NAME)
create_file(constants.LT_CONFIG_NAME, content)
}
};

Expand All @@ -59,13 +63,17 @@ function create_custom_support_file(args){
console.log("Error while copying custom support file", err);
}
else {
console.log("Successfully saved custom support file at - ", pathToNewDestination);
console.log("Saved at ", pathToNewDestination);
}
});
}

module.exports = function (args) {
create_ltconfig_file(args);
create_base_reporter_config_file(args);
create_custom_support_file(args);
if ("cv" in args){
if (parseInt(args["cv"])>=10){
create_custom_support_file(args);
}
}
};
10 changes: 5 additions & 5 deletions commands/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ module.exports = {
"https://api.lambdatest.com/automation/api/v1/cypress/artefacts/test/",
},
beta: {
INTEGRATION_BASE_URL: "https://api.cypress-v3.dev.lambdatest.io/liis",
INTEGRATION_BASE_URL: "https://api-cypress-v1-dev.lambdatestinternal.com/liis",
BUILD_BASE_URL:
"https://api.cypress-v3.dev.lambdatest.io/automation/api/v1/builds/",
"https://api-cypress-v1-dev.lambdatestinternal.com/automation/api/v1/builds/",
BUILD_STOP_URL:
"https://api.cypress-v3.dev.lambdatest.io/api/v1/test/stop?sessionId=",
"https://api-cypress-v1-dev.lambdatestinternal.com/api/v1/test/stop?sessionId=",
SESSION_URL:
"https://api.cypress-v3.dev.lambdatest.io/automation/api/v1/sessions?limit=200&session_id=",
"https://api-cypress-v1-dev.lambdatestinternal.com/automation/api/v1/sessions?limit=200&session_id=",
REPORT_URL:
"https://api.cypress-v3.dev.lambdatest.io/automation/api/v1/cypress/artefacts/test/",
"https://api-cypress-v1-dev.lambdatestinternal.com/automation/api/v1/cypress/artefacts/test/",
},
stage: {
INTEGRATION_BASE_URL: "https://stage-api.lambdatestinternal.com/liis",
Expand Down
34 changes: 34 additions & 0 deletions commands/utils/default_config_10.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module.exports = {
lambdatest_auth: {
username: "<Your LambdaTest username>",
access_key: "<Your LambdaTest access key>",
},
browsers: [
{
browser: "Chrome",
platform: "Windows 10",
versions: ["latest-1"],
},
{
browser: "Firefox",
platform: "Windows 10",
versions: ["latest-1"],
},
],
run_settings: {
reporter_config_file: "base_reporter_config.json",
build_name: "build-name",
parallels: 1,
specs: "<path_of_cypress_spec_files>",
ignore_files: "",
network: false,
headless: false,
npm_dependencies: {
cypress: "10.5.0",
},
},
tunnel_settings: {
tunnel: false,
tunnel_name: null,
},
};
File renamed without changes.
2 changes: 1 addition & 1 deletion commands/utils/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ module.exports = validate_config = function (lt_config, validation_configs) {
lt_config["run_settings"]["cypress_config_file"]
) {
reject(
'Error!! --ccf flag and cypress_config_file is not supported with cypress>=10,use \n --cy="--config-file <file path>"'
'Error!! --ccf flag, cypress_config_file, cypress.json is not supported with cypress>=10,remove cypress.json if present and use \n --cy="--config-file <file path>" For passing custom config files'
);
}

Expand Down
14 changes: 13 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,19 @@ const { init } = require("./commands/init");

const argv = require("yargs")
.usage("Usage: $0 <command> [options]")
.command("init", "create an intial config file", {}, function (argv) {
.command("init", "create an intial config file", function(yargs){
return yargs
.option("cv",{
alias: "cypress-version",
describe: "Cypress version",
type: "int",
})
.option("f",{
alias: "config-file-name",
describe: "Cypress version",
type: "string",
})
}, function (argv) {
require("./commands/init")(argv);
})
.command(
Expand Down
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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": "3.0.6",
"version": "3.0.7",
"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