browserstack-cypress-cli 1.31.9 → 1.31.10

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.
@@ -5,13 +5,13 @@ const logger = require("../helpers/logger").winstonLogger,
5
5
  utils = require("../helpers/utils"),
6
6
  reporterHTML = require('../helpers/reporterHTML'),
7
7
  getInitialDetails = require('../helpers/getInitialDetails').getInitialDetails;
8
-
8
+ const { isTurboScaleSession } = require('../helpers/atsHelper');
9
9
 
10
10
  module.exports = function generateReport(args, rawArgs) {
11
11
  let bsConfigPath = utils.getConfigPath(args.cf);
12
12
  let reportGenerator = reporterHTML.reportGenerator;
13
13
 
14
- return utils.validateBstackJson(bsConfigPath).then(function (bsConfig) {
14
+ return utils.validateBstackJson(bsConfigPath).then(async function (bsConfig) {
15
15
  // setting setDefaults to {} if not present and set via env variables or via args.
16
16
  utils.setDefaults(bsConfig, args);
17
17
 
@@ -21,9 +21,9 @@ module.exports = function generateReport(args, rawArgs) {
21
21
  // accept the access key from command line if provided
22
22
  utils.setAccessKey(bsConfig, args);
23
23
 
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);
27
27
 
28
28
  // set cypress config filename
29
29
  utils.setCypressConfigFilename(bsConfig, args);
@@ -34,9 +34,9 @@ module.exports = function generateReport(args, rawArgs) {
34
34
 
35
35
  reportGenerator(bsConfig, buildId, args, rawArgs, buildReportData);
36
36
  utils.sendUsageReport(bsConfig, args, 'generate-report called', messageType, errorCode, buildReportData, rawArgs);
37
- }).catch((err) => {
37
+ } catch(err) {
38
38
  logger.warn(err);
39
- });
39
+ };
40
40
  }).catch(function (err) {
41
41
  logger.error(err);
42
42
  utils.setUsageReportingFlag(null, args.disableUsageReporting);
@@ -365,10 +365,10 @@ module.exports = function run(args, rawArgs) {
365
365
  await new Promise(resolve => setTimeout(resolve, 5000));
366
366
 
367
367
  // download build artifacts
368
- if (exitCode != Constants.BUILD_FAILED_EXIT_CODE && !turboScaleSession) {
368
+ if (exitCode != Constants.BUILD_FAILED_EXIT_CODE) {
369
369
  if (utils.nonEmptyArray(bsConfig.run_settings.downloads)) {
370
370
  logger.debug("Downloading build artifacts");
371
- await downloadBuildArtifacts(bsConfig, data.build_id, args, rawArgs, buildReportData);
371
+ await downloadBuildArtifacts(bsConfig, data.build_id, args, rawArgs, buildReportData, turboScaleSession);
372
372
  }
373
373
 
374
374
  // Generate custom report!
@@ -213,13 +213,15 @@ const sendUpdatesToBstack = async (bsConfig, buildId, args, options, rawArgs, bu
213
213
  });
214
214
  }
215
215
 
216
- exports.downloadBuildArtifacts = async (bsConfig, buildId, args, rawArgs, buildReportData = null) => {
216
+ exports.downloadBuildArtifacts = async (bsConfig, buildId, args, rawArgs, buildReportData = null, isTurboScaleSession = false) => {
217
217
  return new Promise ( async (resolve, reject) => {
218
218
  BUILD_ARTIFACTS_FAIL_COUNT = 0;
219
219
  BUILD_ARTIFACTS_TOTAL_COUNT = 0;
220
220
 
221
221
  let options = {
222
- url: `${config.buildUrl}${buildId}/build_artifacts`,
222
+ url: isTurboScaleSession
223
+ ? `${config.turboScaleBuildsUrl}/${buildId}/build_artifacts`
224
+ : `${config.buildUrl}${buildId}/build_artifacts`,
223
225
  auth: {
224
226
  username: bsConfig.auth.username,
225
227
  password: bsConfig.auth.access_key,
@@ -131,6 +131,9 @@ const caps = (bsConfig, zip) => {
131
131
  obj.run_settings = JSON.stringify(bsConfig.run_settings);
132
132
  }
133
133
 
134
+ obj.cypress_cli_user_agent = Utils.getUserAgent();
135
+ logger.info(`Cypress CLI User Agent: ${obj.cypress_cli_user_agent}`);
136
+
134
137
  if(obj.parallels === Constants.cliMessages.RUN.DEFAULT_PARALLEL_MESSAGE) obj.parallels = undefined
135
138
 
136
139
  if (obj.project) logger.info(`Project name is: ${obj.project}`);
@@ -6,6 +6,7 @@ const fs = require('fs'),
6
6
  Constants = require('./constants'),
7
7
  config = require("./config"),
8
8
  decompress = require('decompress');
9
+ const { isTurboScaleSession } = require('../helpers/atsHelper');
9
10
 
10
11
  let reportGenerator = (bsConfig, buildId, args, rawArgs, buildReportData, cb) => {
11
12
  let options = {
@@ -19,6 +20,10 @@ let reportGenerator = (bsConfig, buildId, args, rawArgs, buildReportData, cb) =>
19
20
  },
20
21
  };
21
22
 
23
+ if (isTurboScaleSession(bsConfig)) {
24
+ options.url = `${config.turboScaleBuildsUrl}/${buildId}/custom_report`;
25
+ }
26
+
22
27
  logger.debug('Started fetching the build json and html reports.');
23
28
 
24
29
  return request.get(options, async function (err, resp, body) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browserstack-cypress-cli",
3
- "version": "1.31.9",
3
+ "version": "1.31.10",
4
4
  "description": "BrowserStack Cypress CLI for Cypress integration with BrowserStack's remote devices.",
5
5
  "main": "index.js",
6
6
  "scripts": {