fix: set JPG background to white when omitBackground option is used (#3240)

Fixes #3234
This commit is contained in:
Łukasz Usarz
2018-09-14 12:03:33 +02:00
committed by Andrey Lushnikov
parent 6ec3ce6920
commit d929f7e213
5 changed files with 21 additions and 9 deletions

View File

@@ -1656,6 +1656,12 @@ module.exports.addTests = function({testRunner, expect, headless}) {
const screenshot = await page.screenshot({omitBackground: true});
expect(screenshot).toBeGolden('transparent.png');
});
it('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'});
expect(screenshot).toBeGolden('white.jpg');
});
it('should work with odd clip size on Retina displays', async({page, server}) => {
const screenshot = await page.screenshot({
clip: {