test: add page.screenshot viewport clipping test (#5079)

This commit is contained in:
Mathias Bynens 2019-10-24 14:05:13 +02:00 committed by GitHub
parent 7f3e372b14
commit 360c1b4c7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

View File

@ -39,6 +39,19 @@ module.exports.addTests = function({testRunner, expect, product}) {
});
expect(screenshot).toBeGolden('screenshot-clip-rect.png');
});
it_fails_ffox('should clip elements to the viewport', async({page, server}) => {
await page.setViewport({width: 500, height: 500});
await page.goto(server.PREFIX + '/grid.html');
const screenshot = await page.screenshot({
clip: {
x: 50,
y: 600,
width: 100,
height: 100
}
});
expect(screenshot).toBeGolden('screenshot-offscreen-clip.png');
});
it('should run in parallel', async({page, server}) => {
await page.setViewport({width: 500, height: 500});
await page.goto(server.PREFIX + '/grid.html');