|
|
|
@ -51,6 +51,8 @@ async function withFixtures(options, testSuite) { |
|
|
|
|
const phishingPageServer = new PhishingWarningPageServer(); |
|
|
|
|
|
|
|
|
|
let webDriver; |
|
|
|
|
let driver; |
|
|
|
|
const errors = []; |
|
|
|
|
let failed = false; |
|
|
|
|
try { |
|
|
|
|
await ganacheServer.start(ganacheOptions); |
|
|
|
@ -110,8 +112,12 @@ async function withFixtures(options, testSuite) { |
|
|
|
|
) { |
|
|
|
|
await ensureXServerIsRunning(); |
|
|
|
|
} |
|
|
|
|
const { driver } = await buildWebDriver(driverOptions); |
|
|
|
|
webDriver = driver; |
|
|
|
|
driver = (await buildWebDriver(driverOptions)).driver; |
|
|
|
|
webDriver = driver.driver; |
|
|
|
|
|
|
|
|
|
if (process.env.SELENIUM_BROWSER === 'chrome') { |
|
|
|
|
await driver.checkBrowserForExceptions(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
await testSuite({ |
|
|
|
|
driver, |
|
|
|
@ -120,7 +126,7 @@ async function withFixtures(options, testSuite) { |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
if (process.env.SELENIUM_BROWSER === 'chrome') { |
|
|
|
|
const errors = await driver.checkBrowserForConsoleErrors(driver); |
|
|
|
|
errors.concat(await driver.checkBrowserForConsoleErrors(driver)); |
|
|
|
|
if (errors.length) { |
|
|
|
|
const errorReports = errors.map((err) => err.message); |
|
|
|
|
const errorMessage = `Errors found in browser console:\n${errorReports.join( |
|
|
|
@ -137,10 +143,20 @@ async function withFixtures(options, testSuite) { |
|
|
|
|
failed = true; |
|
|
|
|
if (webDriver) { |
|
|
|
|
try { |
|
|
|
|
await webDriver.verboseReportOnFailure(title); |
|
|
|
|
await driver.verboseReportOnFailure(title); |
|
|
|
|
} catch (verboseReportError) { |
|
|
|
|
console.error(verboseReportError); |
|
|
|
|
} |
|
|
|
|
if ( |
|
|
|
|
errors.length === 0 && |
|
|
|
|
driver.exceptions.length > 0 && |
|
|
|
|
failOnConsoleError |
|
|
|
|
) { |
|
|
|
|
const errorMessage = `Errors found in browser console:\n${driver.exceptions.join( |
|
|
|
|
'\n', |
|
|
|
|
)}`;
|
|
|
|
|
throw Error(errorMessage); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
throw error; |
|
|
|
|
} finally { |
|
|
|
@ -151,7 +167,7 @@ async function withFixtures(options, testSuite) { |
|
|
|
|
await secondaryGanacheServer.quit(); |
|
|
|
|
} |
|
|
|
|
if (webDriver) { |
|
|
|
|
await webDriver.quit(); |
|
|
|
|
await driver.quit(); |
|
|
|
|
} |
|
|
|
|
if (dapp) { |
|
|
|
|
for (let i = 0; i < numberOfDapps; i++) { |
|
|
|
|