From fdadd0897edc3a62ffa0542eb2c3d35be20f0727 Mon Sep 17 00:00:00 2001 From: Prudhvi Date: Wed, 4 Jan 2023 15:25:53 +0530 Subject: [PATCH] Added a check for 0 ms in pause command (#3534) --- lib/api/client-commands/pause.js | 2 +- test/src/api/commands/client/testPause.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/api/client-commands/pause.js b/lib/api/client-commands/pause.js index 08c112f603..6accd2dadc 100644 --- a/lib/api/client-commands/pause.js +++ b/lib/api/client-commands/pause.js @@ -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 or F10 to step over to the next test command and pause again. diff --git a/test/src/api/commands/client/testPause.js b/test/src/api/commands/client/testPause.js index f9620a28f5..b543b158b5 100644 --- a/test/src/api/commands/client/testPause.js +++ b/test/src/api/commands/client/testPause.js @@ -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() {