mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
feat(screencast): autoscale to fit requested size (#3730)
This commit is contained in:
parent
9d999ae1f0
commit
1e64efcad1
@ -8,12 +8,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "firefox",
|
"name": "firefox",
|
||||||
"revision": "1167",
|
"revision": "1169",
|
||||||
"download": true
|
"download": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "webkit",
|
"name": "webkit",
|
||||||
"revision": "1334",
|
"revision": "1337",
|
||||||
"download": true
|
"download": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -358,7 +358,6 @@ export class FFPage implements PageDelegate {
|
|||||||
file: options.outputFile,
|
file: options.outputFile,
|
||||||
width: options.width,
|
width: options.width,
|
||||||
height: options.height,
|
height: options.height,
|
||||||
scale: options.scale,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,6 @@ export type ScreenshotOptions = ElementScreenshotOptions & {
|
|||||||
export type ScreencastOptions = {
|
export type ScreencastOptions = {
|
||||||
width: number,
|
width: number,
|
||||||
height: number,
|
height: number,
|
||||||
scale?: number,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PageScreencastOptions = ScreencastOptions & {
|
export type PageScreencastOptions = ScreencastOptions & {
|
||||||
|
@ -721,7 +721,6 @@ export class WKPage implements PageDelegate {
|
|||||||
file: options.outputFile,
|
file: options.outputFile,
|
||||||
width: options.width,
|
width: options.width,
|
||||||
height: options.height,
|
height: options.height,
|
||||||
scale: options.scale,
|
|
||||||
}) as any;
|
}) as any;
|
||||||
this._browserContext._browser._screencastStarted(screencastId, options.outputFile, this._page);
|
this._browserContext._browser._screencastStarted(screencastId, options.outputFile, this._page);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -231,18 +231,10 @@ describe('screencast', suite => {
|
|||||||
test.flaky(options.WEBKIT && LINUX);
|
test.flaky(options.WEBKIT && LINUX);
|
||||||
}, async ({page, tmpDir, server, videoPlayer, toImpl}) => {
|
}, async ({page, tmpDir, server, videoPlayer, toImpl}) => {
|
||||||
const videoFile = path.join(tmpDir, 'v.webm');
|
const videoFile = path.join(tmpDir, 'v.webm');
|
||||||
// Chromium automatically fits all frames to fit specified size. To avoid
|
// Set viewport equal to screencast frame size to avoid scaling.
|
||||||
// unwanted transformations we set view port size equal to the screencast
|
await page.setViewportSize({width: 640, height: 480});
|
||||||
// size.
|
|
||||||
// TODO: support explicit 'scale' parameter in CDP.
|
|
||||||
if (options.CHROMIUM)
|
|
||||||
await page.setViewportSize({width: 640, height: 480});
|
|
||||||
await page.goto(server.PREFIX + '/rotate-z.html');
|
await page.goto(server.PREFIX + '/rotate-z.html');
|
||||||
await toImpl(page)._delegate.startScreencast({outputFile: videoFile, width: 640, height: 480});
|
await toImpl(page)._delegate.startScreencast({outputFile: videoFile, width: 640, height: 480});
|
||||||
// TODO: in WebKit figure out why video size is not reported correctly for
|
|
||||||
// static pictures.
|
|
||||||
if (options.HEADLESS && options.WEBKIT)
|
|
||||||
await page.setViewportSize({width: 1270, height: 950});
|
|
||||||
// 300 is not enough for Chromium headful.
|
// 300 is not enough for Chromium headful.
|
||||||
await new Promise(r => setTimeout(r, 500));
|
await new Promise(r => setTimeout(r, 500));
|
||||||
await toImpl(page)._delegate.stopScreencast();
|
await toImpl(page)._delegate.stopScreencast();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user