Skip to content

specs and env options #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Sep 9, 2020
Merged

specs and env options #46

merged 17 commits into from
Sep 9, 2020

Conversation

suryart
Copy link
Collaborator

@suryart suryart commented Aug 25, 2020

This PR adds:

  • --spec/--specs/-s option for running specific specs specified in option on BrowserStack
  • --env option for setting specified option on BrowserStack, it works as same as cypress' --env option, hence we do not have nested support as well.

@suryart suryart changed the title Specs and env options specs and env options Aug 25, 2020
let bsConfigSpecs = bsConfig.run_settings.specs;

if (!this.isUndefined(args.specs)) {
bsConfig.run_settings.specs = args.specs.split(/\s{0,},\s+/).join(',');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check for array as well just like bsConfig.run_settings.specs

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// env option must be set only from command line args as a string
exports.setTestEnvs = (bsConfig, args) => {
if (!this.isUndefined(args.env)) {
bsConfig.run_settings.env = args.env.split(/\s{0,},\s+/).join(',');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.split(/\s{0,},\s+/).join(',') move this to a func? being used 3 time in the last last lines of code

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines +170 to +172
describe: Constants.cliMessages.RUN.SPECS_DESCRIPTION,
type: "string",
default: undefined
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirm the cli messages and default values once

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update the message values.

@@ -249,6 +249,136 @@ describe("capabilityHelper.js", () => {
chai.assert.fail("Promise error");
});
});

context("specs and env from run_setting", () => {
it("sets specs list is present", () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no test where specs list is an Array or passed args is of Array type

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As call to util.setUserSpecs and util.setTestEnvsare made in runs.js and then final state(String) is passed into capabilityHelper. Hence, capabilityHelper always receives string.

specs for array conditions are covered in the util.js itself: https://github.com/browserstack/browserstack-cypress-cli/pull/46/files/961eb70b7347802f7cad51a6192c92b6ec21df39#diff-175b2b2ef3763bf0f62fe44137aa5d34R350

nagpalkaran95
nagpalkaran95 previously approved these changes Sep 2, 2020
Copy link
Collaborator

@nagpalkaran95 nagpalkaran95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@prateekbstack
Copy link
Collaborator

This PR is good to go. Sorry for the delay in response.

@suryart suryart merged commit 8c30b5e into master Sep 9, 2020
@suryart suryart deleted the specs-option branch September 9, 2020 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants