Skip to content

Commit 718a432

Browse files
committed
adding rspecs and improved messages
1 parent 96e21b6 commit 718a432

File tree

4 files changed

+36
-4
lines changed

4 files changed

+36
-4
lines changed

bin/helpers/capabilityHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ const validate = (bsConfig, args) => {
227227
logger.info(Constants.userMessages.SPEC_LIMIT_SUCCESS_MESSAGE.replace("<x>", bsConfig.run_settings.spec_timeout));
228228
}
229229
} else {
230-
logger.warn(Constants.userMessages.SPEC_LIMIT_WARNING)
230+
logger.warn(Constants.userMessages.SPEC_TIMEOUT_LIMIT_WARNING)
231231
}
232232
} else {
233233
logger.warn(Constants.validationMessages.SPEC_TIMEOUT_NOT_PASSED_ERROR);

bin/helpers/constants.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const userMessages = {
6363
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",
6464
PROCESS_KILL_MESSAGE: "Stopping the CLI and the execution of the build on BrowserStack",
6565
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"),
66-
SPEC_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 ",
66+
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",
6767
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"
6868
};
6969

@@ -144,7 +144,7 @@ const cliMessages = {
144144
REPORTER: "Specify the custom reporter to use",
145145
REPORTER_OPTIONS: "Specify reporter options for custom reporter",
146146
CYPRESS_GEO_LOCATION: "Enterprise feature to simulate website and mobile behavior from different locations.",
147-
SPEC_TIMEOUT: "Specify the value for assigning timeout to each spec"
147+
SPEC_TIMEOUT: "Specify the value for assigning timeout to each spec in the 1-120 mins range."
148148
},
149149
COMMON: {
150150
DISABLE_USAGE_REPORTING: "Disable usage reporting",

bin/helpers/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ exports.isPositiveInteger = (str) => {
413413

414414
const num = Number(str);
415415

416-
if (Number.isInteger(num) && num > 0) {
416+
if (this.isInteger(num) && num > 0) {
417417
return true;
418418
}
419419

test/unit/bin/helpers/utils.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3027,4 +3027,36 @@ describe('utils', () => {
30273027
expect(bsConfig.run_settings.spec_timeout).to.eq(null);
30283028
});
30293029
});
3030+
3031+
describe('#isInteger', () => {
3032+
it('returns true if positive integer', () => {
3033+
expect(utils.isInteger(123)).to.eq(true);
3034+
});
3035+
3036+
it('returns true if negative integer', () => {
3037+
expect(utils.isInteger(-123)).to.eq(true);
3038+
});
3039+
3040+
it('returns false if string', () => {
3041+
expect(utils.isInteger("123")).to.eq(false);
3042+
});
3043+
});
3044+
3045+
describe('#isPositiveInteger', () => {
3046+
it('returns true if string positive integer', () => {
3047+
expect(utils.isPositiveInteger("123")).to.eq(true);
3048+
});
3049+
3050+
it('returns false if string negative integer', () => {
3051+
expect(utils.isPositiveInteger("-123")).to.eq(false);
3052+
});
3053+
3054+
it('returns false if complex string without integer', () => {
3055+
expect(utils.isPositiveInteger("abc qskbd wie")).to.eq(false);
3056+
});
3057+
3058+
it('returns false if complex string with integer', () => {
3059+
expect(utils.isPositiveInteger("123 2138 a1bc qs3kbd wie")).to.eq(false);
3060+
});
3061+
});
30303062
});

0 commit comments

Comments
 (0)