make _attachScreenshot use attach()
This commit is contained in:
parent
4c345bb01e
commit
bc66311a05
|
|
@ -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);
|
||||||
this._attachScreenshot(screenshotPath);
|
await this._attachScreenshot(screenshotPath);
|
||||||
} catch {
|
} catch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -665,19 +665,14 @@ class ArtifactsRecorder {
|
||||||
if (temporary)
|
if (temporary)
|
||||||
this._temporaryScreenshots.push(screenshotPath);
|
this._temporaryScreenshots.push(screenshotPath);
|
||||||
else
|
else
|
||||||
this._attachScreenshot(screenshotPath);
|
await this._attachScreenshot(screenshotPath);
|
||||||
} catch {
|
} catch {
|
||||||
// Screenshot may fail, just ignore.
|
// Screenshot may fail, just ignore.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _attachScreenshot(screenshotPath: string) {
|
private async _attachScreenshot(screenshotPath: string) {
|
||||||
const step = this._testInfo._addStep({
|
await this._testInfo.attach('screenshot', { path: screenshotPath, contentType: 'image/png' });
|
||||||
title: `attach "screenshot"`,
|
|
||||||
category: 'attach',
|
|
||||||
});
|
|
||||||
step.attachments.push({ name: 'screenshot', path: screenshotPath, contentType: 'image/png' });
|
|
||||||
step.complete({});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _screenshotOnTestFailure() {
|
private async _screenshotOnTestFailure() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue