Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

browser(firefox): support relative paths for firefox videos #27099

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/playwright-core/src/client/browserContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -469,6 +470,8 @@ export async function prepareBrowserContextParams(options: BrowserContextOptions
size: options.videoSize
};
}
if (contextParams.recordVideo && contextParams.recordVideo.dir)
contextParams.recordVideo.dir = path.resolve(process.cwd(), contextParams.recordVideo.dir);
return contextParams;
}

Expand Down
17 changes: 17 additions & 0 deletions tests/library/video.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
Loading