Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Chromium - Stuck Execution on context.waitForEvent('serviceworker') with extension testing #33682

Open
darshandp007 opened this issue Nov 19, 2024 · 4 comments

Comments

@darshandp007
Copy link

darshandp007 commented Nov 19, 2024

Version

1.49.0

Description

I encountered an issue while testing a Manifest v3 extension using Playwright. The execution gets stuck at the following line and does not proceed:

await context.waitForEvent('serviceworker');

Steps to reproduce:

  1. I uploaded the extension to the Chromium browser using the code provided in the Playwright documentation for Testing Chrome Extensions.
  2. The execution hangs after the above line, and no further steps are executed.

Observations:

  1. The same code worked perfectly in Playwright version 1.48.2.
  2. The issue started appearing after upgrading to the current version.

Expected behavior

The code should wait for the serviceworker event and proceed as expected.

Actual behavior

Execution is stuck indefinitely, and the serviceworker event is not detected.

Additional context

  • Browser Version: Chromium (131.0.6778.33)
  • Playwright Version: (1.49.0)
  • Operating System: (Linux)
  • Extension Type: Manifest v3

Environment

System:
  OS: Linux 6.2 Ubuntu 22.04.3
Binaries:
  Node: 18.18.2
  npm: 9.8.1
npmPackages:
  @playwright/test: 1.49.0
@darshandp007 darshandp007 changed the title [Bug]: Stuck Execution on context.waitForEvent('serviceworker') with Manifest v3 Extension [Bug]: Chromium - Stuck Execution on context.waitForEvent('serviceworker') with extension testing Nov 19, 2024
@dgozman
Copy link
Contributor

dgozman commented Nov 20, 2024

@darshandp007 Could you please share a minimal reproducible that includes a sample extension and your test code? That would help to get this issue resolved. Without a repro, it's much less likely we'll be able to figure out the problem.

@mdmower
Copy link

mdmower commented Nov 23, 2024

@dgozman - This bug affects me as well. Here's a minimal reproduction, see testing instructions in readme: https://github.com/mdmower/pw-sw-wait . The issue started with v1.49.0. It is not a problem in v1.48.2.

@mdmower
Copy link

mdmower commented Nov 23, 2024

Follow-up: It looks like this issue is resolved by opting into the new headless. Is this the same as the old --headless=new flag?

When I make the following updates to sample repo https://github.com/mdmower/pw-sw-wait (and my own personal projects), the test suite works again:

diff --git a/playwright.config.js b/playwright.config.js
index ee32b05..1a23506 100644
--- a/playwright.config.js
+++ b/playwright.config.js
@@ -10,7 +10,7 @@ export default defineConfig({
   projects: [
     {
       name: "chromium",
-      use: { ...devices["Desktop Chrome"] },
+      use: { ...devices["Desktop Chrome"], channel: "chromium" },
     },
   ],
 });
diff --git a/pw-fixtures.js b/pw-fixtures.js
index b685ad7..7fd6c25 100644
--- a/pw-fixtures.js
+++ b/pw-fixtures.js
@@ -6,7 +6,6 @@ export const test = base.extend({
     const pathToExtension = fileURLToPath(import.meta.resolve("."));
     const context = await chromium.launchPersistentContext("", {
       args: [
-        "--headless=new",
         `--disable-extensions-except=${pathToExtension}`,
         `--load-extension=${pathToExtension}`,
       ],

@dgozman
Copy link
Contributor

dgozman commented Nov 25, 2024

@mdmower Yes, you are right, the new chromium channel is equivalent to passing --headless=new previously. Let me update the docs that are now wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants