Skip to content

Commit

Permalink
test: add page.screenshot viewport clipping test (#5079)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasbynens committed Oct 24, 2019
1 parent 7f3e372 commit 360c1b4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
Binary file added test/golden-chromium/screenshot-offscreen-clip.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/golden-firefox/screenshot-offscreen-clip.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions test/screenshot.spec.js
Expand Up @@ -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');
Expand Down

0 comments on commit 360c1b4

Please sign in to comment.