Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
browser(firefox): support relative paths for firefox videos (#27099)
Andrey Lushnikova34030be804a
diff --git a/packages/playwright-core/src/client/browserContext.ts b/packages/playwright-core/src/client/browserContext.tsindex 94f2a809b6..2f1c587f79 100644--- a/packages/playwright-core/src/client/browserContext.ts+++ b/packages/playwright-core/src/client/browserContext.ts@@ -20,6 +20,7 @@ import { Frame } from './frame';import * as network from './network';import type * as channels from '@protocol/channels';import fs from 'fs';+import path from 'path';import { ChannelOwner } from './channelOwner';import { evaluationScript } from './clientHelper';import { Browser } from './browser';@@ -469,6 +470,8 @@ export async function prepareBrowserContextParams(options: BrowserContextOptionssize: options.videoSize};}+ if (contextParams.recordVideo && contextParams.recordVideo.dir)+ contextParams.recordVideo.dir = path.resolve(process.cwd(), contextParams.recordVideo.dir);return contextParams;}diff --git a/tests/library/video.spec.ts b/tests/library/video.spec.tsindex e2857907bf..55b97f2f80 100644--- a/tests/library/video.spec.ts+++ b/tests/library/video.spec.ts@@ -310,6 +310,23 @@ it.describe('screencast', () => {expect(fs.existsSync(path)).toBeTruthy();});+ it('should work with relative path for recordVideo.dir', async ({ browser }, testInfo) => {+ it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/27086' });+ const videosPath = path.relative(process.cwd(), testInfo.outputPath(''));+ const size = { width: 320, height: 240 };+ const context = await browser.newContext({+ recordVideo: {+ dir: videosPath,+ size+ },+ viewport: size,+ });+ const page = await context.newPage();+ const videoPath = await page.video()!.path();+ await context.close();+ expect(fs.existsSync(videoPath)).toBeTruthy();+ });+it('should expose video path blank popup', async ({ browser }, testInfo) => {const videosPath = testInfo.outputPath('');const size = { width: 320, height: 240 };