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

feat(screencast): autoscale to fit requested size #3730

Merged
merged 1 commit into from
Sep 2, 2020
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
4 changes: 2 additions & 2 deletions browsers.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
},
{
"name": "firefox",
"revision": "1167",
"revision": "1169",
"download": true
},
{
"name": "webkit",
"revision": "1334",
"revision": "1337",
"download": true
}
]
Expand Down
1 change: 0 additions & 1 deletion src/server/firefox/ffPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ export class FFPage implements PageDelegate {
file: options.outputFile,
width: options.width,
height: options.height,
scale: options.scale,
});
}

Expand Down
1 change: 0 additions & 1 deletion src/server/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export type ScreenshotOptions = ElementScreenshotOptions & {
export type ScreencastOptions = {
width: number,
height: number,
scale?: number,
};

export type PageScreencastOptions = ScreencastOptions & {
Expand Down
1 change: 0 additions & 1 deletion src/server/webkit/wkPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,6 @@ export class WKPage implements PageDelegate {
file: options.outputFile,
width: options.width,
height: options.height,
scale: options.scale,
}) as any;
this._browserContext._browser._screencastStarted(screencastId, options.outputFile, this._page);
} catch (e) {
Expand Down
12 changes: 2 additions & 10 deletions test/screencast.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,18 +231,10 @@ describe('screencast', suite => {
test.flaky(options.WEBKIT && LINUX);
}, async ({page, tmpDir, server, videoPlayer, toImpl}) => {
const videoFile = path.join(tmpDir, 'v.webm');
// Chromium automatically fits all frames to fit specified size. To avoid
// unwanted transformations we set view port size equal to the screencast
// size.
// TODO: support explicit 'scale' parameter in CDP.
if (options.CHROMIUM)
await page.setViewportSize({width: 640, height: 480});
// Set viewport equal to screencast frame size to avoid scaling.
await page.setViewportSize({width: 640, height: 480});
await page.goto(server.PREFIX + '/rotate-z.html');
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.
await new Promise(r => setTimeout(r, 500));
await toImpl(page)._delegate.stopScreencast();
Expand Down