From 796339dcfe7b2bd5626acfe2b4701eb8dd624c0e Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford <cwillisf@media.mit.edu> Date: Fri, 24 May 2019 09:35:44 -0700 Subject: [PATCH] simplify SeleniumHelper timeout options --- test/helpers/selenium-helper.js | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/test/helpers/selenium-helper.js b/test/helpers/selenium-helper.js index 4b0d54408..ddafe8704 100644 --- a/test/helpers/selenium-helper.js +++ b/test/helpers/selenium-helper.js @@ -31,11 +31,8 @@ class SeleniumHelper { ]); } - elementIsVisible (element, { - message = 'elementIsVisible timed out', - timeout = DEFAULT_TIMEOUT_MILLISECONDS - } = {}) { - return this.driver.wait(until.elementIsVisible(element), timeout, message); + elementIsVisible (element, timeoutMessage = 'elementIsVisible timed out') { + return this.driver.wait(until.elementIsVisible(element), DEFAULT_TIMEOUT_MILLISECONDS, timeoutMessage); } get scope () { @@ -87,11 +84,8 @@ class SeleniumHelper { return this.driver; } - findByXpath (xpath, { - message = `findByXpath timed out for path: ${xpath}`, - timeout = DEFAULT_TIMEOUT_MILLISECONDS - } = {}) { - return this.driver.wait(until.elementLocated(By.xpath(xpath)), timeout, message); + findByXpath (xpath, timeoutMessage = `findByXpath timed out for path: ${xpath}`) { + return this.driver.wait(until.elementLocated(By.xpath(xpath)), DEFAULT_TIMEOUT_MILLISECONDS, timeoutMessage); } findByText (text, scope) { @@ -131,11 +125,8 @@ class SeleniumHelper { return this.clickXpath(`//button//*[contains(text(), '${text}')]`); } - waitUntilGone (element, { - message = 'waitUntilGone timed out', - timeout = DEFAULT_TIMEOUT_MILLISECONDS - } = {}) { - return this.driver.wait(until.stalenessOf(element), timeout, message); + waitUntilGone (element, timeoutMessage = 'waitUntilGone timed out') { + return this.driver.wait(until.stalenessOf(element), DEFAULT_TIMEOUT_MILLISECONDS, timeoutMessage); } getLogs (whitelist) { -- GitLab