diff --git a/packages/element-web-playwright-common/src/stale-screenshot-reporter.ts b/packages/element-web-playwright-common/src/stale-screenshot-reporter.ts index 39c9a53fa5..2d7b1ec095 100644 --- a/packages/element-web-playwright-common/src/stale-screenshot-reporter.ts +++ b/packages/element-web-playwright-common/src/stale-screenshot-reporter.ts @@ -56,11 +56,7 @@ class StaleScreenshotReporter implements Reporter { this.success = false; } - public async onExit(): Promise { - if (this.failing.size) { - console.error(`${this.failing.size} tests failed, skipping stale screenshot reporter.`); - } - + private async checkStaleScreenshots(): Promise { if (!this.snapshotRoots.size) { this.error("No snapshot directories found, did you set the snapshotDir in your Playwright config?", ""); return; @@ -90,6 +86,14 @@ class StaleScreenshotReporter implements Reporter { this.error("Stale screenshot file", screenshot); } } + } + + public async onExit(): Promise { + if (this.failing.size) { + this.error(`${this.failing.size} tests failed, skipping stale screenshot reporter.`, ""); + } else { + await this.checkStaleScreenshots(); + } if (!this.success) { process.exit(1);