fix(tests): do not throw if page did not produce video (#8112)

Fixes #8103
This commit is contained in:
Yury Semikhatsky 2021-08-10 01:24:14 -07:00 committed by GitHub
parent 3bf3318350
commit 75981bc0aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -151,7 +151,9 @@ export const playwrightFixtures: Fixtures<PlaywrightTestOptions & PlaywrightTest
const videos = context.pages().map(p => p.video()).filter(Boolean);
await context.close();
for (const v of videos) {
const videoPath = await v.path();
const videoPath = await v.path().catch(() => null);
if (!videoPath)
continue;
const savedPath = testInfo.outputPath(path.basename(videoPath));
await v.saveAs(savedPath);
testInfo.attachments.push({ name: 'video', path: savedPath, contentType: 'video/webm' });