This commit is contained in:
Michael Telatynski 2025-06-20 10:21:26 +01:00
parent a6f851bbdf
commit 78bc53ef0a
2 changed files with 3 additions and 3 deletions

View File

@ -70,8 +70,7 @@ export const expect = baseExpect.extend<Expectations>({
testInfo.annotations.push({
// `_` prefix hides it from the HTML reporter
type: "_screenshot",
// include a path relative to `playwright/snapshots/`
description: testInfo.snapshotPath(screenshotName).split("/playwright/snapshots/", 2)[1],
description: testInfo.snapshotPath(screenshotName),
});
return { pass: true, message: (): string => "", name: "toMatchScreenshot" };

View File

@ -12,6 +12,7 @@ Please see LICENSE files in the repository root for full details.
*/
import { glob } from "glob";
import path from "node:path";
import { type Reporter, type TestCase } from "@playwright/test/reporter";
import { type FullConfig } from "@playwright/test";
@ -58,7 +59,7 @@ class StaleScreenshotReporter implements Reporter {
for (const snapshotRoot of this.snapshotRoots) {
const files = await glob(`**/*.png`, { cwd: snapshotRoot });
for (const file of files) {
screenshotFiles.add(file);
screenshotFiles.add(path.join(snapshotRoot, file));
}
}