Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

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

Yury Semikhatsky75981bc0aa27
diff --git a/tests/config/browserTest.ts b/tests/config/browserTest.ts
index a446712b95..b9eacd376c 100644
--- a/tests/config/browserTest.ts
+++ b/tests/config/browserTest.ts
@@ -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' });