From c226cd9ba98f6cae3a1c7425a3126ae1de7df9ea Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Thu, 24 Oct 2019 11:46:05 +0200 Subject: [PATCH] test: add page.screenshot viewport clipping test --- .../golden-chromium/screenshot-offscreen-clip.png | Bin 0 -> 326 bytes test/golden-firefox/screenshot-offscreen-clip.png | Bin 0 -> 326 bytes test/screenshot.spec.js | 13 +++++++++++++ 3 files changed, 13 insertions(+) create mode 100644 test/golden-chromium/screenshot-offscreen-clip.png create mode 100644 test/golden-firefox/screenshot-offscreen-clip.png diff --git a/test/golden-chromium/screenshot-offscreen-clip.png b/test/golden-chromium/screenshot-offscreen-clip.png new file mode 100644 index 0000000000000000000000000000000000000000..31a0935cda7dee10bb848bf981f26efe041edb1f GIT binary patch literal 326 zcmeAS@N?(olHy`uVBq!ia0vp^DImBI42E5#xo|41ePP)|E literal 0 HcmV?d00001 diff --git a/test/golden-firefox/screenshot-offscreen-clip.png b/test/golden-firefox/screenshot-offscreen-clip.png new file mode 100644 index 0000000000000000000000000000000000000000..31a0935cda7dee10bb848bf981f26efe041edb1f GIT binary patch literal 326 zcmeAS@N?(olHy`uVBq!ia0vp^DImBI42E5#xo|41ePP)|E literal 0 HcmV?d00001 diff --git a/test/screenshot.spec.js b/test/screenshot.spec.js index 701e208ab05cd..a2bae3b33f626 100644 --- a/test/screenshot.spec.js +++ b/test/screenshot.spec.js @@ -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');