browser(firefox): support relative paths for firefox videos (#27099)
Firefox protocol requires absolute paths for video recording. Fixes https://github.com/microsoft/playwright/issues/27086
This commit is contained in:
parent
c914d62c69
commit
a34030be80
|
|
@ -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: BrowserContextOptions
|
|||
size: options.videoSize
|
||||
};
|
||||
}
|
||||
if (contextParams.recordVideo && contextParams.recordVideo.dir)
|
||||
contextParams.recordVideo.dir = path.resolve(process.cwd(), contextParams.recordVideo.dir);
|
||||
return contextParams;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 };
|
||||
|
|
|
|||
Loading…
Reference in a new issue