mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-26 23:46:47 +00:00
27 lines
690 B
JavaScript
27 lines
690 B
JavaScript
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;
|