browserstack-cypress-cli 1.25.3 → 1.26.0

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.
@@ -0,0 +1 @@
1
+ exports.API_URL = 'https://accessibility.browserstack.com/api';
@@ -0,0 +1,140 @@
1
+ /* Event listeners + custom commands for Cypress */
2
+
3
+ Cypress.on('test:before:run', () => {
4
+ try {
5
+ if (Cypress.env("IS_ACCESSIBILITY_EXTENSION_LOADED") !== "true") return
6
+ const extensionPath = Cypress.env("ACCESSIBILITY_EXTENSION_PATH")
7
+
8
+ if (extensionPath !== undefined) {
9
+ new Promise((resolve, reject) => {
10
+ window.parent.addEventListener('A11Y_TAP_STARTED', () => {
11
+ resolve("A11Y_TAP_STARTED");
12
+ });
13
+ const e = new CustomEvent('A11Y_FORCE_START');
14
+ window.parent.dispatchEvent(e);
15
+ })
16
+ }
17
+ } catch {}
18
+
19
+ });
20
+
21
+ Cypress.on('test:after:run', (attributes, runnable) => {
22
+ try {
23
+ if (Cypress.env("IS_ACCESSIBILITY_EXTENSION_LOADED") !== "true") return
24
+ const extensionPath = Cypress.env("ACCESSIBILITY_EXTENSION_PATH")
25
+ const isHeaded = Cypress.browser.isHeaded;
26
+ if (isHeaded && extensionPath !== undefined) {
27
+
28
+ let shouldScanTestForAccessibility = true;
29
+ if (Cypress.env("INCLUDE_TAGS_FOR_ACCESSIBILITY") || Cypress.env("EXCLUDE_TAGS_FOR_ACCESSIBILITY")) {
30
+
31
+ try {
32
+ let includeTagArray = [];
33
+ let excludeTagArray = [];
34
+ if (Cypress.env("INCLUDE_TAGS_FOR_ACCESSIBILITY")) {
35
+ includeTagArray = Cypress.env("INCLUDE_TAGS_FOR_ACCESSIBILITY").split(";")
36
+ }
37
+ if (Cypress.env("EXCLUDE_TAGS_FOR_ACCESSIBILITY")) {
38
+ excludeTagArray = Cypress.env("EXCLUDE_TAGS_FOR_ACCESSIBILITY").split(";")
39
+ }
40
+
41
+ const fullTestName = attributes.title;
42
+ const excluded = excludeTagArray.some((exclude) => fullTestName.includes(exclude));
43
+ const included = includeTagArray.length === 0 || includeTags.some((include) => fullTestName.includes(include));
44
+ shouldScanTestForAccessibility = !excluded && included;
45
+ } catch (error) {
46
+ console.log("Error while validating test case for accessibility before scanning. Error : ", error);
47
+ }
48
+ }
49
+ let os_data;
50
+ if (Cypress.env("OS")) {
51
+ os_data = Cypress.env("OS");
52
+ } else {
53
+ os_data = Cypress.platform === 'linux' ? 'mac' : "win"
54
+ }
55
+ let filePath = '';
56
+ if (attributes.invocationDetails !== undefined && attributes.invocationDetails.relativeFile !== undefined) {
57
+ filePath = attributes.invocationDetails.relativeFile;
58
+ }
59
+ const dataForExtension = {
60
+ "saveResults": shouldScanTestForAccessibility,
61
+ "testDetails": {
62
+ "name": attributes.title,
63
+ "testRunId": '5058', // variable not consumed, shouldn't matter what we send
64
+ "filePath": filePath,
65
+ "scopeList": [
66
+ filePath,
67
+ attributes.title
68
+ ]
69
+ },
70
+ "platform": {
71
+ "os_name": os_data,
72
+ "os_version": Cypress.env("OS_VERSION"),
73
+ "browser_name": Cypress.browser.name,
74
+ "browser_version": Cypress.browser.version
75
+ }
76
+ };
77
+ return new Promise((resolve, reject) => {
78
+ if (dataForExtension.saveResults) {
79
+ window.parent.addEventListener('A11Y_TAP_TRANSPORTER', (event) => {
80
+ resolve(event.detail);
81
+ });
82
+ }
83
+ const e = new CustomEvent('A11Y_TEST_END', {detail: dataForExtension});
84
+ window.parent.dispatchEvent(e);
85
+ if (dataForExtension.saveResults !== true )
86
+ resolve();
87
+ });
88
+ }
89
+
90
+ } catch {}
91
+ });
92
+
93
+ Cypress.Commands.add('getAccessibilityResultsSummary', () => {
94
+ try {
95
+ if (Cypress.env("IS_ACCESSIBILITY_EXTENSION_LOADED") !== "true") {
96
+ console.log(`Not a Accessibility Automation session, cannot retrieve Accessibility results.`);
97
+ return
98
+ }
99
+ return new Promise(function (resolve, reject) {
100
+ try{
101
+ const e = new CustomEvent('A11Y_TAP_GET_RESULTS_SUMMARY');
102
+ const fn = function (event) {
103
+ window.parent.removeEventListener('A11Y_RESULTS_SUMMARY_RESPONSE', fn);
104
+ resolve(event.detail.summary);
105
+ };
106
+ window.parent.addEventListener('A11Y_RESULTS_SUMMARY_RESPONSE', fn);
107
+ window.parent.dispatchEvent(e);
108
+ } catch (err) {
109
+ console.log("No accessibility results summary was found.");
110
+ reject(err);
111
+ }
112
+ });
113
+ } catch {}
114
+
115
+ });
116
+
117
+ Cypress.Commands.add('getAccessibilityResults', () => {
118
+ try {
119
+ if (Cypress.env("IS_ACCESSIBILITY_EXTENSION_LOADED") !== "true") {
120
+ console.log(`Not a Accessibility Automation session, cannot retrieve Accessibility results.`);
121
+ return
122
+ }
123
+ return new Promise(function (resolve, reject) {
124
+ try{
125
+ const e = new CustomEvent('A11Y_TAP_GET_RESULTS');
126
+ const fn = function (event) {
127
+ window.parent.removeEventListener('A11Y_RESULTS_RESPONSE', fn);
128
+ resolve(event.detail.summary);
129
+ };
130
+ window.parent.addEventListener('A11Y_RESULTS_RESPONSE', fn);
131
+ window.parent.dispatchEvent(e);
132
+ } catch (err) {
133
+ console.log("No accessibility results were found.");
134
+ reject(err);
135
+ }
136
+ });
137
+ } catch {}
138
+
139
+ });
140
+
@@ -0,0 +1,218 @@
1
+ const logger = require("../helpers/logger").winstonLogger;
2
+ const { API_URL } = require('./constants');
3
+ const utils = require('../helpers/utils');
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const request = require('request');
7
+ const os = require('os');
8
+ const glob = require('glob');
9
+ const helper = require('../helpers/helper');
10
+ const { CYPRESS_V10_AND_ABOVE_CONFIG_FILE_EXTENSIONS } = require('../helpers/constants');
11
+ const supportFileContentMap = {}
12
+
13
+ exports.checkAccessibilityPlatform = (user_config) => {
14
+ let accessibility = false;
15
+ try {
16
+ user_config.browsers.forEach(browser => {
17
+ if (browser.accessibility) {
18
+ accessibility = true;
19
+ }
20
+ })
21
+ } catch {}
22
+
23
+ return accessibility;
24
+ }
25
+
26
+ exports.setAccessibilityCypressCapabilities = async (user_config, accessibilityResponse) => {
27
+ if (utils.isUndefined(user_config.run_settings.accessibilityOptions)) {
28
+ user_config.run_settings.accessibilityOptions = {}
29
+ }
30
+ user_config.run_settings.accessibilityOptions["authToken"] = accessibilityResponse.data.accessibilityToken;
31
+ user_config.run_settings.accessibilityOptions["auth"] = accessibilityResponse.data.accessibilityToken;
32
+ user_config.run_settings.accessibilityOptions["scannerVersion"] = accessibilityResponse.data.scannerVersion;
33
+ user_config.run_settings.system_env_vars.push(`ACCESSIBILITY_AUTH=${accessibilityResponse.data.accessibilityToken}`)
34
+ user_config.run_settings.system_env_vars.push(`ACCESSIBILITY_SCANNERVERSION=${accessibilityResponse.data.scannerVersion}`)
35
+ }
36
+
37
+ exports.isAccessibilitySupportedCypressVersion = (cypress_config_filename) => {
38
+ const extension = cypress_config_filename.split('.').pop();
39
+ return CYPRESS_V10_AND_ABOVE_CONFIG_FILE_EXTENSIONS.includes(extension);
40
+ }
41
+
42
+ exports.createAccessibilityTestRun = async (user_config, framework) => {
43
+
44
+ try {
45
+ if (!this.isAccessibilitySupportedCypressVersion(user_config.run_settings.cypress_config_file) ){
46
+ logger.warn(`Accessibility Testing is not supported on Cypress version 9 and below.`)
47
+ process.env.BROWSERSTACK_TEST_ACCESSIBILITY = 'false';
48
+ user_config.run_settings.accessibility = false;
49
+ return;
50
+ }
51
+ const userName = user_config["auth"]["username"];
52
+ const accessKey = user_config["auth"]["access_key"];
53
+ let settings = utils.isUndefined(user_config.run_settings.accessibilityOptions) ? {} : user_config.run_settings.accessibilityOptions
54
+
55
+ const {
56
+ buildName,
57
+ projectName,
58
+ buildDescription
59
+ } = helper.getBuildDetails(user_config);
60
+
61
+ const data = {
62
+ 'projectName': projectName,
63
+ 'buildName': buildName,
64
+ 'startTime': (new Date()).toISOString(),
65
+ 'description': buildDescription,
66
+ 'source': {
67
+ frameworkName: "Cypress",
68
+ frameworkVersion: helper.getPackageVersion('cypress', user_config),
69
+ sdkVersion: helper.getAgentVersion()
70
+ },
71
+ 'settings': settings,
72
+ 'versionControl': await helper.getGitMetaData(),
73
+ 'ciInfo': helper.getCiInfo(),
74
+ 'hostInfo': {
75
+ hostname: os.hostname(),
76
+ platform: os.platform(),
77
+ type: os.type(),
78
+ version: os.version(),
79
+ arch: os.arch()
80
+ },
81
+ 'browserstackAutomation': process.env.BROWSERSTACK_AUTOMATION === 'true'
82
+ };
83
+
84
+ const config = {
85
+ auth: {
86
+ user: userName,
87
+ pass: accessKey
88
+ },
89
+ headers: {
90
+ 'Content-Type': 'application/json'
91
+ }
92
+ };
93
+
94
+ const response = await nodeRequest(
95
+ 'POST', 'test_runs', data, config, API_URL
96
+ );
97
+ if(!utils.isUndefined(response.data)) {
98
+ process.env.BS_A11Y_JWT = response.data.data.accessibilityToken;
99
+ process.env.BS_A11Y_TEST_RUN_ID = response.data.data.id;
100
+ }
101
+ if (process.env.BS_A11Y_JWT) {
102
+ process.env.BROWSERSTACK_TEST_ACCESSIBILITY = 'true';
103
+ }
104
+ logger.debug(`BrowserStack Accessibility Automation Test Run ID: ${response.data.data.id}`);
105
+
106
+ this.setAccessibilityCypressCapabilities(user_config, response.data);
107
+ setAccessibilityEventListeners();
108
+ helper.setBrowserstackCypressCliDependency(user_config);
109
+
110
+ } catch (error) {
111
+ if (error.response) {
112
+ logger.error(
113
+ `Exception while creating test run for BrowserStack Accessibility Automation: ${
114
+ error.response.status
115
+ } ${error.response.statusText} ${JSON.stringify(error.response.data)}`
116
+ );
117
+ } else {
118
+ if(error.message === 'Invalid configuration passed.') {
119
+ logger.error(
120
+ `Exception while creating test run for BrowserStack Accessibility Automation: ${
121
+ error.message || error.stack
122
+ }`
123
+ );
124
+ for(const errorkey of error.errors){
125
+ logger.error(errorkey.message);
126
+ }
127
+
128
+ } else {
129
+ logger.error(
130
+ `Exception while creating test run for BrowserStack Accessibility Automation: ${
131
+ error.message || error.stack
132
+ }`
133
+ );
134
+ }
135
+ // since create accessibility session failed
136
+ process.env.BROWSERSTACK_TEST_ACCESSIBILITY = 'false';
137
+ user_config.run_settings.accessibility = false;
138
+ }
139
+ }
140
+ }
141
+
142
+ const nodeRequest = (type, url, data, config) => {
143
+ return new Promise(async (resolve, reject) => {
144
+ const options = {...config,...{
145
+ method: type,
146
+ url: `${API_URL}/${url}`,
147
+ body: data,
148
+ json: config.headers['Content-Type'] === 'application/json',
149
+ }};
150
+
151
+ request(options, function callback(error, response, body) {
152
+ if(error) {
153
+ logger.info("error in nodeRequest", error);
154
+ reject(error);
155
+ } else if(!(response.statusCode == 201 || response.statusCode == 200)) {
156
+ logger.info("response.statusCode in nodeRequest", response.statusCode);
157
+ reject(response && response.body ? response.body : `Received response from BrowserStack Server with status : ${response.statusCode}`);
158
+ } else {
159
+ try {
160
+ if(typeof(body) !== 'object') body = JSON.parse(body);
161
+ } catch(e) {
162
+ if(!url.includes('/stop')) {
163
+ reject('Not a JSON response from BrowserStack Server');
164
+ }
165
+ }
166
+ resolve({
167
+ data: body
168
+ });
169
+ }
170
+ });
171
+ });
172
+ }
173
+
174
+ exports.supportFileCleanup = () => {
175
+ logger.debug("Cleaning up support file changes added for accessibility. ")
176
+ Object.keys(supportFileContentMap).forEach(file => {
177
+ try {
178
+ fs.writeFileSync(file, supportFileContentMap[file], {encoding: 'utf-8'});
179
+ } catch(e) {
180
+ logger.debug(`Error while replacing file content for ${file} with it's original content with error : ${e}`, true, e);
181
+ }
182
+ });
183
+ }
184
+
185
+ const getAccessibilityCypressCommandEventListener = () => {
186
+ return (
187
+ `require('browserstack-cypress-cli/bin/accessibility-automation/cypress');`
188
+ );
189
+ }
190
+
191
+ const setAccessibilityEventListeners = () => {
192
+ try {
193
+ const cypressCommandEventListener = getAccessibilityCypressCommandEventListener();
194
+ glob(process.cwd() + '/cypress/support/*.js', {}, (err, files) => {
195
+ if(err) return logger.debug('EXCEPTION IN BUILD START EVENT : Unable to parse cypress support files');
196
+ files.forEach(file => {
197
+ try {
198
+ if(!file.includes('commands.js')) {
199
+ const defaultFileContent = fs.readFileSync(file, {encoding: 'utf-8'});
200
+
201
+ if(!defaultFileContent.includes(cypressCommandEventListener)) {
202
+ let newFileContent = defaultFileContent +
203
+ '\n' +
204
+ cypressCommandEventListener +
205
+ '\n'
206
+ fs.writeFileSync(file, newFileContent, {encoding: 'utf-8'});
207
+ supportFileContentMap[file] = defaultFileContent;
208
+ }
209
+ }
210
+ } catch(e) {
211
+ logger.debug(`Unable to modify file contents for ${file} to set event listeners with error ${e}`, true, e);
212
+ }
213
+ });
214
+ });
215
+ } catch(e) {
216
+ logger.debug(`Unable to parse support files to set event listeners with error ${e}`, true, e);
217
+ }
218
+ }
@@ -0,0 +1,43 @@
1
+
2
+ const path = require("node:path");
3
+
4
+ const browserstackAccessibility = (on, config) => {
5
+ let browser_validation = true;
6
+ on('before:browser:launch', (browser = {}, launchOptions) => {
7
+ try {
8
+
9
+ if (process.env.ACCESSIBILITY_EXTENSION_PATH !== undefined) {
10
+ if (browser.name !== 'chrome') {
11
+ console.log(`Accessibility Automation will run only on Chrome browsers.`);
12
+ browser_validation = false;
13
+ }
14
+ if (browser.name === 'chrome' && browser.majorVersion <= 94) {
15
+ console.log(`Accessibility Automation will run only on Chrome browser version greater than 94.`);
16
+ browser_validation = false;
17
+ }
18
+ if (browser.isHeadless === true) {
19
+ console.log(`Accessibility Automation will not run on legacy headless mode. Switch to new headless mode or avoid using headless mode.`);
20
+ browser_validation = false;
21
+ }
22
+ if (browser_validation) {
23
+ const ally_path = path.dirname(process.env.ACCESSIBILITY_EXTENSION_PATH)
24
+ launchOptions.extensions.push(ally_path);
25
+ return launchOptions
26
+ }
27
+ }
28
+ } catch(err) {}
29
+
30
+ })
31
+ config.env.ACCESSIBILITY_EXTENSION_PATH = process.env.ACCESSIBILITY_EXTENSION_PATH
32
+ config.env.OS_VERSION = process.env.OS_VERSION
33
+ config.env.OS = process.env.OS
34
+
35
+ config.env.IS_ACCESSIBILITY_EXTENSION_LOADED = browser_validation.toString()
36
+
37
+ config.env.INCLUDE_TAGS_FOR_ACCESSIBILITY = process.env.ACCESSIBILITY_INCLUDETAGSINTESTINGSCOPE
38
+ config.env.EXCLUDE_TAGS_FOR_ACCESSIBILITY = process.env.ACCESSIBILITY_EXCLUDETAGSINTESTINGSCOPE
39
+
40
+ return config;
41
+ }
42
+
43
+ module.exports = browserstackAccessibility;
@@ -30,6 +30,13 @@ const {
30
30
  printBuildLink
31
31
  } = require('../testObservability/helper/helper');
32
32
 
33
+
34
+ const {
35
+ createAccessibilityTestRun,
36
+ checkAccessibilityPlatform,
37
+ supportFileCleanup
38
+ } = require('../accessibility-automation/helper');
39
+
33
40
  module.exports = function run(args, rawArgs) {
34
41
 
35
42
  markBlockStart('preBuild');
@@ -57,6 +64,8 @@ module.exports = function run(args, rawArgs) {
57
64
  Set testObservability & browserstackAutomation flags
58
65
  */
59
66
  const [isTestObservabilitySession, isBrowserstackInfra] = setTestObservabilityFlags(bsConfig);
67
+ const checkAccessibility = checkAccessibilityPlatform(bsConfig);
68
+ const isAccessibilitySession = bsConfig.run_settings.accessibility || checkAccessibility;
60
69
 
61
70
  utils.setUsageReportingFlag(bsConfig, args.disableUsageReporting);
62
71
 
@@ -131,6 +140,10 @@ module.exports = function run(args, rawArgs) {
131
140
 
132
141
  // add cypress dependency if missing
133
142
  utils.setCypressNpmDependency(bsConfig);
143
+
144
+ if (isAccessibilitySession && isBrowserstackInfra) {
145
+ await createAccessibilityTestRun(bsConfig);
146
+ }
134
147
  }
135
148
 
136
149
  const { packagesInstalled } = !isBrowserstackInfra ? false : await packageInstaller.packageSetupAndInstaller(bsConfig, config.packageDirName, {markBlockStart, markBlockEnd});
@@ -232,6 +245,9 @@ module.exports = function run(args, rawArgs) {
232
245
  markBlockEnd('zip.zipUpload');
233
246
  markBlockEnd('zip');
234
247
 
248
+ if (process.env.BROWSERSTACK_TEST_ACCESSIBILITY === 'true') {
249
+ supportFileCleanup();
250
+ }
235
251
  // Create build
236
252
  //setup Local Testing
237
253
  markBlockStart('localSetup');
@@ -121,6 +121,10 @@ const caps = (bsConfig, zip) => {
121
121
  logger.info(`Running your tests in headless mode. Use --headed arg to run in headful mode.`);
122
122
  }
123
123
 
124
+ if (process.env.BROWSERSTACK_TEST_ACCESSIBILITY === 'true') {
125
+ bsConfig.run_settings["accessibilityPlatforms"] = getAccessibilityPlatforms(bsConfig);
126
+ }
127
+
124
128
  // send run_settings as is for other capabilities
125
129
  obj.run_settings = JSON.stringify(bsConfig.run_settings);
126
130
  }
@@ -138,9 +142,22 @@ const caps = (bsConfig, zip) => {
138
142
  if (obj.parallels) logger.info(`Parallels limit specified: ${obj.parallels}`);
139
143
 
140
144
  var data = JSON.stringify(obj);
145
+
141
146
  resolve(data);
142
147
  })
143
148
  }
149
+ const getAccessibilityPlatforms = (bsConfig) => {
150
+ const browserList = bsConfig.browsers;
151
+ const accessibilityPlatforms = Array(browserList.length).fill(false);
152
+ let rootLevelAccessibility = false;
153
+ if (!Utils.isUndefined(bsConfig.run_settings.accessibility)) {
154
+ rootLevelAccessibility = bsConfig.run_settings.accessibility.toString() === 'true'
155
+ }
156
+ browserList.forEach((browserDetails, idx) => {
157
+ accessibilityPlatforms[idx] = (browserDetails.accessibility === undefined) ? rootLevelAccessibility : browserDetails.accessibility
158
+ });
159
+ return accessibilityPlatforms;
160
+ }
144
161
 
145
162
  const addCypressZipStartLocation = (runSettings) => {
146
163
  let resolvedHomeDirectoryPath = path.resolve(runSettings.home_directory);
@@ -0,0 +1,305 @@
1
+ /* Helper methods used by Accessibility and Observability */
2
+
3
+ const logger = require("../helpers/logger").winstonLogger;
4
+ const utils = require('../helpers/utils');
5
+ const fs = require('fs');
6
+ const path = require('path');
7
+ const http = require('http');
8
+ const https = require('https');
9
+ const request = require('request');
10
+ const gitLastCommit = require('git-last-commit');
11
+ const { v4: uuidv4 } = require('uuid');
12
+ const os = require('os');
13
+ const { promisify } = require('util');
14
+ const getRepoInfo = require('git-repo-info');
15
+ const gitconfig = require('gitconfiglocal');
16
+ const { spawn, execSync } = require('child_process');
17
+ const glob = require('glob');
18
+ const pGitconfig = promisify(gitconfig);
19
+ const CrashReporter = require('../testObservability/crashReporter');
20
+
21
+ exports.debug = (text, shouldReport = false, throwable = null) => {
22
+ if (process.env.BROWSERSTACK_OBSERVABILITY_DEBUG === "true" || process.env.BROWSERSTACK_OBSERVABILITY_DEBUG === "1") {
23
+ logger.info(`[ OBSERVABILITY ] ${text}`);
24
+ }
25
+ if(shouldReport) {
26
+ CrashReporter.getInstance().uploadCrashReport(text, throwable ? throwable && throwable.stack : null);
27
+ }
28
+ }
29
+
30
+ exports.getFileSeparatorData = () => {
31
+ return /^win/.test(process.platform) ? "\\" : "/";
32
+ }
33
+
34
+ exports.findGitConfig = (filePath) => {
35
+ const fileSeparator = exports.getFileSeparatorData();
36
+ if(filePath == null || filePath == '' || filePath == fileSeparator) {
37
+ return null;
38
+ }
39
+ try {
40
+ fs.statSync(filePath + fileSeparator + '.git' + fileSeparator + 'config');
41
+ return filePath;
42
+ } catch(e) {
43
+ let parentFilePath = filePath.split(fileSeparator);
44
+ parentFilePath.pop();
45
+ return exports.findGitConfig(parentFilePath.join(fileSeparator));
46
+ }
47
+ }
48
+
49
+ let packages = {};
50
+ exports.getPackageVersion = (package_, bsConfig = null) => {
51
+ if(packages[package_]) return packages[package_];
52
+ let packageVersion;
53
+ /* Try to find version from module path */
54
+ try {
55
+ packages[package_] = this.requireModule(`${package_}/package.json`).version;
56
+ logger.info(`Getting ${package_} package version from module path = ${packages[package_]}`);
57
+ packageVersion = packages[package_];
58
+ } catch(e) {
59
+ exports.debug(`Unable to find package ${package_} at module path with error ${e}`);
60
+ }
61
+
62
+ /* Read package version from npm_dependencies in browserstack.json file if present */
63
+ if(utils.isUndefined(packageVersion) && bsConfig && (process.env.BROWSERSTACK_AUTOMATION == "true" || process.env.BROWSERSTACK_AUTOMATION == "1")) {
64
+ const runSettings = bsConfig.run_settings;
65
+ if (runSettings && runSettings.npm_dependencies !== undefined &&
66
+ Object.keys(runSettings.npm_dependencies).length !== 0 &&
67
+ typeof runSettings.npm_dependencies === 'object') {
68
+ if (package_ in runSettings.npm_dependencies) {
69
+ packages[package_] = runSettings.npm_dependencies[package_];
70
+ logger.info(`Getting ${package_} package version from browserstack.json = ${packages[package_]}`);
71
+ packageVersion = packages[package_];
72
+ }
73
+ }
74
+ }
75
+
76
+ /* Read package version from project's package.json if present */
77
+ const packageJSONPath = path.join(process.cwd(), 'package.json');
78
+ if(utils.isUndefined(packageVersion) && fs.existsSync(packageJSONPath)) {
79
+ const packageJSONContents = require(packageJSONPath);
80
+ if(packageJSONContents.devDependencies && !utils.isUndefined(packageJSONContents.devDependencies[package_])) packages[package_] = packageJSONContents.devDependencies[package_];
81
+ if(packageJSONContents.dependencies && !utils.isUndefined(packageJSONContents.dependencies[package_])) packages[package_] = packageJSONContents.dependencies[package_];
82
+ logger.info(`Getting ${package_} package version from package.json = ${packages[package_]}`);
83
+ packageVersion = packages[package_];
84
+ }
85
+
86
+ return packageVersion;
87
+ }
88
+
89
+ exports.getAgentVersion = () => {
90
+ let _path = path.join(__dirname, '../../package.json');
91
+ if(fs.existsSync(_path))
92
+ return require(_path).version;
93
+ }
94
+
95
+ exports.getGitMetaData = () => {
96
+ return new Promise(async (resolve, reject) => {
97
+ try {
98
+ var info = getRepoInfo();
99
+ if(!info.commonGitDir) {
100
+ logger.debug(`Unable to find a Git directory`);
101
+ exports.debug(`Unable to find a Git directory`);
102
+ resolve({});
103
+ }
104
+ if(!info.author && exports.findGitConfig(process.cwd())) {
105
+ /* commit objects are packed */
106
+ gitLastCommit.getLastCommit(async (err, commit) => {
107
+ if(err) {
108
+ logger.debug(`Exception in populating Git Metadata with error : ${err}`, true, err);
109
+ exports.debug(`Exception in populating Git Metadata with error : ${err}`, true, err);
110
+ return resolve({});
111
+ }
112
+ try {
113
+ info["author"] = info["author"] || `${commit["author"]["name"].replace(/[“]+/g, '')} <${commit["author"]["email"].replace(/[“]+/g, '')}>`;
114
+ info["authorDate"] = info["authorDate"] || commit["authoredOn"];
115
+ info["committer"] = info["committer"] || `${commit["committer"]["name"].replace(/[“]+/g, '')} <${commit["committer"]["email"].replace(/[“]+/g, '')}>`;
116
+ info["committerDate"] = info["committerDate"] || commit["committedOn"];
117
+ info["commitMessage"] = info["commitMessage"] || commit["subject"];
118
+
119
+ const { remote } = await pGitconfig(info.commonGitDir);
120
+ const remotes = Object.keys(remote).map(remoteName => ({name: remoteName, url: remote[remoteName]['url']}));
121
+ resolve({
122
+ "name": "git",
123
+ "sha": info["sha"],
124
+ "short_sha": info["abbreviatedSha"],
125
+ "branch": info["branch"],
126
+ "tag": info["tag"],
127
+ "committer": info["committer"],
128
+ "committer_date": info["committerDate"],
129
+ "author": info["author"],
130
+ "author_date": info["authorDate"],
131
+ "commit_message": info["commitMessage"],
132
+ "root": info["root"],
133
+ "common_git_dir": info["commonGitDir"],
134
+ "worktree_git_dir": info["worktreeGitDir"],
135
+ "last_tag": info["lastTag"],
136
+ "commits_since_last_tag": info["commitsSinceLastTag"],
137
+ "remotes": remotes
138
+ });
139
+ } catch(e) {
140
+ exports.debug(`Exception in populating Git Metadata with error : ${e}`, true, e);
141
+ logger.debug(`Exception in populating Git Metadata with error : ${e}`, true, e);
142
+ return resolve({});
143
+ }
144
+ }, {dst: exports.findGitConfig(process.cwd())});
145
+ } else {
146
+ const { remote } = await pGitconfig(info.commonGitDir);
147
+ const remotes = Object.keys(remote).map(remoteName => ({name: remoteName, url: remote[remoteName]['url']}));
148
+ resolve({
149
+ "name": "git",
150
+ "sha": info["sha"],
151
+ "short_sha": info["abbreviatedSha"],
152
+ "branch": info["branch"],
153
+ "tag": info["tag"],
154
+ "committer": info["committer"],
155
+ "committer_date": info["committerDate"],
156
+ "author": info["author"],
157
+ "author_date": info["authorDate"],
158
+ "commit_message": info["commitMessage"],
159
+ "root": info["root"],
160
+ "common_git_dir": info["commonGitDir"],
161
+ "worktree_git_dir": info["worktreeGitDir"],
162
+ "last_tag": info["lastTag"],
163
+ "commits_since_last_tag": info["commitsSinceLastTag"],
164
+ "remotes": remotes
165
+ });
166
+ }
167
+ } catch(err) {
168
+ exports.debug(`Exception in populating Git metadata with error : ${err}`, true, err);
169
+ logger.debug(`Exception in populating Git metadata with error : ${err}`, true, err);
170
+ resolve({});
171
+ }
172
+ })
173
+ }
174
+ exports.getCiInfo = () => {
175
+ var env = process.env;
176
+ // Jenkins
177
+ if ((typeof env.JENKINS_URL === "string" && env.JENKINS_URL.length > 0) || (typeof env.JENKINS_HOME === "string" && env.JENKINS_HOME.length > 0)) {
178
+ return {
179
+ name: "Jenkins",
180
+ build_url: env.BUILD_URL,
181
+ job_name: env.JOB_NAME,
182
+ build_number: env.BUILD_NUMBER
183
+ }
184
+ }
185
+ // CircleCI
186
+ if (env.CI === "true" && env.CIRCLECI === "true") {
187
+ return {
188
+ name: "CircleCI",
189
+ build_url: env.CIRCLE_BUILD_URL,
190
+ job_name: env.CIRCLE_JOB,
191
+ build_number: env.CIRCLE_BUILD_NUM
192
+ }
193
+ }
194
+ // Travis CI
195
+ if (env.CI === "true" && env.TRAVIS === "true") {
196
+ return {
197
+ name: "Travis CI",
198
+ build_url: env.TRAVIS_BUILD_WEB_URL,
199
+ job_name: env.TRAVIS_JOB_NAME,
200
+ build_number: env.TRAVIS_BUILD_NUMBER
201
+ }
202
+ }
203
+ // Codeship
204
+ if (env.CI === "true" && env.CI_NAME === "codeship") {
205
+ return {
206
+ name: "Codeship",
207
+ build_url: null,
208
+ job_name: null,
209
+ build_number: null
210
+ }
211
+ }
212
+ // Bitbucket
213
+ if (env.BITBUCKET_BRANCH && env.BITBUCKET_COMMIT) {
214
+ return {
215
+ name: "Bitbucket",
216
+ build_url: env.BITBUCKET_GIT_HTTP_ORIGIN,
217
+ job_name: null,
218
+ build_number: env.BITBUCKET_BUILD_NUMBER
219
+ }
220
+ }
221
+ // Drone
222
+ if (env.CI === "true" && env.DRONE === "true") {
223
+ return {
224
+ name: "Drone",
225
+ build_url: env.DRONE_BUILD_LINK,
226
+ job_name: null,
227
+ build_number: env.DRONE_BUILD_NUMBER
228
+ }
229
+ }
230
+ // Semaphore
231
+ if (env.CI === "true" && env.SEMAPHORE === "true") {
232
+ return {
233
+ name: "Semaphore",
234
+ build_url: env.SEMAPHORE_ORGANIZATION_URL,
235
+ job_name: env.SEMAPHORE_JOB_NAME,
236
+ build_number: env.SEMAPHORE_JOB_ID
237
+ }
238
+ }
239
+ // GitLab
240
+ if (env.CI === "true" && env.GITLAB_CI === "true") {
241
+ return {
242
+ name: "GitLab",
243
+ build_url: env.CI_JOB_URL,
244
+ job_name: env.CI_JOB_NAME,
245
+ build_number: env.CI_JOB_ID
246
+ }
247
+ }
248
+ // Buildkite
249
+ if (env.CI === "true" && env.BUILDKITE === "true") {
250
+ return {
251
+ name: "Buildkite",
252
+ build_url: env.BUILDKITE_BUILD_URL,
253
+ job_name: env.BUILDKITE_LABEL || env.BUILDKITE_PIPELINE_NAME,
254
+ build_number: env.BUILDKITE_BUILD_NUMBER
255
+ }
256
+ }
257
+ // Visual Studio Team Services
258
+ if (env.TF_BUILD === "True") {
259
+ return {
260
+ name: "Visual Studio Team Services",
261
+ build_url: `${env.SYSTEM_TEAMFOUNDATIONSERVERURI}${env.SYSTEM_TEAMPROJECTID}`,
262
+ job_name: env.SYSTEM_DEFINITIONID,
263
+ build_number: env.BUILD_BUILDID
264
+ }
265
+ }
266
+ // if no matches, return null
267
+ return null;
268
+ }
269
+
270
+ exports.getBuildDetails = (bsConfig) => {
271
+ let buildName = '',
272
+ projectName = '',
273
+ buildDescription = '',
274
+ buildTags = [];
275
+
276
+ /* Pick from environment variables */
277
+ buildName = process.env.BROWSERSTACK_BUILD_NAME || buildName;
278
+ projectName = process.env.BROWSERSTACK_PROJECT_NAME || projectName;
279
+
280
+ /* Pick from run settings */
281
+ buildName = buildName || bsConfig["run_settings"]["build_name"];
282
+ projectName = projectName || bsConfig["run_settings"]["project_name"];
283
+ if(!utils.isUndefined(bsConfig["run_settings"]["build_tag"])) buildTags = [...buildTags, bsConfig["run_settings"]["build_tag"]];
284
+
285
+ buildName = buildName || path.basename(path.resolve(process.cwd()));
286
+
287
+ return {
288
+ buildName,
289
+ projectName,
290
+ buildDescription,
291
+ buildTags
292
+ };
293
+ }
294
+
295
+ exports.setBrowserstackCypressCliDependency = (bsConfig) => {
296
+ const runSettings = bsConfig.run_settings;
297
+ if (runSettings.npm_dependencies !== undefined &&
298
+ typeof runSettings.npm_dependencies === 'object') {
299
+ if (!("browserstack-cypress-cli" in runSettings.npm_dependencies)) {
300
+ logger.warn("Missing browserstack-cypress-cli not found in npm_dependencies");
301
+ runSettings.npm_dependencies['browserstack-cypress-cli'] = this.getAgentVersion() || "latest";
302
+ logger.warn(`Adding browserstack-cypress-cli version ${runSettings.npm_dependencies['browserstack-cypress-cli']} in npm_dependencies`);
303
+ }
304
+ }
305
+ }
@@ -558,6 +558,23 @@ exports.setSystemEnvs = (bsConfig) => {
558
558
  });
559
559
  }
560
560
 
561
+ try {
562
+ const accessibilityOptions = bsConfig.run_settings.accessibilityOptions;
563
+ if (accessibilityOptions) {
564
+ Object.keys(accessibilityOptions).forEach(key => {
565
+ const a11y_env_key = `ACCESSIBILITY_${key.toUpperCase()}`
566
+ if (["includeTagsInTestingScope", "excludeTagsInTestingScope"].includes(key))
567
+ envKeys[a11y_env_key] = accessibilityOptions[key].join(";")
568
+ else if (key === "includeIssueType")
569
+ envKeys[a11y_env_key] = JSON.stringify(accessibilityOptions.includeIssueType).replaceAll('"', "")
570
+ else
571
+ envKeys[a11y_env_key] = accessibilityOptions[key];
572
+ })
573
+ }
574
+ } catch (error) {
575
+ logger.error(`Error in adding accessibility configs ${error}`)
576
+ }
577
+
561
578
  try {
562
579
  OBSERVABILITY_ENV_VARS.forEach(key => {
563
580
  envKeys[key] = process.env[key];
@@ -3,11 +3,9 @@ const path = require('path');
3
3
  const http = require('http');
4
4
  const https = require('https');
5
5
  const request = require('request');
6
- var gitLastCommit = require('git-last-commit');
7
6
  const { v4: uuidv4 } = require('uuid');
8
7
  const os = require('os');
9
8
  const { promisify } = require('util');
10
- const getRepoInfo = require('git-repo-info');
11
9
  const gitconfig = require('gitconfiglocal');
12
10
  const { spawn, execSync } = require('child_process');
13
11
  const glob = require('glob');
@@ -16,6 +14,8 @@ const pGitconfig = promisify(gitconfig);
16
14
 
17
15
  const logger = require("../../helpers/logger").winstonLogger;
18
16
  const utils = require('../../helpers/utils');
17
+ const helper = require('../../helpers/helper');
18
+
19
19
  const CrashReporter = require('../crashReporter');
20
20
 
21
21
  // Getting global packages path
@@ -181,178 +181,6 @@ exports.findGitConfig = (filePath) => {
181
181
  }
182
182
  }
183
183
 
184
- const getGitMetaData = () => {
185
- return new Promise(async (resolve, reject) => {
186
- try {
187
- var info = getRepoInfo();
188
- if(!info.commonGitDir) {
189
- exports.debug(`Unable to find a Git directory`);
190
- resolve({});
191
- }
192
- if(!info.author && exports.findGitConfig(process.cwd())) {
193
- /* commit objects are packed */
194
- gitLastCommit.getLastCommit(async (err, commit) => {
195
- if(err) {
196
- exports.debug(`Exception in populating Git Metadata with error : ${err}`, true, err);
197
- return resolve({});
198
- }
199
- try {
200
- info["author"] = info["author"] || `${commit["author"]["name"].replace(/[“]+/g, '')} <${commit["author"]["email"].replace(/[“]+/g, '')}>`;
201
- info["authorDate"] = info["authorDate"] || commit["authoredOn"];
202
- info["committer"] = info["committer"] || `${commit["committer"]["name"].replace(/[“]+/g, '')} <${commit["committer"]["email"].replace(/[“]+/g, '')}>`;
203
- info["committerDate"] = info["committerDate"] || commit["committedOn"];
204
- info["commitMessage"] = info["commitMessage"] || commit["subject"];
205
-
206
- const { remote } = await pGitconfig(info.commonGitDir);
207
- const remotes = Object.keys(remote).map(remoteName => ({name: remoteName, url: remote[remoteName]['url']}));
208
- resolve({
209
- "name": "git",
210
- "sha": info["sha"],
211
- "short_sha": info["abbreviatedSha"],
212
- "branch": info["branch"],
213
- "tag": info["tag"],
214
- "committer": info["committer"],
215
- "committer_date": info["committerDate"],
216
- "author": info["author"],
217
- "author_date": info["authorDate"],
218
- "commit_message": info["commitMessage"],
219
- "root": info["root"],
220
- "common_git_dir": info["commonGitDir"],
221
- "worktree_git_dir": info["worktreeGitDir"],
222
- "last_tag": info["lastTag"],
223
- "commits_since_last_tag": info["commitsSinceLastTag"],
224
- "remotes": remotes
225
- });
226
- } catch(e) {
227
- exports.debug(`Exception in populating Git Metadata with error : ${e}`, true, e);
228
- return resolve({});
229
- }
230
- }, {dst: exports.findGitConfig(process.cwd())});
231
- } else {
232
- const { remote } = await pGitconfig(info.commonGitDir);
233
- const remotes = Object.keys(remote).map(remoteName => ({name: remoteName, url: remote[remoteName]['url']}));
234
- resolve({
235
- "name": "git",
236
- "sha": info["sha"],
237
- "short_sha": info["abbreviatedSha"],
238
- "branch": info["branch"],
239
- "tag": info["tag"],
240
- "committer": info["committer"],
241
- "committer_date": info["committerDate"],
242
- "author": info["author"],
243
- "author_date": info["authorDate"],
244
- "commit_message": info["commitMessage"],
245
- "root": info["root"],
246
- "common_git_dir": info["commonGitDir"],
247
- "worktree_git_dir": info["worktreeGitDir"],
248
- "last_tag": info["lastTag"],
249
- "commits_since_last_tag": info["commitsSinceLastTag"],
250
- "remotes": remotes
251
- });
252
- }
253
- } catch(err) {
254
- exports.debug(`Exception in populating Git metadata with error : ${err}`, true, err);
255
- resolve({});
256
- }
257
- })
258
- }
259
-
260
- const getCiInfo = () => {
261
- var env = process.env;
262
- // Jenkins
263
- if ((typeof env.JENKINS_URL === "string" && env.JENKINS_URL.length > 0) || (typeof env.JENKINS_HOME === "string" && env.JENKINS_HOME.length > 0)) {
264
- return {
265
- name: "Jenkins",
266
- build_url: env.BUILD_URL,
267
- job_name: env.JOB_NAME,
268
- build_number: env.BUILD_NUMBER
269
- }
270
- }
271
- // CircleCI
272
- if (env.CI === "true" && env.CIRCLECI === "true") {
273
- return {
274
- name: "CircleCI",
275
- build_url: env.CIRCLE_BUILD_URL,
276
- job_name: env.CIRCLE_JOB,
277
- build_number: env.CIRCLE_BUILD_NUM
278
- }
279
- }
280
- // Travis CI
281
- if (env.CI === "true" && env.TRAVIS === "true") {
282
- return {
283
- name: "Travis CI",
284
- build_url: env.TRAVIS_BUILD_WEB_URL,
285
- job_name: env.TRAVIS_JOB_NAME,
286
- build_number: env.TRAVIS_BUILD_NUMBER
287
- }
288
- }
289
- // Codeship
290
- if (env.CI === "true" && env.CI_NAME === "codeship") {
291
- return {
292
- name: "Codeship",
293
- build_url: null,
294
- job_name: null,
295
- build_number: null
296
- }
297
- }
298
- // Bitbucket
299
- if (env.BITBUCKET_BRANCH && env.BITBUCKET_COMMIT) {
300
- return {
301
- name: "Bitbucket",
302
- build_url: env.BITBUCKET_GIT_HTTP_ORIGIN,
303
- job_name: null,
304
- build_number: env.BITBUCKET_BUILD_NUMBER
305
- }
306
- }
307
- // Drone
308
- if (env.CI === "true" && env.DRONE === "true") {
309
- return {
310
- name: "Drone",
311
- build_url: env.DRONE_BUILD_LINK,
312
- job_name: null,
313
- build_number: env.DRONE_BUILD_NUMBER
314
- }
315
- }
316
- // Semaphore
317
- if (env.CI === "true" && env.SEMAPHORE === "true") {
318
- return {
319
- name: "Semaphore",
320
- build_url: env.SEMAPHORE_ORGANIZATION_URL,
321
- job_name: env.SEMAPHORE_JOB_NAME,
322
- build_number: env.SEMAPHORE_JOB_ID
323
- }
324
- }
325
- // GitLab
326
- if (env.CI === "true" && env.GITLAB_CI === "true") {
327
- return {
328
- name: "GitLab",
329
- build_url: env.CI_JOB_URL,
330
- job_name: env.CI_JOB_NAME,
331
- build_number: env.CI_JOB_ID
332
- }
333
- }
334
- // Buildkite
335
- if (env.CI === "true" && env.BUILDKITE === "true") {
336
- return {
337
- name: "Buildkite",
338
- build_url: env.BUILDKITE_BUILD_URL,
339
- job_name: env.BUILDKITE_LABEL || env.BUILDKITE_PIPELINE_NAME,
340
- build_number: env.BUILDKITE_BUILD_NUMBER
341
- }
342
- }
343
- // Visual Studio Team Services
344
- if (env.TF_BUILD === "True") {
345
- return {
346
- name: "Visual Studio Team Services",
347
- build_url: `${env.SYSTEM_TEAMFOUNDATIONSERVERURI}${env.SYSTEM_TEAMPROJECTID}`,
348
- job_name: env.SYSTEM_DEFINITIONID,
349
- build_number: env.BUILD_BUILDID
350
- }
351
- }
352
- // if no matches, return null
353
- return null;
354
- }
355
-
356
184
  let packages = {};
357
185
 
358
186
  exports.getPackageVersion = (package_, bsConfig = null) => {
@@ -394,12 +222,6 @@ exports.getPackageVersion = (package_, bsConfig = null) => {
394
222
  return packageVersion;
395
223
  }
396
224
 
397
- exports.getAgentVersion = () => {
398
- let _path = path.join(__dirname, '../../../package.json');
399
- if(fs.existsSync(_path))
400
- return require(_path).version;
401
- }
402
-
403
225
  const setEnvironmentVariablesForRemoteReporter = (BS_TESTOPS_JWT, BS_TESTOPS_BUILD_HASHED_ID, BS_TESTOPS_ALLOW_SCREENSHOTS, OBSERVABILITY_LAUNCH_SDK_VERSION) => {
404
226
  process.env.BS_TESTOPS_JWT = BS_TESTOPS_JWT;
405
227
  process.env.BS_TESTOPS_BUILD_HASHED_ID = BS_TESTOPS_BUILD_HASHED_ID;
@@ -442,52 +264,6 @@ const setEventListeners = () => {
442
264
  }
443
265
  }
444
266
 
445
- const getBuildDetails = (bsConfig) => {
446
- const isTestObservabilityOptionsPresent = !utils.isUndefined(bsConfig["testObservabilityOptions"]);
447
- let buildName = '',
448
- projectName = '',
449
- buildDescription = '',
450
- buildTags = [];
451
-
452
- /* Pick from environment variables */
453
- buildName = process.env.BROWSERSTACK_BUILD_NAME || buildName;
454
- projectName = process.env.BROWSERSTACK_PROJECT_NAME || projectName;
455
-
456
- /* Pick from testObservabilityOptions */
457
- if(isTestObservabilityOptionsPresent) {
458
- buildName = buildName || bsConfig["testObservabilityOptions"]["buildName"];
459
- projectName = projectName || bsConfig["testObservabilityOptions"]["projectName"];
460
- if(!utils.isUndefined(bsConfig["testObservabilityOptions"]["buildTag"])) buildTags = [...buildTags, ...bsConfig["testObservabilityOptions"]["buildTag"]];
461
- buildDescription = buildDescription || bsConfig["testObservabilityOptions"]["buildDescription"];
462
- }
463
-
464
- /* Pick from run settings */
465
- buildName = buildName || bsConfig["run_settings"]["build_name"];
466
- projectName = projectName || bsConfig["run_settings"]["project_name"];
467
- if(!utils.isUndefined(bsConfig["run_settings"]["build_tag"])) buildTags = [...buildTags, bsConfig["run_settings"]["build_tag"]];
468
-
469
- buildName = buildName || path.basename(path.resolve(process.cwd()));
470
-
471
- return {
472
- buildName,
473
- projectName,
474
- buildDescription,
475
- buildTags
476
- };
477
- }
478
-
479
- const setBrowserstackCypressCliDependency = (bsConfig) => {
480
- const runSettings = bsConfig.run_settings;
481
- if (runSettings.npm_dependencies !== undefined &&
482
- typeof runSettings.npm_dependencies === 'object') {
483
- if (!("browserstack-cypress-cli" in runSettings.npm_dependencies)) {
484
- logger.warn("Missing browserstack-cypress-cli not found in npm_dependencies");
485
- runSettings.npm_dependencies['browserstack-cypress-cli'] = exports.getAgentVersion() || "latest";
486
- logger.warn(`Adding browserstack-cypress-cli version ${runSettings.npm_dependencies['browserstack-cypress-cli']} in npm_dependencies`);
487
- }
488
- }
489
- }
490
-
491
267
  const getCypressConfigFileContent = (bsConfig, cypressConfigPath) => {
492
268
  try {
493
269
  const cypressConfigFile = require(path.resolve(bsConfig ? bsConfig.run_settings.cypress_config_file : cypressConfigPath));
@@ -551,7 +327,7 @@ exports.launchTestSession = async (user_config, bsConfigPath) => {
551
327
  projectName,
552
328
  buildDescription,
553
329
  buildTags
554
- } = getBuildDetails(user_config);
330
+ } = helper.getBuildDetails(user_config);
555
331
  const data = {
556
332
  'format': 'json',
557
333
  'project_name': projectName,
@@ -566,14 +342,14 @@ exports.launchTestSession = async (user_config, bsConfigPath) => {
566
342
  version: os.version(),
567
343
  arch: os.arch()
568
344
  },
569
- 'ci_info': getCiInfo(),
345
+ 'ci_info': helper.getCiInfo(),
570
346
  'build_run_identifier': process.env.BROWSERSTACK_BUILD_RUN_IDENTIFIER,
571
347
  'failed_tests_rerun': process.env.BROWSERSTACK_RERUN || false,
572
- 'version_control': await getGitMetaData(),
348
+ 'version_control': await helper.getGitMetaData(),
573
349
  'observability_version': {
574
350
  frameworkName: "Cypress",
575
351
  frameworkVersion: exports.getPackageVersion('cypress', user_config),
576
- sdkVersion: exports.getAgentVersion()
352
+ sdkVersion: helper.getAgentVersion()
577
353
  }
578
354
  };
579
355
  const config = {
@@ -592,7 +368,7 @@ exports.launchTestSession = async (user_config, bsConfigPath) => {
592
368
  process.env.BS_TESTOPS_BUILD_COMPLETED = true;
593
369
  setEnvironmentVariablesForRemoteReporter(response.data.jwt, response.data.build_hashed_id, response.data.allow_screenshots, data.observability_version.sdkVersion);
594
370
  // setEventListeners();
595
- if(this.isBrowserstackInfra()) setBrowserstackCypressCliDependency(user_config);
371
+ if(this.isBrowserstackInfra()) helper.setBrowserstackCypressCliDependency(user_config);
596
372
  } catch(error) {
597
373
  if(!error.errorType) {
598
374
  if (error.response) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browserstack-cypress-cli",
3
- "version": "1.25.3",
3
+ "version": "1.26.0",
4
4
  "description": "BrowserStack Cypress CLI for Cypress integration with BrowserStack's remote devices.",
5
5
  "main": "index.js",
6
6
  "scripts": {