1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 02:10:12 +01:00

Improve error handling in assertElementNotPresent of test/e2e/beta/helpers.js

This commit is contained in:
Dan Miller 2018-08-13 23:37:02 -02:30
parent e2be22a4b7
commit c00d0daeb5

View File

@ -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')
}
}