test(firefox): enable screenshot tests for Firefox (#3942)
References #3889
@ -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, {
|
||||
|
BIN
test/golden-firefox/grid-cell-0.png
Normal file
After Width: | Height: | Size: 331 B |
BIN
test/golden-firefox/grid-cell-1.png
Normal file
After Width: | Height: | Size: 201 B |
BIN
test/golden-firefox/screenshot-clip-odd-size.png
Normal file
After Width: | Height: | Size: 75 B |
BIN
test/golden-firefox/screenshot-clip-rect.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
test/golden-firefox/screenshot-element-bounding-box.png
Normal file
After Width: | Height: | Size: 311 B |
BIN
test/golden-firefox/screenshot-element-fractional.png
Normal file
After Width: | Height: | Size: 109 B |
BIN
test/golden-firefox/screenshot-element-larger-than-viewport.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
test/golden-firefox/screenshot-element-padding-border.png
Normal file
After Width: | Height: | Size: 153 B |
BIN
test/golden-firefox/screenshot-element-rotate.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
test/golden-firefox/screenshot-element-scrolled-into-view.png
Normal file
After Width: | Height: | Size: 153 B |
BIN
test/golden-firefox/screenshot-grid-fullpage.png
Normal file
After Width: | Height: | Size: 54 KiB |
BIN
test/golden-firefox/screenshot-offscreen-clip.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
test/golden-firefox/screenshot-sanity.png
Normal file
After Width: | Height: | Size: 26 KiB |
@ -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('<div style="position:absolute; top: 10.3px; left: 20.4px;width:50.3px;height:20.2px;border:1px solid black;"></div>');
|
||||
const elementHandle = await page.$('div');
|
||||
const screenshot = await elementHandle.screenshot();
|
||||
|