Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a check for 0 ms in pause command #3534

Merged
merged 3 commits into from Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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