Fix E2E tests. Add Playwright (#698)

This commit is contained in:
Steve Faulkner
2021-04-19 22:08:25 -05:00
committed by GitHub
parent 914e969083
commit 2fd6305944
25 changed files with 3818 additions and 1494 deletions

26
test/playwrightEnv.js Normal file
View File

@@ -0,0 +1,26 @@
const PlaywrightEnvironment = require("jest-playwright-preset/lib/PlaywrightEnvironment").default;
class CustomEnvironment extends PlaywrightEnvironment {
async setup() {
await super.setup();
// Your setup
}
async teardown() {
// Your teardown
await super.teardown();
}
async handleTestEvent(event) {
if (event.name === "test_done" && event.test.errors.length > 0) {
const parentName = event.test.parent.name.replace(/\W/g, "-");
const specName = event.test.name.replace(/\W/g, "-");
await this.global.page.screenshot({
path: `screenshots/${parentName}_${specName}.png`,
});
}
}
}
module.exports = CustomEnvironment;