Skip to content

Commit 8367ba6

Browse files
committed
Merge branch 'master' into HST_1588_cyp_o11y_ats2
2 parents 91f6595 + b131de0 commit 8367ba6

File tree

5 files changed

+26
-11
lines changed

5 files changed

+26
-11
lines changed

bin/accessibility-automation/cypress/index.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ afterEach(() => {
333333
let filePath = '';
334334
if (attributes.invocationDetails !== undefined && attributes.invocationDetails.relativeFile !== undefined) {
335335
filePath = attributes.invocationDetails.relativeFile;
336+
} else if (attributes.prevAttempts && attributes.prevAttempts.length > 0) {
337+
filePath = (attributes.prevAttempts[0].invocationDetails && attributes.prevAttempts[0].invocationDetails.relativeFile) || '';
336338
}
337339
const payloadToSend = {
338340
"saveResults": shouldScanTestForAccessibility,
@@ -422,7 +424,10 @@ Cypress.Commands.add('getAccessibilityResults', () => {
422424
}
423425
});
424426

425-
Cypress.Commands.addQuery('performScanSubjectQuery', function (chaining, setTimeout) {
426-
this.set('timeout', setTimeout);
427-
return () => cy.getSubjectFromChain(chaining);
428-
});
427+
if (!Cypress.Commands.hasOwnProperty('_browserstackSDKQueryAdded')) {
428+
Cypress.Commands.addQuery('performScanSubjectQuery', function (chaining, setTimeout) {
429+
this.set('timeout', setTimeout);
430+
return () => cy.getSubjectFromChain(chaining);
431+
});
432+
Cypress.Commands._browserstackSDKQueryAdded = true;
433+
}

bin/commands/runs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,10 @@ module.exports = function run(args, rawArgs) {
368368
}
369369

370370
// Generate custom report!
371-
reportGenerator(bsConfig, data.build_id, args, rawArgs, buildReportData, function(){
371+
reportGenerator(bsConfig, data.build_id, args, rawArgs, buildReportData, function(modifiedExitCode=exitCode){
372372
utils.sendUsageReport(bsConfig, args, `${message}\n${dashboardLink}`, Constants.messageTypes.SUCCESS, null, buildReportData, rawArgs);
373373
markBlockEnd('postBuild');
374-
utils.handleSyncExit(exitCode, data.dashboard_url);
374+
utils.handleSyncExit(modifiedExitCode, data.dashboard_url);
375375
});
376376
} else if(!turboScaleSession){
377377
let stacktraceUrl = getStackTraceUrl();

bin/helpers/reporterHTML.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ let reportGenerator = async (bsConfig, buildId, args, rawArgs, buildReportData,
105105
logger.error('Generating the build report failed.');
106106
logger.error(utils.formatRequest(error.response.statusText, error.response, error.response.data));
107107
utils.sendUsageReport(bsConfig, args, message, messageType, errorCode, buildReportData, rawArgs);
108+
if (cb){
109+
cb(Constants.ERROR_EXIT_CODE);
110+
}
108111
return;
109112
}
110113
}

bin/helpers/utils.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,10 +1179,17 @@ exports.getNumberOfSpecFiles = (bsConfig, args, cypressConfig, turboScaleSession
11791179
logger.debug(`${files ? files.length : 0} spec files found`);
11801180

11811181
if (turboScaleSession) {
1182-
// remove unwanted path prefix for turboscale
1183-
files = files.map((x) => { return path.join(testFolderPath, x.split(testFolderPath)[1]) })
1184-
// setting specs for turboScale as we don't have patched API for turboscale so we will rely on info from CLI
1185-
bsConfig.run_settings.specs = files;
1182+
if (bsConfig.run_settings.cypress_config_file && bsConfig.run_settings.cypress_config_filename !== 'false') {
1183+
const configFilePath = path.resolve(bsConfig.run_settings.cypressConfigFilePath);
1184+
const directory = path.join(path.dirname(configFilePath), '/');
1185+
// remove unwanted path prefix for turboscale
1186+
files = files.map((x) => { return path.join('', x.split(directory)[1]) })
1187+
// setting specs for turboScale as we don't have patched API for turboscale so we will rely on info from CLI
1188+
bsConfig.run_settings.specs = files;
1189+
} else {
1190+
files = files.map((x) => { return path.join(testFolderPath, x.split(testFolderPath)[1]) })
1191+
bsConfig.run_settings.specs = files;
1192+
}
11861193
}
11871194
return files;
11881195
};

package.json

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

0 commit comments

Comments
 (0)