don't copy screenshot file

This commit is contained in:
Simon Knott 2024-12-17 10:42:29 +01:00
parent b04880d7b8
commit 1b1da1c075
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -638,7 +638,7 @@ class ArtifactsRecorder {
try { try {
const screenshotPath = this._createScreenshotAttachmentPath(); const screenshotPath = this._createScreenshotAttachmentPath();
await fs.promises.rename(file, screenshotPath); await fs.promises.rename(file, screenshotPath);
await this._attachScreenshot(screenshotPath); this._attachScreenshot(screenshotPath);
} catch { } catch {
} }
} }
@ -665,14 +665,19 @@ class ArtifactsRecorder {
if (temporary) if (temporary)
this._temporaryScreenshots.push(screenshotPath); this._temporaryScreenshots.push(screenshotPath);
else else
await this._attachScreenshot(screenshotPath); this._attachScreenshot(screenshotPath);
} catch { } catch {
// Screenshot may fail, just ignore. // Screenshot may fail, just ignore.
} }
} }
private async _attachScreenshot(screenshotPath: string) { private _attachScreenshot(screenshotPath: string) {
await this._testInfo.attach('screenshot', { path: screenshotPath, contentType: 'image/png' }); const step = this._testInfo._addStep({
title: `attach "screenshot"`,
category: 'attach',
});
step.attachments.push({ name: 'screenshot', path: screenshotPath, contentType: 'image/png' });
step.complete({});
} }
private async _screenshotOnTestFailure() { private async _screenshotOnTestFailure() {