diff --git a/test/golden-chromium/screenshot-fromsurface-false.png b/test/golden-chromium/screenshot-fromsurface-false.png new file mode 100644 index 0000000000000..194f8ae6f67a2 Binary files /dev/null and b/test/golden-chromium/screenshot-fromsurface-false.png differ diff --git a/test/src/mocha-utils.ts b/test/src/mocha-utils.ts index e23837e6b1eba..b7f7a4d30565b 100644 --- a/test/src/mocha-utils.ts +++ b/test/src/mocha-utils.ts @@ -185,6 +185,17 @@ export const itHeadlessOnly = ( } }; +export const itHeadfulOnly = ( + description: string, + body: Mocha.Func +): Mocha.Test => { + if (isChrome && isHeadless === false) { + return it(description, body); + } else { + return xit(description, body); + } +}; + export const itFirefoxOnly = ( description: string, body: Mocha.Func diff --git a/test/src/screenshot.spec.ts b/test/src/screenshot.spec.ts index 0507bbb4b3e2b..dc9f1aac88969 100644 --- a/test/src/screenshot.spec.ts +++ b/test/src/screenshot.spec.ts @@ -188,6 +188,16 @@ describe('Screenshots', function () { 'screenshot-sanity.png' ); }); + itHeadfulOnly('should work in \'fromSurface: false\' mode', async () => { + const { page, server } = getTestState(); + + await page.setViewport({ width: 500, height: 500 }); + await page.goto(server.PREFIX + '/grid.html'); + const screenshot = await page.screenshot({ + fromSurface: false + }); + expect(screenshot).toBeGolden('screenshot-fromsurface-false.png'); + }); }); describe('ElementHandle.screenshot', function () {