From 562b4f7a46224d7172cfd1991601f7d268c05811 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 19 Feb 2026 16:04:42 +0000 Subject: [PATCH] Update stale screenshots playwright reporter At some point it seems that playwright changed how reporters are passed flakes. https://github.com/microsoft/playwright/pull/39145 needs to land to fully fix the reporter though --- .../src/stale-screenshot-reporter.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 a6ac4f59..39c9a53f 100644 --- a/packages/element-web-playwright-common/src/stale-screenshot-reporter.ts +++ b/packages/element-web-playwright-common/src/stale-screenshot-reporter.ts @@ -25,7 +25,7 @@ export const ANNOTATION = "_screenshot"; class StaleScreenshotReporter implements Reporter { private readonly snapshotRoots = new Set(); private readonly screenshots = new Set(); - private failing = false; + private readonly failing = new Set(); private success = true; public onBegin(config: FullConfig): void { @@ -36,8 +36,11 @@ class StaleScreenshotReporter implements Reporter { public onTestEnd(test: TestCase): void { if (!test.ok()) { - this.failing = true; + this.failing.add(test.id); + return; } + this.failing.delete(test.id); // delete if passed on re-run + for (const annotation of test.annotations) { if (annotation.type === ANNOTATION && annotation.description) { this.screenshots.add(annotation.description); @@ -54,7 +57,10 @@ class StaleScreenshotReporter implements Reporter { } public async onExit(): Promise { - if (this.failing) return; + if (this.failing.size) { + console.error(`${this.failing.size} tests failed, skipping stale screenshot reporter.`); + } + if (!this.snapshotRoots.size) { this.error("No snapshot directories found, did you set the snapshotDir in your Playwright config?", ""); return;