diff --git a/test/golden/screenshot-element-larger-than-viewport.png b/test/golden/screenshot-element-larger-than-viewport.png index 4842968bd9c..5fcdb923555 100644 Binary files a/test/golden/screenshot-element-larger-than-viewport.png and b/test/golden/screenshot-element-larger-than-viewport.png differ diff --git a/test/golden/screenshot-element-with-scroll-container.png b/test/golden/screenshot-element-with-scroll-container.png deleted file mode 100644 index c7860b32a28..00000000000 Binary files a/test/golden/screenshot-element-with-scroll-container.png and /dev/null differ diff --git a/test/test.js b/test/test.js index 09f424801f7..440c43f5a15 100644 --- a/test/test.js +++ b/test/test.js @@ -2125,105 +2125,25 @@ describe('Page', function() { expect(screenshot).toBeGolden('screenshot-element-padding-border.png'); }); it('should capture full element when larger than viewport', async({page, server}) => { - // compare with .to-screenshot size await page.setViewport({width: 500, height: 500}); await page.setContent(` something above - -
-
`); - - await page.evaluate(function() { - window.scrollTo(11, 12); - }); - const elementHandle = await page.$('div.to-screenshot'); const screenshot = await elementHandle.screenshot(); expect(screenshot).toBeGolden('screenshot-element-larger-than-viewport.png'); - expect(await page.evaluate(function() { - return { w: window.innerWidth, h: window.innerHeight }; - })).toEqual({ w: 500, h: 500 }); - }); - it('should screenshot element with scroll container', async({page, server}) => { - // compare with .to-screenshot size - await page.setViewport({width: 500, height: 500}); - - await page.setContent(` - something above - -
-
-
-
-
-
-
- `); - - await page.evaluate(function() { - window.scrollTo(11, 12); - }); - - await page.$eval('div.container1', function(element) { - element.scrollTo(100, 0); - }); - - await page.$eval('div.container2', function(element) { - element.scrollTo(10, 30); - }); - - const elementHandle = await page.$('div.to-screenshot'); - const screenshot = await elementHandle.screenshot(); - expect(screenshot).toBeGolden('screenshot-element-with-scroll-container.png'); + expect(await page.evaluate(() => ({ w: window.innerWidth, h: window.innerHeight }))).toEqual({ w: 500, h: 500 }); }); it('should scroll element into view', async({page, server}) => { await page.setViewport({width: 500, height: 500});