diff options
author | Ajay <[email protected]> | 2022-06-18 11:54:52 -0400 |
---|---|---|
committer | Ajay <[email protected]> | 2022-06-18 11:54:52 -0400 |
commit | 986630d0a1a481cfff3d4f0733432bf40b000137 (patch) | |
tree | fddbcc901515735f1f1dc462538a58c727e5a568 /test | |
parent | ae23bfffe1f6a2e0de9a8e08e72d9e0399f283ff (diff) | |
download | SponsorBlock-986630d0a1a481cfff3d4f0733432bf40b000137.tar.gz SponsorBlock-986630d0a1a481cfff3d4f0733432bf40b000137.zip |
Save file on test failure
Fixes #1366
Diffstat (limited to 'test')
-rw-r--r-- | test/selenium.test.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/selenium.test.ts b/test/selenium.test.ts index 6d522f03..600408a9 100644 --- a/test/selenium.test.ts +++ b/test/selenium.test.ts @@ -2,6 +2,8 @@ import { Builder, By, until, WebDriver, WebElement } from "selenium-webdriver"; import * as Chrome from "selenium-webdriver/chrome"; import * as Path from "path"; +import * as fs from "fs"; + test("Selenium Chrome test", async () => { let driver: WebDriver; try { @@ -35,6 +37,14 @@ test("Selenium Chrome test", async () => { await toggleWhitelist(driver); await toggleWhitelist(driver); + } catch (e) { + // Save file incase there is a layout change + const source = await driver.getPageSource(); + + fs.mkdirSync("./test-results"); + fs.writeFileSync("./test-results/source.html", source); + + throw e; } finally { await driver.quit(); } |