diff --git a/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/chromium-darwin/focused-input.png b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/chromium-darwin/focused-input.png new file mode 100644 index 0000000000000..327fce85373f7 Binary files /dev/null and b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/chromium-darwin/focused-input.png differ diff --git a/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/chromium-linux/focused-input.png b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/chromium-linux/focused-input.png new file mode 100644 index 0000000000000..ca5082b3bfc7d Binary files /dev/null and b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/chromium-linux/focused-input.png differ diff --git a/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/chromium-win32/focused-input.png b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/chromium-win32/focused-input.png new file mode 100644 index 0000000000000..ca5082b3bfc7d Binary files /dev/null and b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/chromium-win32/focused-input.png differ diff --git a/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/firefox-darwin/focused-input.png b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/firefox-darwin/focused-input.png new file mode 100644 index 0000000000000..ee6ca12b5c869 Binary files /dev/null and b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/firefox-darwin/focused-input.png differ diff --git a/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/firefox-linux/focused-input.png b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/firefox-linux/focused-input.png new file mode 100644 index 0000000000000..bcff3cba335bb Binary files /dev/null and b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/firefox-linux/focused-input.png differ diff --git a/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/firefox-win32/focused-input.png b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/firefox-win32/focused-input.png new file mode 100644 index 0000000000000..ea65d7a79f023 Binary files /dev/null and b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/firefox-win32/focused-input.png differ diff --git a/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/webkit-darwin/focused-input.png b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/webkit-darwin/focused-input.png new file mode 100644 index 0000000000000..0526762bf9220 Binary files /dev/null and b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/webkit-darwin/focused-input.png differ diff --git a/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/webkit-linux/focused-input.png b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/webkit-linux/focused-input.png new file mode 100644 index 0000000000000..f76edad846f56 Binary files /dev/null and b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/webkit-linux/focused-input.png differ diff --git a/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/webkit-win32/focused-input.png b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/webkit-win32/focused-input.png new file mode 100644 index 0000000000000..c587794530d1d Binary files /dev/null and b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/webkit-win32/focused-input.png differ diff --git a/test/headful.spec.ts b/test/headful.spec.ts index 120fee4aa39f4..3842d467e3366 100644 --- a/test/headful.spec.ts +++ b/test/headful.spec.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { it, expect } from './fixtures'; +import { it, expect, folio } from './fixtures'; it('should have default url when launching browser', async ({browserType, browserOptions, createUserDataDir}) => { const browserContext = await browserType.launchPersistentContext(await createUserDataDir(), {...browserOptions, headless: false }); @@ -168,3 +168,31 @@ it('Page.bringToFront should work', async ({browserType, browserOptions}) => { ); await browser.close(); }); + +const fixtures = folio.extend(); +fixtures.testParametersPathSegment.override(async ({ browserName, platform }, run) => { + await run(browserName + '-' + platform); +}); +fixtures.build().it('focused input should produce the same screenshot', (test, { browserName, platform }) => { + test.fail(browserName === 'firefox' && platform === 'darwin', 'headless has thinner outline'); + test.fail(browserName === 'firefox' && platform === 'linux', 'headless has no outline'); + test.skip(browserName === 'webkit' && platform === 'linux', 'gtk vs wpe'); + test.fail(browserName === 'chromium', 'Different outline color'); +}, async ({browserType, browserOptions}) => { + const headful = await browserType.launch({...browserOptions, headless: false }); + const headfulPage = await headful.newPage(); + await headfulPage.setContent(''); + await headfulPage.focus('input'); + const headfulScreenshot = await headfulPage.screenshot(); + await headful.close(); + + const headless = await browserType.launch({...browserOptions, headless: true }); + const headlessPage = await headless.newPage(); + await headlessPage.setContent(''); + await headlessPage.focus('input'); + const headlessScreenshot = await headlessPage.screenshot(); + await headless.close(); + + expect(headfulScreenshot).toMatchSnapshot('focused-input.png'); + expect(headlessScreenshot).toMatchSnapshot('focused-input.png'); +});