Skip to content

Commit

Permalink
Added a check for 0 ms in pause command (#3534)
Browse files Browse the repository at this point in the history
  • Loading branch information
prudhvi22 committed Jan 4, 2023
1 parent cebd7a3 commit fdadd08
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/api/client-commands/pause.js
Expand Up @@ -42,7 +42,7 @@ Pause.prototype.command = function(ms, cb) {
// If we don't pass the milliseconds, the client will
// be suspended indefinitely, until the user presses some
// key in the terminal to resume it.
if (!ms) {
if (ms === undefined) {
// eslint-disable-next-line
console.log(`Paused...
Press <space> or F10 to step over to the next test command and pause again.
Expand Down
10 changes: 10 additions & 0 deletions test/src/api/commands/client/testPause.js
Expand Up @@ -20,6 +20,16 @@ describe('.pause()', function() {
this.client.start(done);
});

it('browser.pause(0) does not pause more than 2000ms', function(done) {
const startTime = new Date();
this.client.api.pause(0, function() {
const timeElapsed = new Date() - startTime;
assert.ok(timeElapsed >= 0);
});

this.client.start(done);
});

it('browser.pause(200) pauses for atleast 200ms and not more than 2000ms', function(done) {
const startTime = new Date();
this.client.api.pause(200, function() {
Expand Down

0 comments on commit fdadd08

Please sign in to comment.