diff --git a/test/golden/screenshot-offscreen-clip.png b/test/golden/screenshot-offscreen-clip.png new file mode 100644 index 00000000000..fac15c30e0b Binary files /dev/null and b/test/golden/screenshot-offscreen-clip.png differ diff --git a/test/test.js b/test/test.js index d7fd5e64c87..7dc45ea701b 100644 --- a/test/test.js +++ b/test/test.js @@ -215,7 +215,6 @@ describe('Puppeteer', function() { var screenshot = await page.screenshot(); expect(screenshot).toBeGolden('screenshot-sanity.png'); })); - it('should clip rect', SX(async function() { await page.setViewportSize({width: 500, height: 500}); await page.navigate(STATIC_PREFIX + '/grid.html'); @@ -229,7 +228,19 @@ describe('Puppeteer', function() { }); expect(screenshot).toBeGolden('screenshot-clip-rect.png'); })); - + it('should work for offscreen clip', SX(async function() { + await page.setViewportSize({width: 500, height: 500}); + await page.navigate(STATIC_PREFIX + '/grid.html'); + var 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', SX(async function() { await page.setViewportSize({width: 500, height: 500}); await page.navigate(STATIC_PREFIX + '/grid.html');