From db3acf12f2c1a544911991c0bb2f98a4fed65cd7 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Tue, 10 Dec 2024 17:13:09 -0800 Subject: [PATCH] add tests --- .../src/server/chromium/crPage.ts | 1 - ...playwright-cli-install-should-work.spec.ts | 24 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/packages/playwright-core/src/server/chromium/crPage.ts b/packages/playwright-core/src/server/chromium/crPage.ts index 11c609c8c2..1048d23dba 100644 --- a/packages/playwright-core/src/server/chromium/crPage.ts +++ b/packages/playwright-core/src/server/chromium/crPage.ts @@ -432,7 +432,6 @@ class FrameSession { this._firstNonInitialNavigationCommittedFulfill = f; this._firstNonInitialNavigationCommittedReject = r; }); - // We do not always await this promise. this._firstNonInitialNavigationCommittedPromise.catch(() => {}); } diff --git a/tests/installation/playwright-cli-install-should-work.spec.ts b/tests/installation/playwright-cli-install-should-work.spec.ts index 1c0cea6277..fddeb9e0f4 100755 --- a/tests/installation/playwright-cli-install-should-work.spec.ts +++ b/tests/installation/playwright-cli-install-should-work.spec.ts @@ -95,3 +95,27 @@ test('install playwright-chromium should work', async ({ exec, installedSoftware await exec('npx playwright install chromium'); await exec('node sanity.js playwright-chromium chromium'); }); + +test('should print error if recording video without ffmpeg', async ({ exec }) => { + await exec('npm i playwright'); + + await test.step('BrowserType.launch', async () => { + const result = await exec('node', '-e', `" + import playwright from 'playwright'; + const browser = await playwright.chromium.launch({ channel: 'chrome' }); + const context = await browser.newContext({ recordVideo: { dir: 'videos' } }); + const page = await context.newPage(); + "`, { expectToExitWithError: true }); + expect(result).toContain(`browserContext.newPage: Executable doesn't exist at`); + }); + + await test.step('BrowserType.launchPersistentContext', async () => { + const result = await exec('node', '-e', `" + import playwright from 'playwright'; + process.on('unhandledRejection', (e) => console.error('unhandledRejection', e)); + const context = await playwright.chromium.launchPersistentContext('', { channel: 'chrome', recordVideo: { dir: 'videos' } }); + "`, { expectToExitWithError: true }); + expect(result).not.toContain('unhandledRejection'); + expect(result).toContain(`browserType.launchPersistentContext: Executable doesn't exist at`); + }); +});