test(firefox): enable screenshot tests for Firefox (#3942)

References #3889
This commit is contained in:
Andrey Lushnikov 2019-02-07 07:59:14 -08:00 committed by GitHub
parent 49e8704ba8
commit 609e763381
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 8 additions and 6 deletions

View File

@ -822,6 +822,8 @@ class ElementHandle extends JSHandle {
}); });
if (!clip) if (!clip)
throw new Error('Node is either not visible or not an HTMLElement'); 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(); await this._scrollIntoViewIfNeeded();
return await this._frame._page.screenshot(Object.assign({}, options, { return await this._frame._page.screenshot(Object.assign({}, options, {

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -16,10 +16,10 @@
module.exports.addTests = function({testRunner, expect, product}) { module.exports.addTests = function({testRunner, expect, product}) {
const {describe, xdescribe, fdescribe, describe_fails_ffox} = testRunner; 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; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe_fails_ffox('Page.screenshot', function() { describe('Page.screenshot', function() {
it('should work', async({page, server}) => { it('should work', async({page, server}) => {
await page.setViewport({width: 500, height: 500}); await page.setViewport({width: 500, height: 500});
await page.goto(server.PREFIX + '/grid.html'); 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`); expect(screenshots[i]).toBeGolden(`grid-cell-${i}.png`);
await Promise.all(pages.map(page => page.close())); 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.setViewport({ width: 100, height: 100 });
await page.goto(server.EMPTY_PAGE); await page.goto(server.EMPTY_PAGE);
const screenshot = await page.screenshot({omitBackground: true}); const screenshot = await page.screenshot({omitBackground: true});
expect(screenshot).toBeGolden('transparent.png'); 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.setViewport({ width: 100, height: 100 });
await page.goto(server.EMPTY_PAGE); await page.goto(server.EMPTY_PAGE);
const screenshot = await page.screenshot({omitBackground: true, type: 'jpeg'}); 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}) => { it('should work', async({page, server}) => {
await page.setViewport({width: 500, height: 500}); await page.setViewport({width: 500, height: 500});
await page.goto(server.PREFIX + '/grid.html'); await page.goto(server.PREFIX + '/grid.html');
@ -230,7 +230,7 @@ module.exports.addTests = function({testRunner, expect, product}) {
const screenshot = await elementHandle.screenshot(); const screenshot = await elementHandle.screenshot();
expect(screenshot).toBeGolden('screenshot-element-fractional.png'); 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>'); 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 elementHandle = await page.$('div');
const screenshot = await elementHandle.screenshot(); const screenshot = await elementHandle.screenshot();