browserstack-cypress-cli 1.16.0 → 1.17.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.
@@ -97,6 +97,8 @@ module.exports = function run(args, rawArgs) {
97
97
  // set record feature caps
98
98
  utils.setRecordCaps(bsConfig, args);
99
99
 
100
+ // set build tag caps
101
+ utils.setBuildTags(bsConfig, args);
100
102
  // set node version
101
103
  utils.setNodeVersion(bsConfig, args);
102
104
 
@@ -1,72 +1,115 @@
1
1
  let config = require("./config");
2
- let chalk = require('chalk');
2
+ let chalk = require("chalk");
3
3
 
4
4
  const syncCLI = {
5
- FAILED_SPEC_DETAILS_COL_HEADER: ['Spec', 'Status', 'Browser', 'BrowserStack Session ID'],
5
+ FAILED_SPEC_DETAILS_COL_HEADER: [
6
+ "Spec",
7
+ "Status",
8
+ "Browser",
9
+ "BrowserStack Session ID",
10
+ ],
6
11
  LOGS: {
7
- INIT_LOG: "All tests:"
12
+ INIT_LOG: "All tests:",
8
13
  },
9
14
  INITIAL_DELAY_MULTIPLIER: 10,
10
- DEFAULT_LINE_SEP: "\n--------------------------------------------------------------------------------",
11
- STARTUP_MESSAGE: "BrowserStack machines are now setting up Cypress with the specified npm dependencies for running your tests. It might take some time before your tests start runnning and showing up below..."
15
+ DEFAULT_LINE_SEP:
16
+ "\n--------------------------------------------------------------------------------",
17
+ STARTUP_MESSAGE:
18
+ "BrowserStack machines are now setting up Cypress with the specified npm dependencies for running your tests. It might take some time before your tests start runnning and showing up below...",
12
19
  };
13
20
 
14
21
  const userMessages = {
15
22
  BUILD_FAILED: "Build creation failed.",
16
- BUILD_GENERATE_REPORT_FAILED: "Generating report for the build <build-id> failed.",
23
+ BUILD_GENERATE_REPORT_FAILED:
24
+ "Generating report for the build <build-id> failed.",
17
25
  BUILD_CREATED: "Build created",
18
26
  BUILD_INFO_FAILED: "Failed to get build info.",
19
27
  BUILD_STOP_FAILED: "Failed to stop build.",
20
28
  BUILD_REPORT_MESSAGE: "See the entire build report here:",
21
- ZIP_UPLOADER_NOT_REACHABLE: "Could not reach BrowserStack APIs. Please check your network or see if you need to whitelist *.browserstack.com",
29
+ ZIP_UPLOADER_NOT_REACHABLE:
30
+ "Could not reach BrowserStack APIs. Please check your network or see if you need to whitelist *.browserstack.com",
22
31
  ZIP_UPLOAD_FAILED: "Zip Upload failed.",
23
- ZIP_UPLOAD_LIMIT_EXCEEDED: "The directory size which contains the cypress config file is more than 200 MB. For more info, check out https://www.browserstack.com/docs/automate/cypress/exclude-files",
24
- NODE_MODULES_LIMIT_EXCEEDED: "node_modules upload failed as the size %SIZE% MB is not supported. Dependencies will be installed in runtime. This will have a negative impact on build performance. Reach out to us at browserstack.com/support if you see this warning.",
25
- CONFIG_FILE_CREATED: "BrowserStack Config File created, you can now run browserstack-cypress --config-file run",
26
- CONFIG_FILE_EXISTS: "File already exists, delete the browserstack.json file manually. skipping...",
27
- DIR_NOT_FOUND: "Given path does not exist. Failed to create browserstack.json in %s",
28
- MD5_CHECK_FAILED: "There was some issue while checking if zip is already uploaded.",
32
+ ZIP_UPLOAD_LIMIT_EXCEEDED:
33
+ "The directory size which contains the cypress config file is more than 200 MB. For more info, check out https://www.browserstack.com/docs/automate/cypress/exclude-files",
34
+ NODE_MODULES_LIMIT_EXCEEDED:
35
+ "node_modules upload failed as the size %SIZE% MB is not supported. Dependencies will be installed in runtime. This will have a negative impact on build performance. Reach out to us at browserstack.com/support if you see this warning.",
36
+ CONFIG_FILE_CREATED:
37
+ "BrowserStack Config File created, you can now run browserstack-cypress --config-file run",
38
+ CONFIG_FILE_EXISTS:
39
+ "File already exists, delete the browserstack.json file manually. skipping...",
40
+ DIR_NOT_FOUND:
41
+ "Given path does not exist. Failed to create browserstack.json in %s",
42
+ MD5_CHECK_FAILED:
43
+ "There was some issue while checking if zip is already uploaded.",
29
44
  ZIP_DELETE_FAILED: "Could not delete tests.zip successfully.",
30
45
  ZIP_DELETED: "Deleted tests.zip successfully.",
31
- NPM_INSTALL_AND_UPLOAD: "Installing required dependencies and building the package to upload to BrowserStack",
46
+ NPM_INSTALL_AND_UPLOAD:
47
+ "Installing required dependencies and building the package to upload to BrowserStack",
32
48
  NPM_DELETE_FAILED: "Could not delete the dependency packages.",
33
49
  NPM_DELETED: "Deleted dependency packages successfully.",
34
- API_DEPRECATED: "This version of API is deprecated, please use latest version of API.",
50
+ API_DEPRECATED:
51
+ "This version of API is deprecated, please use latest version of API.",
35
52
  FAILED_TO_ZIP: "Failed to zip files.",
36
- FAILED_CREATE_NPM_ARCHIVE: "CLI execution failed due to some issue in npm setup. Please retry.",
37
- FAILED_MD5_CHECK: "Something went wrong - you can retry running browserstack-cypress with ‘--force-upload’ parameter, or contact BrowserStack Support.",
53
+ FAILED_CREATE_NPM_ARCHIVE:
54
+ "CLI execution failed due to some issue in npm setup. Please retry.",
55
+ FAILED_MD5_CHECK:
56
+ "Something went wrong - you can retry running browserstack-cypress with ‘--force-upload’ parameter, or contact BrowserStack Support.",
38
57
  VISIT_DASHBOARD: "Visit the Automate dashboard for real-time test reporting:",
39
- CONFLICTING_INIT_ARGUMENTS: "Conflicting arguments given. You can use --path only with a file name, and not with a file path.",
40
- NO_PARALLELS: "Your specs will run sequentially on a single machine. Read more about running your specs in parallel here: https://www.browserstack.com/docs/automate/cypress/run-tests-in-parallel",
41
- NO_NPM_DEPENDENCIES: "No npm dependencies specified - your specs might fail if they need any packages to be installed before running.",
42
- NO_NPM_DEPENDENCIES_READ_MORE: "Read more about npm dependencies here: https://www.browserstack.com/docs/automate/cypress/npm-packages. You can suppress this warning by using --disable-npm-warning flag.",
58
+ CONFLICTING_INIT_ARGUMENTS:
59
+ "Conflicting arguments given. You can use --path only with a file name, and not with a file path.",
60
+ NO_PARALLELS:
61
+ "Your specs will run sequentially on a single machine. Read more about running your specs in parallel here: https://www.browserstack.com/docs/automate/cypress/run-tests-in-parallel",
62
+ NO_NPM_DEPENDENCIES:
63
+ "No npm dependencies specified - your specs might fail if they need any packages to be installed before running.",
64
+ NO_NPM_DEPENDENCIES_READ_MORE:
65
+ "Read more about npm dependencies here: https://www.browserstack.com/docs/automate/cypress/npm-packages. You can suppress this warning by using --disable-npm-warning flag.",
43
66
  VALIDATING_CONFIG: "Validating the config",
44
67
  UPLOADING_TESTS: "Uploading the tests to BrowserStack",
45
68
  UPLOADING_TESTS_SUCCESS: "Uploaded tests successfully",
46
69
  UPLOADING_NPM_PACKAGES: "Uploading required node_modules to BrowserStack",
47
70
  UPLOADING_NPM_PACKAGES_SUCCESS: "Uploaded node_modules successfully",
48
- SKIP_UPLOADING_TESTS: "Skipping zip upload since BrowserStack already has your test suite that has not changed since the last run.",
49
- SKIP_UPLOADING_NPM_PACKAGES: "Skipping the upload of node_modules since BrowserStack has already cached your npm dependencies that have not changed since the last run.",
71
+ SKIP_UPLOADING_TESTS:
72
+ "Skipping zip upload since BrowserStack already has your test suite that has not changed since the last run.",
73
+ SKIP_UPLOADING_NPM_PACKAGES:
74
+ "Skipping the upload of node_modules since BrowserStack has already cached your npm dependencies that have not changed since the last run.",
50
75
  LOCAL_TRUE: "you will now be able to test localhost / private URLs",
51
76
  LOCAL_FALSE: "you won't be able to test localhost / private URLs",
52
- EXIT_SYNC_CLI_MESSAGE: "Exiting the CLI, but your build is still running. You can use the --sync option to keep getting test updates. You can also use the build-info <build-id> command now.",
77
+ EXIT_SYNC_CLI_MESSAGE:
78
+ "Exiting the CLI, but your build is still running. You can use the --sync option to keep getting test updates. You can also use the build-info <build-id> command now.",
53
79
  FATAL_NETWORK_ERROR: `fatal: unable to access '${config.buildUrl}': Could not resolve host: ${config.rails_host}`,
54
80
  RETRY_LIMIT_EXCEEDED: `Max retries exceeded trying to connect to the host (retries: ${config.retries})`,
55
81
  CHECK_DASHBOARD_AT: "Please check the build status at: ",
56
- CYPRESS_VERSION_CHANGED: "Your build will run using Cypress <actualVersion> instead of Cypress <preferredVersion>.<frameworkUpgradeMessage> Read more about supported versions here: http://browserstack.com/docs/automate/cypress/supported-versions",
82
+ CYPRESS_VERSION_CHANGED:
83
+ "Your build will run using Cypress <actualVersion> instead of Cypress <preferredVersion>.<frameworkUpgradeMessage> Read more about supported versions here: http://browserstack.com/docs/automate/cypress/supported-versions",
57
84
  LOCAL_START_FAILED: "Local Testing setup failed.",
58
85
  LOCAL_STOP_FAILED: "Local Binary stop failed.",
59
- INVALID_LOCAL_MODE_WARNING: "Invalid value specified for local_mode. local_mode: (\"always-on\" | \"on-demand\"). For more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference",
60
- LOCAL_BINARY_ALREADY_RUNNING: "We found an existing BrowserStack Local connection running from your account. Using the existing connection for this build. If you wish to use a new Local connection for your build, please specify a value for 'local_identifier' within 'connection_settings' in your browserstack.json config.",
61
- SPEC_LIMIT_WARNING: "You might not see all your results on the dashboard because of high spec count, please consider reducing the number of spec files in this folder.",
62
- DOWNLOAD_BUILD_ARTIFACTS_FAILED: "Downloading build artifacts for the build <build-id> failed for <machine-count> machines.",
63
- ASYNC_DOWNLOADS: "Test artifacts as specified under 'downloads' can be downloaded after the build has completed its run, using 'browserstack-cypress generate-downloads <build-id>'",
64
- DOWNLOAD_BUILD_ARTIFACTS_SUCCESS: "Your build artifact(s) have been successfully downloaded in '<user-path>/build_artifacts/<build-id>' directory",
65
- LATEST_SYNTAX_TO_ACTUAL_VERSION_MESSAGE: "Your build will run using Cypress <actualVersion> as you had specified <latestSyntaxVersion>.<frameworkUpgradeMessage> Read more about supported versions here: http://browserstack.com/docs/automate/cypress/supported-versions",
66
- PROCESS_KILL_MESSAGE: "Stopping the CLI and the execution of the build on BrowserStack",
67
- BUILD_FAILED_ERROR: "The above stacktrace has been thrown by Cypress when we tried to run your build. If your test suite requires npm dependencies then please specify them on browserstack.json. Read more at " + chalk.blueBright("https://www.browserstack.com/docs/automate/cypress/npm-packages") + ". Also, we recommend you to try running the build locally using ‘cypress run’ and if it works fine then please reach out to support at " + chalk.blueBright("https://www.browserstack.com/contact#technical-support"),
68
- SPEC_TIMEOUT_LIMIT_WARNING: "Value for the 'spec_timeout' key not in the 1-120 range. Going ahead with 30 mins as the default spec timeout. Read more about how to specify the option in https://browserstack.com/docs/automate/cypress/spec-timeout",
69
- SPEC_LIMIT_SUCCESS_MESSAGE: "Spec timeout specified as <x> minutes. If any of your specs exceed the specified time limit, it would be forcibly killed by BrowserStack"
86
+ INVALID_LOCAL_MODE_WARNING:
87
+ 'Invalid value specified for local_mode. local_mode: ("always-on" | "on-demand"). For more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference',
88
+ LOCAL_BINARY_ALREADY_RUNNING:
89
+ "We found an existing BrowserStack Local connection running from your account. Using the existing connection for this build. If you wish to use a new Local connection for your build, please specify a value for 'local_identifier' within 'connection_settings' in your browserstack.json config.",
90
+ SPEC_LIMIT_WARNING:
91
+ "You might not see all your results on the dashboard because of high spec count, please consider reducing the number of spec files in this folder.",
92
+ DOWNLOAD_BUILD_ARTIFACTS_FAILED:
93
+ "Downloading build artifacts for the build <build-id> failed for <machine-count> machines.",
94
+ ASYNC_DOWNLOADS:
95
+ "Test artifacts as specified under 'downloads' can be downloaded after the build has completed its run, using 'browserstack-cypress generate-downloads <build-id>'",
96
+ DOWNLOAD_BUILD_ARTIFACTS_SUCCESS:
97
+ "Your build artifact(s) have been successfully downloaded in '<user-path>/build_artifacts/<build-id>' directory",
98
+ LATEST_SYNTAX_TO_ACTUAL_VERSION_MESSAGE:
99
+ "Your build will run using Cypress <actualVersion> as you had specified <latestSyntaxVersion>.<frameworkUpgradeMessage> Read more about supported versions here: http://browserstack.com/docs/automate/cypress/supported-versions",
100
+ PROCESS_KILL_MESSAGE:
101
+ "Stopping the CLI and the execution of the build on BrowserStack",
102
+ BUILD_FAILED_ERROR:
103
+ "The above stacktrace has been thrown by Cypress when we tried to run your build. If your test suite requires npm dependencies then please specify them on browserstack.json. Read more at " +
104
+ chalk.blueBright(
105
+ "https://www.browserstack.com/docs/automate/cypress/npm-packages"
106
+ ) +
107
+ ". Also, we recommend you to try running the build locally using ‘cypress run’ and if it works fine then please reach out to support at " +
108
+ chalk.blueBright("https://www.browserstack.com/contact#technical-support"),
109
+ SPEC_TIMEOUT_LIMIT_WARNING:
110
+ "Value for the 'spec_timeout' key not in the 1-120 range. Going ahead with 30 mins as the default spec timeout. Read more about how to specify the option in https://browserstack.com/docs/automate/cypress/spec-timeout",
111
+ SPEC_LIMIT_SUCCESS_MESSAGE:
112
+ "Spec timeout specified as <x> minutes. If any of your specs exceed the specified time limit, it would be forcibly killed by BrowserStack",
70
113
  };
71
114
 
72
115
  const validationMessages = {
@@ -75,37 +118,62 @@ const validationMessages = {
75
118
  EMPTY_TEST_SUITE: "Test suite is empty",
76
119
  EMPTY_BROWSERSTACK_JSON: "Empty browserstack.json",
77
120
  EMPTY_RUN_SETTINGS: "Empty run settings",
78
- EMPTY_CYPRESS_PROJ_DIR: "cypress_proj_dir is not set in run_settings. See https://www.browserstack.com/docs/automate/cypress/sample-tutorial to learn more.",
121
+ EMPTY_CYPRESS_PROJ_DIR:
122
+ "cypress_proj_dir is not set in run_settings. See https://www.browserstack.com/docs/automate/cypress/sample-tutorial to learn more.",
79
123
  VALIDATED: "browserstack.json file is validated",
80
124
  NOT_VALID: "browerstack.json is not valid",
81
125
  NOT_VALID_JSON: "browerstack.json is not a valid json",
82
126
  INVALID_EXTENSION: "Invalid files, please remove these files and try again.",
83
- INVALID_PARALLELS_CONFIGURATION: "Invalid value specified for parallels to use. Maximum parallels to use should be a number greater than 0.",
127
+ INVALID_PARALLELS_CONFIGURATION:
128
+ "Invalid value specified for parallels to use. Maximum parallels to use should be a number greater than 0.",
84
129
  INVALID_CYPRESS_CONFIG_FILE: "Invalid cypress_config_file",
85
- CYPRESS_JSON_NOT_FOUND: "cypress.json file is not found at cypress_proj_dir path ",
130
+ CYPRESS_JSON_NOT_FOUND:
131
+ "cypress.json file is not found at cypress_proj_dir path ",
86
132
  INVALID_CYPRESS_JSON: "cypress.json is not a valid json",
87
- INVALID_DEFAULT_AUTH_PARAMS: "Your username and access key are required to run your tests on BrowserStack. Learn more at https://www.browserstack.com/docs/automate/cypress/authentication",
88
- LOCAL_NOT_SET: "To test <baseUrlValue> on BrowserStack, you will have to set up Local testing. Read more here: https://www.browserstack.com/docs/automate/cypress/local-testing",
89
- INCORRECT_DIRECTORY_STRUCTURE: "No tests to run. Note that your Cypress tests should be in the same directory where the cypress.json exists.",
90
- INVALID_CLI_LOCAL_IDENTIFIER: "When using --local-identifier, a value needs to be supplied. \n--local-identifier <String>.\nFor more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference",
91
- INVALID_LOCAL_MODE: "When using --local-mode, a value needs to be supplied. \n--local-mode (\"always-on\" | \"on-demand\").\nFor more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference",
92
- INVALID_LOCAL_CONFIG_FILE: "Using --local-config-file requires an input of the form /path/to/config-file.yml.\nFor more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference",
93
- INVALID_LOCAL_IDENTIFIER: "Invalid value specified for local_identifier. For more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference",
94
- INVALID_BROWSER_ARGS: "Aborting as an unacceptable value was passed for --browser. Read more at https://www.browserstack.com/docs/automate/cypress/cli-reference",
95
- INVALID_LOCAL_ASYNC_ARGS: "Cannot run in --async mode when local is set to true. Please run the build after removing --async",
96
- INVALID_GEO_LOCATION: "[BROWSERSTACK_INVALID_COUNTRY_CODE] The country code specified for 'geolocation' is invalid. For list of supported countries, refer to - https://www.browserstack.com/ip-geolocation",
97
- NOT_SUPPORTED_GEO_LOCATION: "The country code you have passed for IP Geolocation is currently not supported. Please refer the link https://www.browserstack.com/ip-geolocation for a list of supported countries.",
98
- NOT_AVAILABLE_GEO_LOCATION: "The country code you have passed for IP Geolocation is not available at the moment. Please try again in a few hours.",
99
- ACCESS_DENIED_GEO_LOCATION: "'geolocation' (IP Geolocation feature) capability is not supported in your account. It is only available under Enterprise plans, refer https://www.browserstack.com/ip-geolocation for more details.",
100
- NOT_ALLOWED_GEO_LOCATION_AND_LOCAL_MODE: "IP Geolocation feature is not available in conjunction with BrowserStack Local.",
101
- HOME_DIRECTORY_NOT_FOUND: "Specified home directory could not be found. Please make sure the path of the home directory is correct.",
102
- HOME_DIRECTORY_NOT_A_DIRECTORY: "Specified home directory is not a directory. The home directory can only be a directory and not a file.",
103
- CYPRESS_CONFIG_FILE_NOT_PART_OF_HOME_DIRECTORY: "Could not find cypress.json within the specified home directory. Please make sure cypress.json resides within the home directory.",
104
- SPEC_TIMEOUT_LIMIT_ERROR: "The maximum allowed value of 'spec_timeout' is 120. Read more on https://browserstack.com/docs/automate/cypress/spec-timeout ",
105
- SPEC_TIMEOUT_NOT_PASSED_ERROR: "'spec_timeout' key not specified. Going ahead with 30 mins as the default spec timeout. Read more about how to specify the option in https://browserstack.com/docs/automate/cypress/spec-timeout ",
106
- PROJECT_ID_MISSING: "You have specified '--record' flag but you've not provided the 'projectId' in cypress.json or in browserstack.json. Your record functionality on cypress.io dashboard might not work as it needs both the key and the projectId",
107
- RECORD_KEY_MISSING: "You have specified '--record' flag but you've not provided the '--record-key' and we could not find any value in 'CYPRESS_RECORD_KEY' environment variable. Your record functionality on cypress.io dashboard might not work as it needs the key and projectId",
108
- NODE_VERSION_PARSING_ERROR: "We weren't able to successfully parse the specified nodeVersion. We will be using the default nodeVersion to run your tests."
133
+ INVALID_DEFAULT_AUTH_PARAMS:
134
+ "Your username and access key are required to run your tests on BrowserStack. Learn more at https://www.browserstack.com/docs/automate/cypress/authentication",
135
+ LOCAL_NOT_SET:
136
+ "To test <baseUrlValue> on BrowserStack, you will have to set up Local testing. Read more here: https://www.browserstack.com/docs/automate/cypress/local-testing",
137
+ INCORRECT_DIRECTORY_STRUCTURE:
138
+ "No tests to run. Note that your Cypress tests should be in the same directory where the cypress.json exists.",
139
+ INVALID_CLI_LOCAL_IDENTIFIER:
140
+ "When using --local-identifier, a value needs to be supplied. \n--local-identifier <String>.\nFor more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference",
141
+ INVALID_LOCAL_MODE:
142
+ 'When using --local-mode, a value needs to be supplied. \n--local-mode ("always-on" | "on-demand").\nFor more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference',
143
+ INVALID_LOCAL_CONFIG_FILE:
144
+ "Using --local-config-file requires an input of the form /path/to/config-file.yml.\nFor more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference",
145
+ INVALID_LOCAL_IDENTIFIER:
146
+ "Invalid value specified for local_identifier. For more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference",
147
+ INVALID_BROWSER_ARGS:
148
+ "Aborting as an unacceptable value was passed for --browser. Read more at https://www.browserstack.com/docs/automate/cypress/cli-reference",
149
+ INVALID_LOCAL_ASYNC_ARGS:
150
+ "Cannot run in --async mode when local is set to true. Please run the build after removing --async",
151
+ INVALID_GEO_LOCATION:
152
+ "[BROWSERSTACK_INVALID_COUNTRY_CODE] The country code specified for 'geolocation' is invalid. For list of supported countries, refer to - https://www.browserstack.com/ip-geolocation",
153
+ NOT_SUPPORTED_GEO_LOCATION:
154
+ "The country code you have passed for IP Geolocation is currently not supported. Please refer the link https://www.browserstack.com/ip-geolocation for a list of supported countries.",
155
+ NOT_AVAILABLE_GEO_LOCATION:
156
+ "The country code you have passed for IP Geolocation is not available at the moment. Please try again in a few hours.",
157
+ ACCESS_DENIED_GEO_LOCATION:
158
+ "'geolocation' (IP Geolocation feature) capability is not supported in your account. It is only available under Enterprise plans, refer https://www.browserstack.com/ip-geolocation for more details.",
159
+ NOT_ALLOWED_GEO_LOCATION_AND_LOCAL_MODE:
160
+ "IP Geolocation feature is not available in conjunction with BrowserStack Local.",
161
+ HOME_DIRECTORY_NOT_FOUND:
162
+ "Specified home directory could not be found. Please make sure the path of the home directory is correct.",
163
+ HOME_DIRECTORY_NOT_A_DIRECTORY:
164
+ "Specified home directory is not a directory. The home directory can only be a directory and not a file.",
165
+ CYPRESS_CONFIG_FILE_NOT_PART_OF_HOME_DIRECTORY:
166
+ "Could not find cypress.json within the specified home directory. Please make sure cypress.json resides within the home directory.",
167
+ SPEC_TIMEOUT_LIMIT_ERROR:
168
+ "The maximum allowed value of 'spec_timeout' is 120. Read more on https://browserstack.com/docs/automate/cypress/spec-timeout ",
169
+ SPEC_TIMEOUT_NOT_PASSED_ERROR:
170
+ "'spec_timeout' key not specified. Going ahead with 30 mins as the default spec timeout. Read more about how to specify the option in https://browserstack.com/docs/automate/cypress/spec-timeout ",
171
+ PROJECT_ID_MISSING:
172
+ "You have specified '--record' flag but you've not provided the 'projectId' in cypress.json or in browserstack.json. Your record functionality on cypress.io dashboard might not work as it needs both the key and the projectId",
173
+ RECORD_KEY_MISSING:
174
+ "You have specified '--record' flag but you've not provided the '--record-key' and we could not find any value in 'CYPRESS_RECORD_KEY' environment variable. Your record functionality on cypress.io dashboard might not work as it needs the key and projectId",
175
+ NODE_VERSION_PARSING_ERROR:
176
+ "We weren't able to successfully parse the specified nodeVersion. We will be using the default nodeVersion to run your tests.",
109
177
  };
110
178
 
111
179
  const cliMessages = {
@@ -126,26 +194,34 @@ const cliMessages = {
126
194
  STOP_MESSAGE: "Stopping build with given buildId ",
127
195
  },
128
196
  RUN: {
129
- PARALLEL_DESC: "The maximum number of parallels to use to run your test suite",
197
+ PARALLEL_DESC:
198
+ "The maximum number of parallels to use to run your test suite",
130
199
  INFO: "Run your tests on BrowserStack. For more help: `browserstack-cypress run --help`.",
131
200
  CYPRESS_DESC: "Path to Cypress config file",
132
201
  CYPRESS_CONFIG_DEMAND: "Cypress config file is required",
133
202
  BUILD_NAME: "The build name you want to use to name your test runs",
134
203
  EXCLUDE: "Exclude files matching a pattern from zipping and uploading",
135
- DEFAULT_PARALLEL_MESSAGE: "Here goes the number of parallels you want to run",
204
+ DEFAULT_PARALLEL_MESSAGE:
205
+ "Here goes the number of parallels you want to run",
136
206
  SPECS_DESCRIPTION: "Specify the spec files to run",
137
207
  ENV_DESCRIPTION: "Specify the environment variables for your spec files",
138
208
  SYNC_DESCRIPTION: "Makes the run command in sync",
139
209
  ASYNC_DESCRIPTION: "Makes the run command in async",
140
210
  BUILD_REPORT_MESSAGE: "See the entire build report here",
141
211
  HEADED: "Run your tests in a headed browser instead of a headless browser",
142
- LOCAL: "Accepted values: (true | false) - create a local testing connection to let you test staging and localhost websites, or sites behind proxies; learn more at browserstack.com/local-testing",
143
- LOCAL_MODE: 'Accepted values: ("always-on" | "on-demand") - if you choose to keep the binary "always-on", it will speed up your tests by keeping the Local connection warmed up in the background; otherwise, you can choose to have it spawn and killed for every build',
144
- LOCAL_IDENTIFIER: "Accepted values: String - assign an identifier to your Local process instance",
145
- LOCAL_CONFIG_FILE: "Accepted values: String - path to local config-file to your Local process instance. Learn more at https://www.browserstack.com/local-testing/binary-params",
146
- SYNC_NO_WRAP: "Wrap the spec names in --sync mode in case of smaller terminal window size pass --no-wrap",
212
+ LOCAL:
213
+ "Accepted values: (true | false) - create a local testing connection to let you test staging and localhost websites, or sites behind proxies; learn more at browserstack.com/local-testing",
214
+ LOCAL_MODE:
215
+ 'Accepted values: ("always-on" | "on-demand") - if you choose to keep the binary "always-on", it will speed up your tests by keeping the Local connection warmed up in the background; otherwise, you can choose to have it spawn and killed for every build',
216
+ LOCAL_IDENTIFIER:
217
+ "Accepted values: String - assign an identifier to your Local process instance",
218
+ LOCAL_CONFIG_FILE:
219
+ "Accepted values: String - path to local config-file to your Local process instance. Learn more at https://www.browserstack.com/local-testing/binary-params",
220
+ SYNC_NO_WRAP:
221
+ "Wrap the spec names in --sync mode in case of smaller terminal window size pass --no-wrap",
147
222
  BROWSER_DESCRIPTION: "Specify the browsers you need to run your tests on.",
148
- CONFIG_DESCRIPTION: "Set configuration values. Separate multiple values with a comma. The values set here override any values set in your configuration file.",
223
+ CONFIG_DESCRIPTION:
224
+ "Set configuration values. Separate multiple values with a comma. The values set here override any values set in your configuration file.",
149
225
  REPORTER: "Specify the custom reporter to use",
150
226
  REPORTER_OPTIONS: "Specify reporter options for custom reporter",
151
227
  CYPRESS_GEO_LOCATION: "Enterprise feature to simulate website and mobile behavior from different locations.",
@@ -153,11 +229,13 @@ const cliMessages = {
153
229
  RECORD: "Pass the --record flag to record your Cypress runs on Cypress.io dashboard. Note: You also need to specify '--record-key' and '--projectId' arguments either in CLI or in browserstack.json.",
154
230
  RECORD_KEY: "You can specify the 'key' that is needed to record your runs on Cypress.io dashboard using the '--record-key' argument. Alternatively, you can also pass it on browserstack.json",
155
231
  PROJECT_ID: "You can pass the 'projectId' of your Cypress.io project where you want to record your runs if specifying the '--record' key. You can also specify this in your cypress.json or in your browserstack.json.",
156
- NODE_VERSION: "Pass the node version that you want BrowserStack to use to run your Cypress tests on."
232
+ NODE_VERSION: "Pass the node version that you want BrowserStack to use to run your Cypress tests on.",
233
+ BUILD_TAG: "Add a tag to your build to filter builds based on tag values on the Dashboard."
157
234
  },
158
235
  COMMON: {
159
236
  DISABLE_USAGE_REPORTING: "Disable usage reporting",
160
- FORCE_UPLOAD: "Force the upload of your test files even if BrowserStack has detected no changes in your suite since you last ran",
237
+ FORCE_UPLOAD:
238
+ "Force the upload of your test files even if BrowserStack has detected no changes in your suite since you last ran",
161
239
  USERNAME: "Your BrowserStack username",
162
240
  ACCESS_KEY: "Your BrowserStack access key",
163
241
  NO_NPM_WARNING: "No NPM warning if npm_dependencies is empty",
@@ -166,10 +244,10 @@ const cliMessages = {
166
244
  DEBUG: "Use this option to get debug logs on the CLI console.",
167
245
  },
168
246
  GENERATE_REPORT: {
169
- INFO: "Generates the build report"
247
+ INFO: "Generates the build report",
170
248
  },
171
249
  GENERATE_DOWNLOADS: {
172
- INFO: "Downloads the build artifacts"
250
+ INFO: "Downloads the build artifacts",
173
251
  },
174
252
  };
175
253
 
@@ -179,70 +257,112 @@ const messageTypes = {
179
257
  INFO: "info",
180
258
  WARNING: "warning",
181
259
  UNKNOWN: "unknown",
182
- NULL: null
183
- }
260
+ NULL: null,
261
+ };
184
262
 
185
- const allowedFileTypes = ['js', 'json', 'txt', 'ts', 'feature', 'features', 'pdf', 'jpg', 'jpeg', 'png', 'zip', 'npmrc', 'xml', 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'jsx', 'coffee', 'cjsx', 'csv', 'tsv', 'yml', 'yaml', 'env', 'mov', 'mp4', 'mp3', 'wav', 'gz', 'tgz', 'tiff', 'bmp', 'msg', 'gif', 'sql'];
263
+ const allowedFileTypes = [
264
+ "js",
265
+ "json",
266
+ "txt",
267
+ "ts",
268
+ "feature",
269
+ "features",
270
+ "pdf",
271
+ "jpg",
272
+ "jpeg",
273
+ "png",
274
+ "zip",
275
+ "npmrc",
276
+ "xml",
277
+ "doc",
278
+ "docx",
279
+ "ppt",
280
+ "pptx",
281
+ "xls",
282
+ "xlsx",
283
+ "jsx",
284
+ "coffee",
285
+ "cjsx",
286
+ "csv",
287
+ "tsv",
288
+ "yml",
289
+ "yaml",
290
+ "env",
291
+ "mov",
292
+ "mp4",
293
+ "mp3",
294
+ "wav",
295
+ "gz",
296
+ "tgz",
297
+ "tiff",
298
+ "bmp",
299
+ "msg",
300
+ "gif",
301
+ "sql",
302
+ "pmc",
303
+ "pmp",
304
+ "max",
305
+ ];
186
306
 
187
307
  const filesToIgnoreWhileUploading = [
188
- '**/node_modules/**',
189
- 'node_modules/**',
190
- 'package-lock.json',
191
- 'package.json',
192
- 'browserstack-package.json',
193
- 'tests.zip',
194
- 'cypress.json',
195
- '.idea/**',
196
- '.vscode/**',
197
- '.npm/**',
198
- 'bstackPackages.tar.gz',
199
- 'tmpBstackPackages/**',
200
- '.yarn/**',
201
- 'build_artifacts/**'
308
+ "**/node_modules/**",
309
+ "node_modules/**",
310
+ "package-lock.json",
311
+ "package.json",
312
+ "browserstack-package.json",
313
+ "tests.zip",
314
+ "cypress.json",
315
+ ".idea/**",
316
+ ".vscode/**",
317
+ ".npm/**",
318
+ "bstackPackages.tar.gz",
319
+ "tmpBstackPackages/**",
320
+ ".yarn/**",
321
+ "build_artifacts/**",
202
322
  ];
203
323
 
204
324
  const readDirOptions = {
205
- cwd: '.',
325
+ cwd: ".",
206
326
  matchBase: true,
207
327
  ignore: [],
208
328
  dot: true,
209
329
  stat: true,
210
- pattern: ''
211
- }
330
+ pattern: "",
331
+ };
212
332
 
213
333
  const hashingOptions = {
214
334
  parallel: 10,
215
- algo: 'md5',
216
- encoding: 'hex',
335
+ algo: "md5",
336
+ encoding: "hex",
217
337
  };
218
338
 
219
339
  const packageInstallerOptions = {
220
340
  npmLoad: {
221
- loglevel: 'silent',
222
- only: 'dev',
223
- 'save-dev': true,
224
- 'only-dev': true,
225
- }
226
- }
341
+ loglevel: "silent",
342
+ only: "dev",
343
+ "save-dev": true,
344
+ "only-dev": true,
345
+ },
346
+ };
227
347
 
228
- const specFileTypes = ['js', 'ts', 'feature', 'jsx', 'coffee', 'cjsx'];
348
+ const specFileTypes = ["js", "ts", "feature", "jsx", "coffee", "cjsx"];
229
349
 
230
- const DEFAULT_CYPRESS_SPEC_PATH = "cypress/integration"
350
+ const DEFAULT_CYPRESS_SPEC_PATH = "cypress/integration";
231
351
 
232
352
  const SPEC_TOTAL_CHAR_LIMIT = 32243;
233
353
  const METADATA_CHAR_BUFFER_PER_SPEC = 175;
234
354
 
235
355
  const usageReportingConstants = {
236
- GENERATE_DOWNLOADS: 'generate-downloads called',
237
- }
356
+ GENERATE_DOWNLOADS: "generate-downloads called",
357
+ };
238
358
 
239
- const LATEST_VERSION_SYNTAX_REGEX = /\d*.latest(.\d*)?/gm
359
+ const LATEST_VERSION_SYNTAX_REGEX = /\d*.latest(.\d*)?/gm;
240
360
 
241
- const AUTH_REGEX = /"auth" *: *{[\s\S]*?}/g
361
+ const AUTH_REGEX = /"auth" *: *{[\s\S]*?}/g;
242
362
 
243
- const CLI_ARGS_REGEX = /(?<=("u"|"username"|"k"|"key") *: *)"[^,}]*/g
363
+ const CLI_ARGS_REGEX = /(?<=("u"|"username"|"k"|"key") *: *)"[^,}]*/g;
244
364
 
245
- const RAW_ARGS_REGEX = /(?<=("-u"|"-username"|"-k"|"-key") *, *)"[^,\]]*/g
365
+ const RAW_ARGS_REGEX = /(?<=("-u"|"-username"|"-k"|"-key") *, *)"[^,\]]*/g;
246
366
 
247
367
  const ERROR_EXIT_CODE = 1;
248
368
 
@@ -250,9 +370,9 @@ const BUILD_FAILED_EXIT_CODE = 3;
250
370
 
251
371
  const REDACTED = "[REDACTED]";
252
372
 
253
- const REDACTED_AUTH =`auth: { "username": ${REDACTED}, "access_key": ${REDACTED} }`;
373
+ const REDACTED_AUTH = `auth: { "username": ${REDACTED}, "access_key": ${REDACTED} }`;
254
374
 
255
- const SPEC_TIMEOUT_LIMIT = 120 // IN MINS
375
+ const SPEC_TIMEOUT_LIMIT = 120; // IN MINS
256
376
 
257
377
  const CYPRESS_CUSTOM_ERRORS_TO_PRINT_KEY = "custom_errors_to_print";
258
378
 
@@ -281,5 +401,5 @@ module.exports = Object.freeze({
281
401
  REDACTED,
282
402
  BUILD_FAILED_EXIT_CODE,
283
403
  SPEC_TIMEOUT_LIMIT,
284
- CYPRESS_CUSTOM_ERRORS_TO_PRINT_KEY
404
+ CYPRESS_CUSTOM_ERRORS_TO_PRINT_KEY,
285
405
  });
@@ -444,6 +444,20 @@ exports.setTestEnvs = (bsConfig, args) => {
444
444
  logger.debug(`Setting env vars = ${bsConfig.run_settings.env}`);
445
445
  }
446
446
 
447
+ exports.setBuildTags = (bsConfig, args) => {
448
+ let buildTag = undefined;
449
+ if(!this.isUndefined(args["build-tag"])) {
450
+ buildTag = args["build-tag"];
451
+ } else {
452
+ buildTag = bsConfig.run_settings.build_tag;
453
+ }
454
+ if(!this.isUndefined(buildTag)) {
455
+ buildTag = buildTag.toString();
456
+ }
457
+ bsConfig.run_settings.build_tag = buildTag;
458
+ logger.debug(`Setting the build tag = ${bsConfig.run_settings.build_tag}`);
459
+ };
460
+
447
461
  exports.setSystemEnvs = (bsConfig) => {
448
462
  let envKeys = {};
449
463
 
package/bin/runner.js CHANGED
@@ -271,6 +271,11 @@ var argv = yargs
271
271
  default: undefined,
272
272
  describe: Constants.cliMessages.RUN.NODE_VERSION,
273
273
  type: "string"
274
+ },
275
+ 'build-tag': {
276
+ default: undefined,
277
+ describe: Constants.cliMessages.RUN.BUILD_TAG,
278
+ type: "string"
274
279
  }
275
280
  })
276
281
  .help('help')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browserstack-cypress-cli",
3
- "version": "1.16.0",
3
+ "version": "1.17.0",
4
4
  "description": "BrowserStack Cypress CLI for Cypress integration with BrowserStack's remote devices.",
5
5
  "main": "index.js",
6
6
  "scripts": {