Skip to content

Commit 9688b14

Browse files
committed
Merge branch 'master' of github.com:browserstack/browserstack-cypress-cli into ats_fixes
2 parents 55f959c + 653e76d commit 9688b14

File tree

6 files changed

+19
-13
lines changed

6 files changed

+19
-13
lines changed

bin/commands/generateReport.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ const logger = require("../helpers/logger").winstonLogger,
55
utils = require("../helpers/utils"),
66
reporterHTML = require('../helpers/reporterHTML'),
77
getInitialDetails = require('../helpers/getInitialDetails').getInitialDetails;
8-
8+
const { isTurboScaleSession } = require('../helpers/atsHelper');
99

1010
module.exports = function generateReport(args, rawArgs) {
1111
let bsConfigPath = utils.getConfigPath(args.cf);
1212
let reportGenerator = reporterHTML.reportGenerator;
1313

14-
return utils.validateBstackJson(bsConfigPath).then(function (bsConfig) {
14+
return utils.validateBstackJson(bsConfigPath).then(async function (bsConfig) {
1515
// setting setDefaults to {} if not present and set via env variables or via args.
1616
utils.setDefaults(bsConfig, args);
1717

@@ -21,9 +21,9 @@ module.exports = function generateReport(args, rawArgs) {
2121
// accept the access key from command line if provided
2222
utils.setAccessKey(bsConfig, args);
2323

24-
getInitialDetails(bsConfig, args, rawArgs).then((buildReportData) => {
25-
26-
utils.setUsageReportingFlag(bsConfig, args.disableUsageReporting);
24+
try {
25+
let buildReportData = isTurboScaleSession(bsConfig) ? null : await getInitialDetails(bsConfig, args, rawArgs);
26+
utils.setUsageReportingFlag(bsConfig, args.disableUsageReporting);
2727

2828
// set cypress config filename
2929
utils.setCypressConfigFilename(bsConfig, args);
@@ -33,9 +33,9 @@ module.exports = function generateReport(args, rawArgs) {
3333
let buildId = args._[1];
3434
reportGenerator(bsConfig, buildId, args, rawArgs, buildReportData);
3535
utils.sendUsageReport(bsConfig, args, 'generate-report called', messageType, errorCode, buildReportData, rawArgs);
36-
}).catch((err) => {
36+
} catch(err) {
3737
logger.warn(err);
38-
});
38+
};
3939
}).catch(function (err) {
4040
logger.error(err);
4141
utils.setUsageReportingFlag(null, args.disableUsageReporting);

bin/commands/runs.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,10 @@ module.exports = function run(args, rawArgs) {
363363
await new Promise(resolve => setTimeout(resolve, 5000));
364364

365365
// download build artifacts
366-
if (exitCode != Constants.BUILD_FAILED_EXIT_CODE && !turboScaleSession) {
366+
if (exitCode != Constants.BUILD_FAILED_EXIT_CODE) {
367367
if (utils.nonEmptyArray(bsConfig.run_settings.downloads)) {
368368
logger.debug("Downloading build artifacts");
369-
await downloadBuildArtifacts(bsConfig, data.build_id, args, rawArgs, buildReportData);
369+
await downloadBuildArtifacts(bsConfig, data.build_id, args, rawArgs, buildReportData, turboScaleSession);
370370
}
371371

372372
// Generate custom report!

bin/helpers/buildArtifacts.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,15 @@ const sendUpdatesToBstack = async (bsConfig, buildId, args, options, rawArgs, bu
224224
});
225225
}
226226

227-
exports.downloadBuildArtifacts = async (bsConfig, buildId, args, rawArgs, buildReportData = null) => {
227+
exports.downloadBuildArtifacts = async (bsConfig, buildId, args, rawArgs, buildReportData = null, isTurboScaleSession = false) => {
228228
return new Promise ( async (resolve, reject) => {
229229
BUILD_ARTIFACTS_FAIL_COUNT = 0;
230230
BUILD_ARTIFACTS_TOTAL_COUNT = 0;
231231

232232
let options = {
233-
url: `${config.buildUrl}${buildId}/build_artifacts`,
233+
url: isTurboScaleSession
234+
? `${config.turboScaleBuildsUrl}/${buildId}/build_artifacts`
235+
: `${config.buildUrl}${buildId}/build_artifacts`,
234236
auth: {
235237
username: bsConfig.auth.username,
236238
password: bsConfig.auth.access_key,

bin/helpers/capabilityHelper.js

+3
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ const caps = (bsConfig, zip) => {
131131
obj.run_settings = JSON.stringify(bsConfig.run_settings);
132132
}
133133

134+
obj.cypress_cli_user_agent = Utils.getUserAgent();
135+
logger.info(`Cypress CLI User Agent: ${obj.cypress_cli_user_agent}`);
136+
134137
if(obj.parallels === Constants.cliMessages.RUN.DEFAULT_PARALLEL_MESSAGE) obj.parallels = undefined
135138

136139
if (obj.project) logger.info(`Project name is: ${obj.project}`);

bin/helpers/reporterHTML.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const fs = require('fs'),
99
Constants = require('./constants'),
1010
config = require("./config"),
1111
decompress = require('decompress');
12+
const { isTurboScaleSession } = require('../helpers/atsHelper');
1213

1314
let reportGenerator = async (bsConfig, buildId, args, rawArgs, buildReportData, cb) => {
1415
let options = {
@@ -25,7 +26,7 @@ let reportGenerator = async (bsConfig, buildId, args, rawArgs, buildReportData,
2526
if (isTurboScaleSession(bsConfig)) {
2627
options.url = `${config.turboScaleBuildsUrl}/${buildId}/custom_report`;
2728
}
28-
29+
2930
logger.debug('Started fetching the build json and html reports.');
3031

3132
let message = null;

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "browserstack-cypress-cli",
3-
"version": "1.31.9",
3+
"version": "1.31.10",
44
"description": "BrowserStack Cypress CLI for Cypress integration with BrowserStack's remote devices.",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)