diff --git a/packages/playwright/src/index.ts b/packages/playwright/src/index.ts index add1661502..bc8cea9764 100644 --- a/packages/playwright/src/index.ts +++ b/packages/playwright/src/index.ts @@ -627,9 +627,10 @@ class ArtifactsRecorder { private _createScreenshotAttachmentPath() { const testFailed = this._testInfo._isFailure(); + const sanitizedTestName = this._testInfo._fsSanitizedTestName(); const index = this._screenshotOrdinal + 1; ++this._screenshotOrdinal; - const screenshotPath = this._testInfo.outputPath(`test-${testFailed ? 'failed' : 'finished'}-${index}.png`); + const screenshotPath = this._testInfo.outputPath(`test-${testFailed ? 'failed' : 'finished'}-${sanitizedTestName}-${index}.png`); return screenshotPath; }