diff options
test - e2e - more factoring of test setup
Diffstat (limited to 'test/e2e/func.js')
-rw-r--r-- | test/e2e/func.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/e2e/func.js b/test/e2e/func.js index ca590d84a..ca8d05b18 100644 --- a/test/e2e/func.js +++ b/test/e2e/func.js @@ -12,6 +12,7 @@ const By = webdriver.By module.exports = { delay, createModifiedTestBuild, + verboseReportOnFailure, buildChromeWebDriver, buildFirefoxWebdriver, installWebExt, @@ -95,3 +96,13 @@ async function installWebExt (driver, extension) { return await driver.schedule(cmd, 'installWebExt(' + extension + ')') } + +async function verboseReportOnFailure ({ browser, driver, title }) { + const artifactDir = `./test-artifacts/${browser}/${title}` + const filepathBase = `${artifactDir}/test-failure` + await fs.ensureDir(artifactDir) + const screenshot = await driver.takeScreenshot() + await fs.writeFile(`${filepathBase}-screenshot.png`, screenshot, { encoding: 'base64' }) + const htmlSource = await driver.getPageSource() + await fs.writeFile(`${filepathBase}-dom.html`, htmlSource) +} |