fix screenshots (#18052)

This commit is contained in:
Lucy Zhang
2022-01-11 18:10:29 -08:00
committed by GitHub
parent 292e60a767
commit 4f18180672
2 changed files with 6 additions and 14 deletions

View File

@@ -43,13 +43,17 @@ export function beforeSuite(opts: minimist.ParsedArgs, optionsTransform?: (opts:
}
export function afterSuite(opts: minimist.ParsedArgs) {
after(async function () {
afterEach(async function () {
const app = this.app as Application;
if (this.currentTest?.state === 'failed' && opts.screenshots) {
const name = this.currentTest!.fullTitle().replace(/[^a-z0-9\-]/ig, '_');
await app.captureScreenshot(name);
}
});
after(async function () {
const app = this.app as Application;
if (app) {
await app.stop();