From e91c041b7973d852e9959438913bae3cc52dfa77 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Tue, 29 Oct 2024 16:18:11 +0100 Subject: [PATCH] test: fix headless-shell tests --- tests/library/browsertype-connect.spec.ts | 7 ++++--- tests/library/chromium/oopif.spec.ts | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/library/browsertype-connect.spec.ts b/tests/library/browsertype-connect.spec.ts index a732985b5b..9cf103ee2f 100644 --- a/tests/library/browsertype-connect.spec.ts +++ b/tests/library/browsertype-connect.spec.ts @@ -169,8 +169,9 @@ for (const kind of ['launchServer', 'run-server'] as const) { await browser.close(); }); - test('should ignore page.pause when headed', async ({ connect, startRemoteServer, browserType }) => { - const headless = (browserType as any)._defaultLaunchOptions.headless; + test('should ignore page.pause when headed', async ({ connect, startRemoteServer, browserType, headless }) => { + test.skip(headless, 'This test is only relevant in headed mode'); + const originalHeadlessValue = (browserType as any)._defaultLaunchOptions.headless; (browserType as any)._defaultLaunchOptions.headless = false; const remoteServer = await startRemoteServer(kind); const browser = await connect(remoteServer.wsEndpoint()); @@ -178,7 +179,7 @@ for (const kind of ['launchServer', 'run-server'] as const) { const page = await browserContext.newPage(); await page.pause(); await browser.close(); - (browserType as any)._defaultLaunchOptions.headless = headless; + (browserType as any)._defaultLaunchOptions.headless = originalHeadlessValue; }); test('should be able to visit ipv6 through localhost', async ({ connect, startRemoteServer, ipV6ServerPort }) => { diff --git a/tests/library/chromium/oopif.spec.ts b/tests/library/chromium/oopif.spec.ts index 3878aa5142..158af61a24 100644 --- a/tests/library/chromium/oopif.spec.ts +++ b/tests/library/chromium/oopif.spec.ts @@ -235,7 +235,7 @@ it('should click a button when it overlays oopif', async function({ page, browse it('should report google.com frame with headed', async ({ browserType, server }) => { // @see https://github.com/GoogleChrome/puppeteer/issues/2548 // https://google.com is isolated by default in Chromium embedder. - const browser = await browserType.launch({ headless: false }); + const browser = await browserType.launch(); const page = await browser.newPage(); await page.goto(server.EMPTY_PAGE); await page.route('**/*', route => {