mirror of
https://github.com/hanzoai/playwright.git
synced 2026-09-24 17:01:53 +00:00
fix(mcp): preserve directory for additional tab videos (#41680)
This commit is contained in:
@@ -236,8 +236,9 @@ export class Context {
|
||||
const suffix = this._video.fileNames.length ? `-${this._video.fileNames.length}` : '';
|
||||
let fileName = this._video.fileName;
|
||||
if (fileName && suffix) {
|
||||
const dir = path.dirname(fileName);
|
||||
const ext = path.extname(fileName);
|
||||
fileName = path.basename(fileName, ext) + suffix + ext;
|
||||
fileName = path.join(dir, path.basename(fileName, ext) + suffix + ext);
|
||||
}
|
||||
this._video.fileNames.push(fileName);
|
||||
await page.screencast.start({ path: fileName, ...this._video.params });
|
||||
|
||||
@@ -216,7 +216,7 @@ test('tracing-start-stop', async ({ cli, server }, testInfo) => {
|
||||
|
||||
test('video-start-stop', async ({ cli, server }) => {
|
||||
await cli('open', server.HELLO_WORLD);
|
||||
const { output: videoStartOutput } = await cli('video-start', 'video.webm', '--size=400x300');
|
||||
const { output: videoStartOutput } = await cli('video-start', 'recordings/video.webm', '--size=400x300');
|
||||
expect(videoStartOutput).toContain('Video recording started.');
|
||||
const { output: tabNewOutput } = await cli('tab-new');
|
||||
expect(tabNewOutput).toContain('1: (current) [](about:blank)');
|
||||
@@ -225,7 +225,7 @@ test('video-start-stop', async ({ cli, server }) => {
|
||||
const { output: tabCloseOutput } = await cli('tab-close');
|
||||
expect(tabCloseOutput).toContain(`0: (current) [](${server.EMPTY_PAGE})`);
|
||||
const { output: videoStopOutput } = await cli('video-stop');
|
||||
expect(videoStopOutput).toContain(`### Result\n- [Video](./video.webm)\n- [Video](./video-1.webm)`);
|
||||
expect(videoStopOutput).toContain(`### Result\n- [Video](recordings${path.sep}video.webm)\n- [Video](recordings${path.sep}video-1.webm)`);
|
||||
});
|
||||
|
||||
test('video-chapter', async ({ cli, server }) => {
|
||||
|
||||
Reference in New Issue
Block a user