From 390fcffc369f8ee3fbc1aa3af45fef039c2f5ba8 Mon Sep 17 00:00:00 2001 From: Evgeny Lukoyanov Date: Tue, 5 Feb 2019 19:19:42 +0300 Subject: [PATCH] add possibility to define conditional checks interval for waituntil in webdriverio --- lib/helper/WebDriver.js | 7 ++++--- lib/helper/WebDriverIO.js | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/helper/WebDriver.js b/lib/helper/WebDriver.js index a4809f90d..64cabb5ba 100644 --- a/lib/helper/WebDriver.js +++ b/lib/helper/WebDriver.js @@ -1742,12 +1742,13 @@ class WebDriver extends Helper { /** * {{> ../webapi/waitUntil }} * - * + * @param interval (optional) time in seconds between condition checks. * * *Appium*: supported */ - async waitUntil(fn, sec = null, timeoutMsg = null) { + async waitUntil(fn, sec = null, timeoutMsg = null, interval = null) { const aSec = sec || this.options.waitForTimeout; - return this.browser.waitUntil(fn, aSec * 1000, timeoutMsg); + const _interval = typeof interval === 'number' ? interval * 1000 : null; + return this.browser.waitUntil(fn, aSec * 1000, timeoutMsg, _interval); } /** diff --git a/lib/helper/WebDriverIO.js b/lib/helper/WebDriverIO.js index 997d788ef..1d10b45f3 100644 --- a/lib/helper/WebDriverIO.js +++ b/lib/helper/WebDriverIO.js @@ -1661,11 +1661,13 @@ class WebDriverIO extends Helper { /** * {{> ../webapi/waitUntil }} - * Appium: support + * @param interval (optional) time in seconds between condition checks. + * * *Appium*: supported */ - async waitUntil(fn, sec = null, timeoutMsg = null) { + async waitUntil(fn, sec = null, timeoutMsg = null, interval = null) { const aSec = sec || this.options.waitForTimeout; - return this.browser.waitUntil(fn, aSec * 1000, timeoutMsg); + const _interval = typeof interval === 'number' ? interval * 1000 : null; + return this.browser.waitUntil(fn, aSec * 1000, timeoutMsg, _interval); } /**