From 3c47e0e0406796e716e52518b19b05bc9588dc03 Mon Sep 17 00:00:00 2001 From: BryceLTaylor <brycet@media.mit.edu> Date: Wed, 29 May 2019 14:21:27 -0400 Subject: [PATCH] Make Find by Xpath ensure element is visible in integration tests --- test/helpers/selenium-helper.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/helpers/selenium-helper.js b/test/helpers/selenium-helper.js index ddafe8704..7063fc555 100644 --- a/test/helpers/selenium-helper.js +++ b/test/helpers/selenium-helper.js @@ -85,7 +85,11 @@ class SeleniumHelper { } findByXpath (xpath, timeoutMessage = `findByXpath timed out for path: ${xpath}`) { - return this.driver.wait(until.elementLocated(By.xpath(xpath)), DEFAULT_TIMEOUT_MILLISECONDS, timeoutMessage); + return this.driver.wait(until.elementLocated(By.xpath(xpath)), DEFAULT_TIMEOUT_MILLISECONDS, timeoutMessage) + .then(el => ( + this.driver.wait(el.isDisplayed(), DEFAULT_TIMEOUT_MILLISECONDS, `${xpath} is not visible`) + .then(() => el) + )); } findByText (text, scope) { -- GitLab