From c00d0daeb528598e0f49484718fb7e91c40a1127 Mon Sep 17 00:00:00 2001 From: Dan Miller Date: Mon, 13 Aug 2018 23:37:02 -0230 Subject: [PATCH] Improve error handling in assertElementNotPresent of test/e2e/beta/helpers.js --- test/e2e/beta/helpers.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/e2e/beta/helpers.js b/test/e2e/beta/helpers.js index 828f87db7..d90cd5d66 100644 --- a/test/e2e/beta/helpers.js +++ b/test/e2e/beta/helpers.js @@ -122,12 +122,14 @@ async function closeAllWindowHandlesExcept (driver, exceptions, windowHandles) { } async function assertElementNotPresent (webdriver, driver, by) { + let dataTab try { - const dataTab = await findElement(driver, by, 4000) - if (dataTab) { - assert(false, 'Data tab should not be present') - } + dataTab = await findElement(driver, by, 4000) } catch (err) { - assert(err instanceof webdriver.error.NoSuchElementError) + console.log(err) + assert(err instanceof webdriver.error.NoSuchElementError || err instanceof webdriver.error.TimeoutError) + } + if (dataTab) { + assert(false, 'Data tab should not be present') } }