microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.98k stars 3.68k forks source link

Playwright hangs with 'msedge' or 'chrome' channel browsers in headed mode #22776

Closed thomas-phillips-nz closed 1 year ago

thomas-phillips-nz commented 1 year ago

When running a playwright test with a 'msedge' or 'chrome' channel chromium browser in headed mode, after the test has finished and the browser closed, Playwright will hang for around 30 seconds before finishing. If running several tests, it will hang for 30 seconds in between each test. Turning off the "Continue running background extensions and apps" option in both browsers has no effect

Chrome version(s) tested:

Edge version(s) tested:

Chromium version tested:

Playwright version 1.33.0, Windows 11

Here is a small code snippet to reproduce the code:

import { test, expect } from '@playwright/test';

test('test', async ({ page }) => {
  await page.goto('https://google.co.nz');
});

Here is my projects variable in my config file:

  projects: [
    {
      name: 'Edge',
      use: {
        ...devices['Desktop Edge'],
        channel: 'msedge',
      },
    },
  ]

Here is the command I am using to invoke playwright: npx playwright test test-1.spec.ts --workers 1 --headed

yury-s commented 1 year ago

Turning off the "Continue running background extensions and apps" option in both browsers has no effect

Do you run the tests with extensions?

Please share a project that we could run locally to reproduce this problem (including extensions if they affect the behavior).

Does the problem reproduce when running Chromium without specifying a channel? What about other browsers?

Do you have video enabled in the playwright config?

thomas-phillips-nz commented 1 year ago

Ah, looks like the TestComplete installer forcibly installs and enables the Smartbear Test Extension in Google Chrome and Microsoft Edge, but Playwright starts the browsers without extensions right? For reference: Extension for chrome: https://chrome.google.com/webstore/detail/smartbear-test-extension/gmhjclgpamdccpomoomknemhmmialaae Extension for Microsoft Edge: https://microsoftedge.microsoft.com/addons/detail/smartbear-test-extension/dnboadgmjeggdengfhphcmlclboenlco

Attached is a project you can run locally: playwright-browser-bug.zip

If I use Chromium without a channel it's lightning fast and there is no 30 second wait at the end of the test.

I do not have video enabled.

UPDATE: I dug into the registry and forcibly removed the extensions from the browsers, and the problem is now fixed Kind of ironic I had to go into the registry and delete the keys that had data that matched the extension IDs:

If you install these extensions manually it seems to work fine, no 30 second wait. It looks like it's only a problem if these extensions get forcibly installed and enabled by the TestComplete installer.

I am happy if this gets closed, it doesn't appear to be a Playwright problem.

yury-s commented 1 year ago

Unfortunately this is a known issue mentioned as a warning on this page and we can't do much about misbehaving extensions and the enterprise policies in a generic way.