Skip to content

Commit 089525b

Browse files
committed
Adding headed option in run command
1 parent 56c5bc0 commit 089525b

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

bin/commands/runs.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ module.exports = function run(args) {
4545
//accept the local identifier from env variable if provided
4646
utils.setLocalIdentifier(bsConfig);
4747

48+
// run test in headed mode
49+
utils.setHeaded(bsConfig, args);
50+
4851
// Validate browserstack.json values and parallels specified via arguments
4952
return capabilityHelper.validate(bsConfig, args).then(function (cypressJson) {
5053

bin/helpers/constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ const cliMessages = {
9393
ENV_DESCRIPTION: "Specify the environment variables for your spec files",
9494
SYNC_DESCRIPTION: "Makes the run command in sync",
9595
BUILD_REPORT_MESSAGE: "See the entire build report here",
96+
HEADED: "Run tests in headed mode.",
9697
},
9798
COMMON: {
9899
DISABLE_USAGE_REPORTING: "Disable usage reporting",

bin/helpers/utils.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,12 @@ exports.setLocalIdentifier = (bsConfig) => {
333333
}
334334
};
335335

336+
exports.setHeaded = (bsConfig, args) => {
337+
if (!this.isUndefined(args.headed) && args.headed === true) {
338+
bsConfig.run_settings.headless = false;
339+
}
340+
};
341+
336342
exports.getNumberOfSpecFiles = (bsConfig, args, cypressJson) => {
337343
let testFolderPath = cypressJson.integrationFolder || Constants.DEFAULT_CYPRESS_SPEC_PATH;
338344
let globSearchPatttern = bsConfig.run_settings.specs || `${testFolderPath}/**/*.+(${Constants.specFileTypes.join("|")})`;

bin/runner.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,11 @@ var argv = yargs
200200
default: false,
201201
describe: Constants.cliMessages.RUN.SYNC_DESCRIPTION,
202202
type: "boolean"
203+
},
204+
'headed': {
205+
default: true,
206+
describe: Constants.cliMessages.RUN.HEADED,
207+
type: "boolean"
203208
}
204209
})
205210
.help('help')

0 commit comments

Comments
 (0)