diff --git a/experimental/puppeteer-firefox/lib/Page.js b/experimental/puppeteer-firefox/lib/Page.js index b0ce8828b17..2365be9571c 100644 --- a/experimental/puppeteer-firefox/lib/Page.js +++ b/experimental/puppeteer-firefox/lib/Page.js @@ -822,6 +822,8 @@ class ElementHandle extends JSHandle { }); if (!clip) throw new Error('Node is either not visible or not an HTMLElement'); + assert(clip.width, 'Node has 0 width.'); + assert(clip.height, 'Node has 0 height.'); await this._scrollIntoViewIfNeeded(); return await this._frame._page.screenshot(Object.assign({}, options, { diff --git a/test/golden-firefox/grid-cell-0.png b/test/golden-firefox/grid-cell-0.png new file mode 100644 index 00000000000..4677bdbc4f8 Binary files /dev/null and b/test/golden-firefox/grid-cell-0.png differ diff --git a/test/golden-firefox/grid-cell-1.png b/test/golden-firefox/grid-cell-1.png new file mode 100644 index 00000000000..532dc8db65b Binary files /dev/null and b/test/golden-firefox/grid-cell-1.png differ diff --git a/test/golden-firefox/screenshot-clip-odd-size.png b/test/golden-firefox/screenshot-clip-odd-size.png new file mode 100644 index 00000000000..8e86dc90178 Binary files /dev/null and b/test/golden-firefox/screenshot-clip-odd-size.png differ diff --git a/test/golden-firefox/screenshot-clip-rect.png b/test/golden-firefox/screenshot-clip-rect.png new file mode 100644 index 00000000000..7a744578693 Binary files /dev/null and b/test/golden-firefox/screenshot-clip-rect.png differ diff --git a/test/golden-firefox/screenshot-element-bounding-box.png b/test/golden-firefox/screenshot-element-bounding-box.png new file mode 100644 index 00000000000..f4e059c300c Binary files /dev/null and b/test/golden-firefox/screenshot-element-bounding-box.png differ diff --git a/test/golden-firefox/screenshot-element-fractional.png b/test/golden-firefox/screenshot-element-fractional.png new file mode 100644 index 00000000000..d1431bd91de Binary files /dev/null and b/test/golden-firefox/screenshot-element-fractional.png differ diff --git a/test/golden-firefox/screenshot-element-larger-than-viewport.png b/test/golden-firefox/screenshot-element-larger-than-viewport.png new file mode 100644 index 00000000000..6d28cddcea3 Binary files /dev/null and b/test/golden-firefox/screenshot-element-larger-than-viewport.png differ diff --git a/test/golden-firefox/screenshot-element-padding-border.png b/test/golden-firefox/screenshot-element-padding-border.png new file mode 100644 index 00000000000..2b72c7528b2 Binary files /dev/null and b/test/golden-firefox/screenshot-element-padding-border.png differ diff --git a/test/golden-firefox/screenshot-element-rotate.png b/test/golden-firefox/screenshot-element-rotate.png new file mode 100644 index 00000000000..0a78fb1ae7b Binary files /dev/null and b/test/golden-firefox/screenshot-element-rotate.png differ diff --git a/test/golden-firefox/screenshot-element-scrolled-into-view.png b/test/golden-firefox/screenshot-element-scrolled-into-view.png new file mode 100644 index 00000000000..2b72c7528b2 Binary files /dev/null and b/test/golden-firefox/screenshot-element-scrolled-into-view.png differ diff --git a/test/golden-firefox/screenshot-grid-fullpage.png b/test/golden-firefox/screenshot-grid-fullpage.png new file mode 100644 index 00000000000..ac47ec83b19 Binary files /dev/null and b/test/golden-firefox/screenshot-grid-fullpage.png differ diff --git a/test/golden-firefox/screenshot-offscreen-clip.png b/test/golden-firefox/screenshot-offscreen-clip.png new file mode 100644 index 00000000000..791496e5da7 Binary files /dev/null and b/test/golden-firefox/screenshot-offscreen-clip.png differ diff --git a/test/golden-firefox/screenshot-sanity.png b/test/golden-firefox/screenshot-sanity.png new file mode 100644 index 00000000000..07890a04b34 Binary files /dev/null and b/test/golden-firefox/screenshot-sanity.png differ diff --git a/test/screenshot.spec.js b/test/screenshot.spec.js index b5bbb3f516c..8f28bddc594 100644 --- a/test/screenshot.spec.js +++ b/test/screenshot.spec.js @@ -16,10 +16,10 @@ module.exports.addTests = function({testRunner, expect, product}) { const {describe, xdescribe, fdescribe, describe_fails_ffox} = testRunner; - const {it, fit, xit} = testRunner; + const {it, fit, xit, it_fails_ffox} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; - describe_fails_ffox('Page.screenshot', function() { + describe('Page.screenshot', function() { it('should work', async({page, server}) => { await page.setViewport({width: 500, height: 500}); await page.goto(server.PREFIX + '/grid.html'); @@ -92,13 +92,13 @@ module.exports.addTests = function({testRunner, expect, product}) { expect(screenshots[i]).toBeGolden(`grid-cell-${i}.png`); await Promise.all(pages.map(page => page.close())); }); - it('should allow transparency', async({page, server}) => { + it_fails_ffox('should allow transparency', async({page, server}) => { await page.setViewport({ width: 100, height: 100 }); await page.goto(server.EMPTY_PAGE); const screenshot = await page.screenshot({omitBackground: true}); expect(screenshot).toBeGolden('transparent.png'); }); - it('should render white background on jpeg file', async({page, server}) => { + it_fails_ffox('should render white background on jpeg file', async({page, server}) => { await page.setViewport({ width: 100, height: 100 }); await page.goto(server.EMPTY_PAGE); const screenshot = await page.screenshot({omitBackground: true, type: 'jpeg'}); @@ -125,7 +125,7 @@ module.exports.addTests = function({testRunner, expect, product}) { }); }); - describe_fails_ffox('ElementHandle.screenshot', function() { + describe('ElementHandle.screenshot', function() { it('should work', async({page, server}) => { await page.setViewport({width: 500, height: 500}); await page.goto(server.PREFIX + '/grid.html'); @@ -230,7 +230,7 @@ module.exports.addTests = function({testRunner, expect, product}) { const screenshot = await elementHandle.screenshot(); expect(screenshot).toBeGolden('screenshot-element-fractional.png'); }); - it('should work for an element with an offset', async({page}) => { + it_fails_ffox('should work for an element with an offset', async({page}) => { await page.setContent('
'); const elementHandle = await page.$('div'); const screenshot = await elementHandle.screenshot();