browserstack-cypress-cli 1.6.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/commands/runs.js +34 -10
- package/bin/helpers/capabilityHelper.js +51 -6
- package/bin/helpers/config.json +2 -1
- package/bin/helpers/constants.js +18 -6
- package/bin/helpers/reporterHTML.js +12 -1
- package/bin/helpers/sync/failedSpecsDetails.js +2 -2
- package/bin/helpers/sync/syncSpecsLogs.js +6 -6
- package/bin/helpers/usageReporting.js +9 -2
- package/bin/helpers/utils.js +285 -20
- package/bin/helpers/zipUpload.js +6 -2
- package/bin/runner.js +21 -0
- package/bin/templates/configTemplate.js +5 -2
- package/package.json +8 -4
- package/test/unit/bin/commands/runs.js +88 -10
- package/test/unit/bin/helpers/capabilityHelper.js +131 -1
- package/test/unit/bin/helpers/reporterHTML.js +31 -0
- package/test/unit/bin/helpers/sync/syncSpecsLogs.js +2 -2
- package/test/unit/bin/helpers/utils.js +642 -21
- package/test/unit/bin/helpers/zipUpload.js +61 -2
package/bin/commands/runs.js
CHANGED
|
@@ -40,10 +40,19 @@ module.exports = function run(args) {
|
|
|
40
40
|
utils.setTestEnvs(bsConfig, args);
|
|
41
41
|
|
|
42
42
|
//accept the local from env variable if provided
|
|
43
|
-
utils.setLocal(bsConfig);
|
|
43
|
+
utils.setLocal(bsConfig, args);
|
|
44
|
+
|
|
45
|
+
// set Local Mode (on-demand/ always-on)
|
|
46
|
+
utils.setLocalMode(bsConfig, args);
|
|
44
47
|
|
|
45
48
|
//accept the local identifier from env variable if provided
|
|
46
|
-
utils.setLocalIdentifier(bsConfig);
|
|
49
|
+
utils.setLocalIdentifier(bsConfig, args);
|
|
50
|
+
|
|
51
|
+
// set Local Config File
|
|
52
|
+
utils.setLocalConfigFile(bsConfig, args);
|
|
53
|
+
|
|
54
|
+
// run test in headed mode
|
|
55
|
+
utils.setHeaded(bsConfig, args);
|
|
47
56
|
|
|
48
57
|
// Validate browserstack.json values and parallels specified via arguments
|
|
49
58
|
return capabilityHelper.validate(bsConfig, args).then(function (cypressJson) {
|
|
@@ -58,8 +67,12 @@ module.exports = function run(args) {
|
|
|
58
67
|
return archiver.archive(bsConfig.run_settings, config.fileName, args.exclude).then(function (data) {
|
|
59
68
|
|
|
60
69
|
// Uploaded zip file
|
|
61
|
-
return zipUploader.zipUpload(bsConfig, config.fileName).then(function (zip) {
|
|
70
|
+
return zipUploader.zipUpload(bsConfig, config.fileName).then(async function (zip) {
|
|
62
71
|
// Create build
|
|
72
|
+
|
|
73
|
+
//setup Local Testing
|
|
74
|
+
let bs_local = await utils.setupLocalTesting(bsConfig, args);
|
|
75
|
+
|
|
63
76
|
return build.createBuild(bsConfig, zip).then(function (data) {
|
|
64
77
|
let message = `${data.message}! ${Constants.userMessages.BUILD_CREATED} with build id: ${data.build_id}`;
|
|
65
78
|
let dashboardLink = `${Constants.userMessages.VISIT_DASHBOARD} ${data.dashboard_url}`;
|
|
@@ -79,7 +92,11 @@ module.exports = function run(args) {
|
|
|
79
92
|
}
|
|
80
93
|
|
|
81
94
|
if (args.sync) {
|
|
82
|
-
syncRunner.pollBuildStatus(bsConfig, data).then((exitCode) => {
|
|
95
|
+
syncRunner.pollBuildStatus(bsConfig, data).then(async (exitCode) => {
|
|
96
|
+
|
|
97
|
+
// stop the Local instance
|
|
98
|
+
await utils.stopLocalBinary(bsConfig, bs_local, args);
|
|
99
|
+
|
|
83
100
|
// Generate custom report!
|
|
84
101
|
reportGenerator(bsConfig, data.build_id, args, function(){
|
|
85
102
|
utils.sendUsageReport(bsConfig, args, `${message}\n${dashboardLink}`, Constants.messageTypes.SUCCESS, null);
|
|
@@ -93,17 +110,24 @@ module.exports = function run(args) {
|
|
|
93
110
|
if(!args.sync) logger.info(Constants.userMessages.EXIT_SYNC_CLI_MESSAGE.replace("<build-id>",data.build_id));
|
|
94
111
|
utils.sendUsageReport(bsConfig, args, `${message}\n${dashboardLink}`, Constants.messageTypes.SUCCESS, null);
|
|
95
112
|
return;
|
|
96
|
-
}).catch(function (err) {
|
|
113
|
+
}).catch(async function (err) {
|
|
97
114
|
// Build creation failed
|
|
98
115
|
logger.error(err);
|
|
116
|
+
// stop the Local instance
|
|
117
|
+
await utils.stopLocalBinary(bsConfig, bs_local, args);
|
|
118
|
+
|
|
99
119
|
utils.sendUsageReport(bsConfig, args, err, Constants.messageTypes.ERROR, 'build_failed');
|
|
100
120
|
});
|
|
101
121
|
}).catch(function (err) {
|
|
102
|
-
// Zip Upload failed
|
|
122
|
+
// Zip Upload failed | Local Start failed
|
|
103
123
|
logger.error(err);
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
124
|
+
if(err === Constants.userMessages.LOCAL_START_FAILED){
|
|
125
|
+
utils.sendUsageReport(bsConfig, args, `${err}\n${Constants.userMessages.LOCAL_START_FAILED}`, Constants.messageTypes.ERROR, 'local_start_failed');
|
|
126
|
+
} else {
|
|
127
|
+
logger.error(Constants.userMessages.ZIP_UPLOAD_FAILED);
|
|
128
|
+
fileHelpers.deleteZip();
|
|
129
|
+
utils.sendUsageReport(bsConfig, args, `${err}\n${Constants.userMessages.ZIP_UPLOAD_FAILED}`, Constants.messageTypes.ERROR, 'zip_upload_failed');
|
|
130
|
+
}
|
|
107
131
|
});
|
|
108
132
|
}).catch(function (err) {
|
|
109
133
|
// Zipping failed
|
|
@@ -122,7 +146,7 @@ module.exports = function run(args) {
|
|
|
122
146
|
|
|
123
147
|
// display browserstack.json is not valid only if validation of browserstack.json field has failed, otherwise display just the error message
|
|
124
148
|
// If parallels specified in arguments are invalid do not display browserstack.json is invalid message
|
|
125
|
-
if (
|
|
149
|
+
if (utils.isJSONInvalid(err, args)) {
|
|
126
150
|
logger.error(Constants.validationMessages.NOT_VALID);
|
|
127
151
|
}
|
|
128
152
|
|
|
@@ -42,18 +42,47 @@ const caps = (bsConfig, zip) => {
|
|
|
42
42
|
reject("Test suite is empty");
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
// Inferred settings
|
|
46
|
+
if(bsConfig.connection_settings){
|
|
47
|
+
if (bsConfig.connection_settings.local_mode_inferred) {
|
|
48
|
+
obj.local_mode_inferred = bsConfig.connection_settings.local_mode_inferred;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (bsConfig.connection_settings.local_inferred) {
|
|
52
|
+
obj.local_inferred = bsConfig.connection_settings.local_inferred;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (bsConfig.connection_settings.sync_inferred) {
|
|
56
|
+
obj.sync_inferred = bsConfig.connection_settings.sync_inferred;
|
|
57
|
+
logger.info('Setting "sync" mode to enable Local testing.');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
45
61
|
// Local
|
|
46
62
|
obj.local = false;
|
|
47
|
-
if (bsConfig.connection_settings && bsConfig.connection_settings.local === true)
|
|
48
|
-
|
|
63
|
+
if (bsConfig.connection_settings && bsConfig.connection_settings.local === true) {
|
|
64
|
+
obj.local = true;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
obj.localMode = null;
|
|
68
|
+
// Local Mode
|
|
69
|
+
if (obj.local === true && bsConfig.connection_settings.local_mode) {
|
|
70
|
+
obj.localMode = bsConfig.connection_settings.local_mode;
|
|
71
|
+
if (bsConfig.connection_settings.user_defined_local_mode_warning) {
|
|
72
|
+
logger.warn(Constants.userMessages.INVALID_LOCAL_MODE_WARNING);
|
|
73
|
+
}
|
|
74
|
+
logger.info(`Local testing set up in ${obj.localMode} mode.`);
|
|
75
|
+
}
|
|
49
76
|
|
|
50
77
|
// Local Identifier
|
|
51
78
|
obj.localIdentifier = null;
|
|
52
79
|
if (obj.local === true && (bsConfig.connection_settings.localIdentifier || bsConfig.connection_settings.local_identifier)) {
|
|
53
80
|
obj.localIdentifier = bsConfig.connection_settings.localIdentifier || bsConfig.connection_settings.local_identifier;
|
|
54
|
-
logger.
|
|
81
|
+
logger.info(`Local testing identifier: ${obj.localIdentifier}`);
|
|
55
82
|
}
|
|
56
83
|
|
|
84
|
+
logger.info(`Local is set to: ${obj.local} (${obj.local ? Constants.userMessages.LOCAL_TRUE : Constants.userMessages.LOCAL_FALSE})`);
|
|
85
|
+
|
|
57
86
|
// Project name
|
|
58
87
|
obj.project = "project-name";
|
|
59
88
|
// Build name
|
|
@@ -84,13 +113,19 @@ const caps = (bsConfig, zip) => {
|
|
|
84
113
|
if (!Utils.isUndefined(bsConfig.run_settings.cypress_version)){
|
|
85
114
|
obj.cypress_version = bsConfig.run_settings.cypress_version;
|
|
86
115
|
}
|
|
116
|
+
|
|
117
|
+
if (!Utils.isUndefined(bsConfig.run_settings.headless) && String(bsConfig.run_settings.headless) === "false"){
|
|
118
|
+
obj.headless = bsConfig.run_settings.headless;
|
|
119
|
+
} else {
|
|
120
|
+
logger.info(`Running your tests in headless mode. Use --headed arg to run in headful mode.`);
|
|
121
|
+
}
|
|
87
122
|
}
|
|
88
123
|
|
|
89
124
|
if(obj.parallels === Constants.cliMessages.RUN.DEFAULT_PARALLEL_MESSAGE) obj.parallels = undefined
|
|
90
125
|
|
|
91
|
-
if (obj.project) logger.
|
|
126
|
+
if (obj.project) logger.info(`Project name is: ${obj.project}`);
|
|
92
127
|
|
|
93
|
-
if (obj.customBuildName) logger.
|
|
128
|
+
if (obj.customBuildName) logger.info(`Build name is: ${obj.customBuildName}`);
|
|
94
129
|
|
|
95
130
|
if (obj.callbackURL) logger.info(`callback url is : ${obj.callbackURL}`);
|
|
96
131
|
|
|
@@ -126,6 +161,16 @@ const validate = (bsConfig, args) => {
|
|
|
126
161
|
// if parallels specified via arguments validate only arguments
|
|
127
162
|
if (!Utils.isUndefined(args) && !Utils.isUndefined(args.parallels) && !Utils.isParallelValid(args.parallels)) reject(Constants.validationMessages.INVALID_PARALLELS_CONFIGURATION);
|
|
128
163
|
|
|
164
|
+
// validate local args i.e --local-mode and --local-identifier
|
|
165
|
+
|
|
166
|
+
if( Utils.searchForOption('--local-identifier') && (Utils.isUndefined(args.localIdentifier) || (!Utils.isUndefined(args.localIdentifier) && !args.localIdentifier.trim()))) reject(Constants.validationMessages.INVALID_CLI_LOCAL_IDENTIFIER);
|
|
167
|
+
|
|
168
|
+
if( Utils.getLocalFlag(bsConfig.connection_settings) && (Utils.isUndefined(bsConfig["connection_settings"]["local_identifier"]) || ( !Utils.isUndefined(bsConfig["connection_settings"]["local_identifier"]) && !bsConfig["connection_settings"]["local_identifier"].trim()))) reject(Constants.validationMessages.INVALID_LOCAL_IDENTIFIER);
|
|
169
|
+
|
|
170
|
+
if( Utils.searchForOption('--local-mode') && ( Utils.isUndefined(args.localMode) || (!Utils.isUndefined(args.localMode) && !["always-on","on-demand"].includes(args.localMode)))) reject(Constants.validationMessages.INVALID_LOCAL_MODE);
|
|
171
|
+
|
|
172
|
+
if( Utils.searchForOption('--local-config-file') && ( Utils.isUndefined(args.localConfigFile) || (!Utils.isUndefined(args.localConfigFile) && !fs.existsSync(args.localConfigFile)))) reject(Constants.validationMessages.INVALID_LOCAL_CONFIG_FILE);
|
|
173
|
+
|
|
129
174
|
// validate if config file provided exists or not when cypress_config_file provided
|
|
130
175
|
// validate the cypressProjectDir key otherwise.
|
|
131
176
|
let cypressConfigFilePath = bsConfig.run_settings.cypressConfigFilePath;
|
|
@@ -139,7 +184,7 @@ const validate = (bsConfig, args) => {
|
|
|
139
184
|
cypressJson = JSON.parse(cypressJsonContent);
|
|
140
185
|
|
|
141
186
|
// Cypress Json Base Url & Local true check
|
|
142
|
-
if (!Utils.isUndefined(cypressJson.baseUrl) && cypressJson.baseUrl.includes("localhost") && !Utils.getLocalFlag(bsConfig.connection_settings)) reject(Constants.validationMessages.LOCAL_NOT_SET);
|
|
187
|
+
if (!Utils.isUndefined(cypressJson.baseUrl) && cypressJson.baseUrl.includes("localhost") && !Utils.getLocalFlag(bsConfig.connection_settings)) reject(Constants.validationMessages.LOCAL_NOT_SET.replace("<baseUrlValue>", cypressJson.baseUrl));
|
|
143
188
|
|
|
144
189
|
// Detect if the user is not using the right directory structure, and throw an error
|
|
145
190
|
if (!Utils.isUndefined(cypressJson.integrationFolder) && !Utils.isCypressProjDirValid(bsConfig.run_settings.cypressProjectDir,cypressJson.integrationFolder)) reject(Constants.validationMessages.INCORRECT_DIRECTORY_STRUCTURE);
|
package/bin/helpers/config.json
CHANGED
|
@@ -2,5 +2,6 @@
|
|
|
2
2
|
"uploadUrl": "https://api-cloud.browserstack.com/automate-frameworks/cypress/upload",
|
|
3
3
|
"rails_host": "https://api.browserstack.com",
|
|
4
4
|
"dashboardUrl": "https://automate.browserstack.com/dashboard/v2/builds/",
|
|
5
|
-
"usageReportingUrl": "https://eds.browserstack.com:443/send_event_cy_internal"
|
|
5
|
+
"usageReportingUrl": "https://eds.browserstack.com:443/send_event_cy_internal",
|
|
6
|
+
"localTestingListUrl": "https://www.browserstack.com/local/v1/list"
|
|
6
7
|
}
|
package/bin/helpers/constants.js
CHANGED
|
@@ -15,7 +15,7 @@ const userMessages = {
|
|
|
15
15
|
BUILD_INFO_FAILED: "Failed to get build info.",
|
|
16
16
|
BUILD_STOP_FAILED: "Failed to stop build.",
|
|
17
17
|
BUILD_REPORT_MESSAGE: "See the entire build report here:",
|
|
18
|
-
ZIP_UPLOADER_NOT_REACHABLE: "Could not reach to
|
|
18
|
+
ZIP_UPLOADER_NOT_REACHABLE: "Could not reach BrowserStack APIs. Please check your network or see if you need to whitelist *.browserstack.com",
|
|
19
19
|
ZIP_UPLOAD_FAILED: "Zip Upload failed.",
|
|
20
20
|
CONFIG_FILE_CREATED: "BrowserStack Config File created, you can now run browserstack-cypress --config-file run",
|
|
21
21
|
CONFIG_FILE_EXISTS: "File already exists, delete the browserstack.json file manually. skipping...",
|
|
@@ -37,7 +37,10 @@ const userMessages = {
|
|
|
37
37
|
FATAL_NETWORK_ERROR: `fatal: unable to access '${config.buildUrl}': Could not resolve host: ${config.rails_host}`,
|
|
38
38
|
RETRY_LIMIT_EXCEEDED: `Max retries exceeded trying to connect to the host (retries: ${config.retries})`,
|
|
39
39
|
CHECK_DASHBOARD_AT: "Please check the build status at: ",
|
|
40
|
-
CYPRESS_VERSION_CHANGED: "Your build will run using Cypress <actualVersion> instead of Cypress <preferredVersion>. Read more about supported versions here: http://browserstack.com/docs/automate/cypress/supported-versions"
|
|
40
|
+
CYPRESS_VERSION_CHANGED: "Your build will run using Cypress <actualVersion> instead of Cypress <preferredVersion>. Read more about supported versions here: http://browserstack.com/docs/automate/cypress/supported-versions",
|
|
41
|
+
LOCAL_START_FAILED: "Local Testing setup failed.",
|
|
42
|
+
LOCAL_STOP_FAILED: "Local Binary stop failed.",
|
|
43
|
+
INVALID_LOCAL_MODE_WARNING: "Invalid value specified for local_mode. local_mode: (\"always-on\" | \"on-demand\"). For more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference"
|
|
41
44
|
};
|
|
42
45
|
|
|
43
46
|
const validationMessages = {
|
|
@@ -56,8 +59,12 @@ const validationMessages = {
|
|
|
56
59
|
CYPRESS_JSON_NOT_FOUND: "cypress.json file is not found at cypress_proj_dir path ",
|
|
57
60
|
INVALID_CYPRESS_JSON: "cypress.json is not a valid json",
|
|
58
61
|
INVALID_DEFAULT_AUTH_PARAMS: "Your username and access key are required to run your tests on BrowserStack. Learn more at https://www.browserstack.com/docs/automate/cypress/authentication",
|
|
59
|
-
LOCAL_NOT_SET: "To test <
|
|
60
|
-
INCORRECT_DIRECTORY_STRUCTURE: "No tests to run. Note that your Cypress tests should be in the same directory where the cypress.json exists."
|
|
62
|
+
LOCAL_NOT_SET: "To test <baseUrlValue> on BrowserStack, you will have to set up Local testing. Read more here: https://www.browserstack.com/docs/automate/cypress/local-testing",
|
|
63
|
+
INCORRECT_DIRECTORY_STRUCTURE: "No tests to run. Note that your Cypress tests should be in the same directory where the cypress.json exists.",
|
|
64
|
+
INVALID_CLI_LOCAL_IDENTIFIER: "When using --local-identifier, a value needs to be supplied. \n--local-identifier <String>.\nFor more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference",
|
|
65
|
+
INVALID_LOCAL_MODE: "When using --local-mode, a value needs to be supplied. \n--local-mode (\"always-on\" | \"on-demand\").\nFor more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference",
|
|
66
|
+
INVALID_LOCAL_CONFIG_FILE: "Using --local-config-file requires an input of the form /path/to/config-file.yml.\nFor more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference",
|
|
67
|
+
INVALID_LOCAL_IDENTIFIER: "Invalid value specified for local_identifier. For more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference"
|
|
61
68
|
};
|
|
62
69
|
|
|
63
70
|
const cliMessages = {
|
|
@@ -93,6 +100,11 @@ const cliMessages = {
|
|
|
93
100
|
ENV_DESCRIPTION: "Specify the environment variables for your spec files",
|
|
94
101
|
SYNC_DESCRIPTION: "Makes the run command in sync",
|
|
95
102
|
BUILD_REPORT_MESSAGE: "See the entire build report here",
|
|
103
|
+
HEADED: "Run your tests in a headed browser instead of a headless browser",
|
|
104
|
+
LOCAL: "Accepted values: (true | false) - create a local testing connection to let you test staging and localhost websites, or sites behind proxies; learn more at browserstack.com/local-testing",
|
|
105
|
+
LOCAL_MODE: 'Accepted values: ("always-on" | "on-demand") - if you choose to keep the binary "always-on", it will speed up your tests by keeping the Local connection warmed up in the background; otherwise, you can choose to have it spawn and killed for every build',
|
|
106
|
+
LOCAL_IDENTIFIER: "Accepted values: String - assign an identifier to your Local process instance",
|
|
107
|
+
LOCAL_CONFIG_FILE: "Accepted values: String - path to local config-file to your Local process instance. Learn more at https://www.browserstack.com/local-testing/binary-params"
|
|
96
108
|
},
|
|
97
109
|
COMMON: {
|
|
98
110
|
DISABLE_USAGE_REPORTING: "Disable usage reporting",
|
|
@@ -114,11 +126,11 @@ const messageTypes = {
|
|
|
114
126
|
NULL: null
|
|
115
127
|
}
|
|
116
128
|
|
|
117
|
-
const allowedFileTypes = ['js', 'json', 'txt', 'ts', 'feature', 'features', 'pdf', 'jpg', 'jpeg', 'png', 'zip', 'npmrc', 'xml', 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'jsx', 'coffee', 'cjsx'];
|
|
129
|
+
const allowedFileTypes = ['js', 'json', 'txt', 'ts', 'feature', 'features', 'pdf', 'jpg', 'jpeg', 'png', 'zip', 'npmrc', 'xml', 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'jsx', 'coffee', 'cjsx', 'csv', 'tsv'];
|
|
118
130
|
|
|
119
131
|
const filesToIgnoreWhileUploading = ['**/node_modules/**', 'node_modules/**', 'package-lock.json', 'package.json', 'browserstack-package.json', 'tests.zip', 'cypress.json']
|
|
120
132
|
|
|
121
|
-
const specFileTypes = ['js', 'ts', 'feature']
|
|
133
|
+
const specFileTypes = ['js', 'ts', 'feature', 'jsx', 'coffee', 'cjsx'];
|
|
122
134
|
|
|
123
135
|
const DEFAULT_CYPRESS_SPEC_PATH = "cypress/integration"
|
|
124
136
|
|
|
@@ -135,6 +135,17 @@ let reportGenerator = (bsConfig, buildId, args, cb) => {
|
|
|
135
135
|
message = Constants.userMessages.API_DEPRECATED;
|
|
136
136
|
logger.info(message);
|
|
137
137
|
}
|
|
138
|
+
} else if (resp.statusCode === 422) {
|
|
139
|
+
messageType = Constants.messageTypes.ERROR;
|
|
140
|
+
errorCode = 'api_failed_build_generate_report';
|
|
141
|
+
try {
|
|
142
|
+
response = JSON.parse(body);
|
|
143
|
+
message = response.message;
|
|
144
|
+
} catch (error) {
|
|
145
|
+
logger.error(`Error generating the report: ${error}`);
|
|
146
|
+
response = {message: message};
|
|
147
|
+
}
|
|
148
|
+
logger.error(response.message);
|
|
138
149
|
} else if (resp.statusCode != 200) {
|
|
139
150
|
messageType = Constants.messageTypes.ERROR;
|
|
140
151
|
errorCode = 'api_failed_build_generate_report';
|
|
@@ -166,7 +177,7 @@ function renderReportHTML(report_data) {
|
|
|
166
177
|
let resultsDir = 'results';
|
|
167
178
|
let metaCharSet = `<meta charset="utf-8">`;
|
|
168
179
|
let metaViewPort = `<meta name="viewport" content="width=device-width, initial-scale=1"> `;
|
|
169
|
-
let pageTitle = `<title>
|
|
180
|
+
let pageTitle = `<title> BrowserStack Cypress Report </title>`;
|
|
170
181
|
let inlineCss = `<style type="text/css"> ${loadInlineCss()} </style>`;
|
|
171
182
|
let head = `<head> ${metaCharSet} ${metaViewPort} ${pageTitle} ${inlineCss} </head>`;
|
|
172
183
|
let htmlOpenTag = `<!DOCTYPE HTML><html>`;
|
|
@@ -53,7 +53,7 @@ let failedSpecsDetails = (data) => {
|
|
|
53
53
|
let tableConfig = {
|
|
54
54
|
border: tablePrinter.getBorderCharacters('ramac'),
|
|
55
55
|
columns: {
|
|
56
|
-
0: { alignment: 'left' },
|
|
56
|
+
0: { alignment: 'left' , width: 60 },
|
|
57
57
|
1: { alignment: 'left' },
|
|
58
58
|
2: { alignment: 'left' },
|
|
59
59
|
3: { alignment: 'left' },
|
|
@@ -65,7 +65,7 @@ let failedSpecsDetails = (data) => {
|
|
|
65
65
|
* @return {boolean}
|
|
66
66
|
*/
|
|
67
67
|
drawHorizontalLine: (index, size) => {
|
|
68
|
-
return (index === 0 || index === 1 || index ===
|
|
68
|
+
return (index === 0 || index === 1 || index === specData.length);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -8,7 +8,7 @@ const request = require("request"),
|
|
|
8
8
|
tableStream = require('table').createStream,
|
|
9
9
|
chalk = require('chalk');
|
|
10
10
|
|
|
11
|
-
let whileLoop = true, whileTries = config.retries, options, timeout = 3000, n =
|
|
11
|
+
let whileLoop = true, whileTries = config.retries, options, timeout = 3000, n = 2, tableConfig, stream, endTime, startTime = Date.now();
|
|
12
12
|
let specSummary = {
|
|
13
13
|
"specs": [],
|
|
14
14
|
"duration": null
|
|
@@ -35,10 +35,10 @@ let getTableConfig = () => {
|
|
|
35
35
|
border: getBorderConfig(),
|
|
36
36
|
columns: {
|
|
37
37
|
1: {alignment: 'center', width: 1},
|
|
38
|
-
2: {alignment: 'left', width:
|
|
38
|
+
2: {alignment: 'left', width: 100}
|
|
39
39
|
},
|
|
40
40
|
columnDefault: {
|
|
41
|
-
width:
|
|
41
|
+
width: 30,
|
|
42
42
|
},
|
|
43
43
|
columnCount: 3,
|
|
44
44
|
};
|
|
@@ -74,10 +74,10 @@ let printSpecsStatus = (bsConfig, buildDetails) => {
|
|
|
74
74
|
stream = tableStream(tableConfig);
|
|
75
75
|
|
|
76
76
|
async.whilst(
|
|
77
|
-
function() { // condition for loop
|
|
78
|
-
|
|
77
|
+
function test(callback) { // condition for loop
|
|
78
|
+
callback(null, whileLoop);
|
|
79
79
|
},
|
|
80
|
-
function(callback) { // actual loop
|
|
80
|
+
function iter(callback) { // actual loop
|
|
81
81
|
whileProcess(callback)
|
|
82
82
|
},
|
|
83
83
|
function(err, result) { // when loop ends
|
|
@@ -174,6 +174,11 @@ function send(args) {
|
|
|
174
174
|
|
|
175
175
|
let bsConfig = args.bstack_config;
|
|
176
176
|
let cli_details = cli_version_and_path(bsConfig);
|
|
177
|
+
let data = {}
|
|
178
|
+
|
|
179
|
+
if (bsConfig && bsConfig.run_settings) {
|
|
180
|
+
data.cypress_version = bsConfig.run_settings.cypress_version
|
|
181
|
+
}
|
|
177
182
|
|
|
178
183
|
delete args.bstack_config;
|
|
179
184
|
|
|
@@ -190,6 +195,7 @@ function send(args) {
|
|
|
190
195
|
local_cypress_version: local_cypress_version(bsConfig),
|
|
191
196
|
ci_environment: ci_environment(),
|
|
192
197
|
event_timestamp: new Date().toLocaleString(),
|
|
198
|
+
data: JSON.stringify(data),
|
|
193
199
|
...args,
|
|
194
200
|
},
|
|
195
201
|
};
|
|
@@ -225,5 +231,6 @@ function send(args) {
|
|
|
225
231
|
}
|
|
226
232
|
|
|
227
233
|
module.exports = {
|
|
228
|
-
send
|
|
229
|
-
|
|
234
|
+
send,
|
|
235
|
+
cli_version_and_path,
|
|
236
|
+
};
|