diff --git a/bin/commands/runs.js b/bin/commands/runs.js index 6d7a0a04..d6531d08 100644 --- a/bin/commands/runs.js +++ b/bin/commands/runs.js @@ -68,10 +68,16 @@ module.exports = function run(args) { logger.warn(Constants.userMessages.NO_PARALLELS); } + if (bsConfig.cypress_version && bsConfig.cypress_version !== data.cypress_version) { + let versionMessage = utils.versionChangedMessage(bsConfig.cypress_version, data.cypress_version) + logger.warn(versionMessage); + } + if (!args.disableNpmWarning && bsConfig.run_settings.npm_dependencies && Object.keys(bsConfig.run_settings.npm_dependencies).length <= 0) { logger.warn(Constants.userMessages.NO_NPM_DEPENDENCIES); logger.warn(Constants.userMessages.NO_NPM_DEPENDENCIES_READ_MORE); } + if (args.sync) { syncRunner.pollBuildStatus(bsConfig, data).then((exitCode) => { // Generate custom report! diff --git a/bin/helpers/capabilityHelper.js b/bin/helpers/capabilityHelper.js index 442b88ba..497a1223 100644 --- a/bin/helpers/capabilityHelper.js +++ b/bin/helpers/capabilityHelper.js @@ -83,6 +83,8 @@ const caps = (bsConfig, zip) => { } } + if (bsConfig.cypress_version) obj.cypress_version = bsConfig.cypress_version; + if(obj.parallels === Constants.cliMessages.RUN.DEFAULT_PARALLEL_MESSAGE) obj.parallels = undefined if (obj.project) logger.log(`Project name is: ${obj.project}`); diff --git a/bin/helpers/constants.js b/bin/helpers/constants.js index e26bac6f..bf8b33a2 100644 --- a/bin/helpers/constants.js +++ b/bin/helpers/constants.js @@ -36,7 +36,8 @@ const userMessages = { 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 command now.", FATAL_NETWORK_ERROR: `fatal: unable to access '${config.buildUrl}': Could not resolve host: ${config.rails_host}`, RETRY_LIMIT_EXCEEDED: `Max retries exceeded trying to connect to the host (retries: ${config.retries})`, - CHECK_DASHBOARD_AT: "Please check the build status at: " + CHECK_DASHBOARD_AT: "Please check the build status at: ", + CYPRESS_VERSION_CHANGED: "Your build will run using Cypress instead of Cypress . Read more about supported versions here: http://browserstack.com/docs/automate/cypress/supported-versions" }; const validationMessages = { diff --git a/bin/helpers/utils.js b/bin/helpers/utils.js index 5d834a22..094ad4d9 100644 --- a/bin/helpers/utils.js +++ b/bin/helpers/utils.js @@ -374,3 +374,9 @@ exports.getNetworkErrorMessage = (dashboard_url) => { + Constants.userMessages.CHECK_DASHBOARD_AT + dashboard_url return chalk.red(message) } + +exports.versionChangedMessage = (preferredVersion, actualVersion) => { + let message = Constants.userMessages.CYPRESS_VERSION_CHANGED.replace("", preferredVersion); + message = message.replace("", actualVersion); + return message +} diff --git a/test/unit/bin/helpers/capabilityHelper.js b/test/unit/bin/helpers/capabilityHelper.js index 9e379f64..5de63406 100644 --- a/test/unit/bin/helpers/capabilityHelper.js +++ b/test/unit/bin/helpers/capabilityHelper.js @@ -44,6 +44,36 @@ describe("capabilityHelper.js", () => { }); }); + it("handle cypress version passed", () => { + let zip_url = "bs://"; + let cypress_version = "version" + let bsConfig = { + auth: { + username: "random", + access_key: "random", + }, + browsers: [ + { + browser: "chrome", + os: "Windows 10", + versions: ["78", "77"], + }, + ], + cypress_version: cypress_version, + connection_settings: { + local: true + } + }; + return capabilityHelper + .caps(bsConfig, { zip_url: zip_url }) + .then(function (data) { + chai.assert.equal(JSON.parse(data).cypress_version, cypress_version); + }) + .catch((error) => { + chai.assert.fail("Promise error"); + }); + }); + it("handle empty test_suite", () => { let zip_url = undefined; let incorrectBsConfig = { diff --git a/test/unit/bin/helpers/utils.js b/test/unit/bin/helpers/utils.js index 2b262a33..a28f9fba 100644 --- a/test/unit/bin/helpers/utils.js +++ b/test/unit/bin/helpers/utils.js @@ -1135,8 +1135,15 @@ describe('utils', () => { let message = constant.userMessages.FATAL_NETWORK_ERROR + '\n' + constant.userMessages.RETRY_LIMIT_EXCEEDED + '\n' + constant.userMessages.CHECK_DASHBOARD_AT + dashboard_url - utils.getNetworkErrorMessage(dashboard_url); expect(utils.getNetworkErrorMessage(dashboard_url)).to.eq(chalk.red(message)) }); }); + + describe('#versionChangedMessage', () => { + it('should return proper error message with placeholders replaced', () => { + let preferredVersion = "v1", actualVersion = "v2"; + let message = constant.userMessages.CYPRESS_VERSION_CHANGED.replace("", preferredVersion).replace("", actualVersion); + expect(utils.versionChangedMessage(preferredVersion, actualVersion)).to.eq(message) + }); + }) });