mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
feat(report): add video to attachments (#7976)
This commit is contained in:
parent
3e05d8e9fa
commit
ea4f42b7ed
@ -251,8 +251,9 @@ export const test = _baseTest.extend<PlaywrightTestArgs & PlaywrightTestOptions,
|
||||
return;
|
||||
try {
|
||||
const videoPath = await v.path();
|
||||
const fileName = path.basename(videoPath);
|
||||
await v.saveAs(testInfo.outputPath(fileName));
|
||||
const savedPath = testInfo.outputPath(path.basename(videoPath));
|
||||
await v.saveAs(savedPath);
|
||||
testInfo.attachments.push({ name: 'video', path: savedPath, contentType: 'video/webm' });
|
||||
} catch (e) {
|
||||
// Silent catch empty videos.
|
||||
}
|
||||
|
@ -301,8 +301,16 @@ test('should work with video: on-first-retry', async ({ runInlineTest }, testInf
|
||||
const dirFail = testInfo.outputPath('test-results', 'a-fail-chromium');
|
||||
expect(fs.existsSync(dirFail)).toBeFalsy();
|
||||
|
||||
const videoFailRetry = fs.readdirSync(testInfo.outputPath('test-results', 'a-fail-chromium-retry1')).find(file => file.endsWith('webm'));
|
||||
const dirRetry = testInfo.outputPath('test-results', 'a-fail-chromium-retry1');
|
||||
const videoFailRetry = fs.readdirSync(dirRetry).find(file => file.endsWith('webm'));
|
||||
expect(videoFailRetry).toBeTruthy();
|
||||
|
||||
expect(result.report.suites[0].specs[1].tests[0].results[0].attachments).toEqual([]);
|
||||
expect(result.report.suites[0].specs[1].tests[0].results[1].attachments).toEqual([{
|
||||
name: 'video',
|
||||
contentType: 'video/webm',
|
||||
path: path.join(dirRetry, videoFailRetry),
|
||||
}]);
|
||||
});
|
||||
|
||||
test('should work with video size', async ({ runInlineTest }, testInfo) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user