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.4k stars 3.63k forks source link

[BUG]: All webkit tests fail with `Error: browserContext.newPage: Target page, context or browser has been closed`. #27615

Closed NashJames closed 11 months ago

NashJames commented 1 year ago

System info

Source code

https://github.com/NashJames/Holocron.io

Not sure how relevant it would be to provide a more minimal example as the issue may be elsewhere given the existence of this ticket: #20576

Expected

All tests pass

Actual

All webkit tests fail with the identical error: Error: browserContext.newPage: Target page, context or browser has been closed.

Steps taken to resolve

1) pnpm i -D @playwright/test@next 2) pnpm exec playwright install --force --with-deps chromium firefox webkit chrome msedge 3) apt upgrade

Detailed Logs

These logs only represent 2 failing tests. There are 12 failing in total.

Click here ``` ❯ DEBUG=pw:browser,pw:protocol pnpm exec playwright test --config ./config/playwright.config.ts --project=webkit ./tests/e2e/components/AppHeader.spec.ts Running 2 tests using 2 workers [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:browser /root/.cache/ms-playwright/webkit-1926/pw_run.sh --inspector-pipe --headless --no-startup-window +0ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:browser /root/.cache/ms-playwright/webkit-1926/pw_run.sh --inspector-pipe --headless --no-startup-window +0ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:browser pid=29651 +4ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:browser pid=29652 +4ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:protocol SEND ► {"id":1,"method":"Playwright.enable"} +0ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:protocol SEND ► {"id":1,"method":"Playwright.enable"} +0ms pw:browser [pid=29652][err] +155ms pw:browser [pid=29652][err] (MiniBrowser:29664): GStreamer-WARNING **: 21:26:40.839: External plugin loader failed. This most likely means that the plugin loader helper binary was not found or could not be run. You might need to set the GST_PLUGIN_SCANNER environment variable if your setup is unusual. This should normally not be required though. +0ms pw:browser [pid=29652][err] +0ms pw:browser [pid=29652][err] (MiniBrowser:29664): GStreamer-WARNING **: 21:26:40.840: Failed to load plugin '/root/.cache/ms-playwright/webkit-1926/minibrowser-wpe/sys/lib/gst/libgstfdkaac.so': libfdk-aac.so.1: cannot open shared object file: No such file or directory +0ms pw:browser [pid=29652][err] +0ms pw:browser [pid=29652][err] (MiniBrowser:29664): GStreamer-WARNING **: 21:26:40.840: Failed to load plugin '/root/.cache/ms-playwright/webkit-1926/minibrowser-wpe/sys/lib/gst/libgstwpe.so': libWPEWebKit-1.0.so.3: cannot open shared object file: No such file or directory +1ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:browser [pid=29651][err] +158ms pw:browser [pid=29651][err] (MiniBrowser:29663): GStreamer-WARNING **: 21:26:40.840: External plugin loader failed. This most likely means that the plugin loader helper binary was not found or could not be run. You might need to set the GST_PLUGIN_SCANNER environment variable if your setup is unusual. This should normally not be required though. +0ms pw:browser [pid=29651][err] +0ms pw:browser [pid=29651][err] (MiniBrowser:29663): GStreamer-WARNING **: 21:26:40.840: Failed to load plugin '/root/.cache/ms-playwright/webkit-1926/minibrowser-wpe/sys/lib/gst/libgstfdkaac.so': libfdk-aac.so.1: cannot open shared object file: No such file or directory +0ms pw:browser [pid=29651][err] +0ms pw:browser [pid=29651][err] (MiniBrowser:29663): GStreamer-WARNING **: 21:26:40.841: Failed to load plugin '/root/.cache/ms-playwright/webkit-1926/minibrowser-wpe/sys/lib/gst/libgstwpe.so': libWPEWebKit-1.0.so.3: cannot open shared object file: No such file or directory +0ms pw:protocol ◀ RECV {"result":{},"id":1} +165ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:protocol ◀ RECV {"result":{},"id":1} +164ms pw:protocol SEND ► {"id":2,"method":"Playwright.createContext"} +8ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:protocol SEND ► {"id":2,"method":"Playwright.createContext"} +8ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:protocol ◀ RECV {"result":{"browserContextId":"8000000000000002"},"id":2} +6ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:protocol ◀ RECV {"result":{"browserContextId":"8000000000000002"},"id":2} +6ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:protocol SEND ► {"id":3,"method":"Playwright.setDownloadBehavior","params":{"behavior":"allow","downloadPath":"/tmp/playwright-artifacts-kWeXwi","browserContextId":"8000000000000002"}} +3ms pw:protocol SEND ► {"id":4,"method":"Playwright.setLanguages","params":{"browserContextId":"8000000000000002","languages":["en-US"]}} +0ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:protocol SEND ► {"id":3,"method":"Playwright.setDownloadBehavior","params":{"behavior":"allow","downloadPath":"/tmp/playwright-artifacts-gbfRnf","browserContextId":"8000000000000002"}} +3ms pw:protocol SEND ► {"id":4,"method":"Playwright.setLanguages","params":{"browserContextId":"8000000000000002","languages":["en-US"]}} +0ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:protocol ◀ RECV {"result":{},"id":3} +0ms pw:protocol ◀ RECV {"result":{},"id":4} +0ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:protocol ◀ RECV {"result":{},"id":3} +0ms pw:protocol ◀ RECV {"result":{},"id":4} +1ms pw:protocol SEND ► {"id":5,"method":"Playwright.createPage","params":{"browserContextId":"8000000000000002"}} +18ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:protocol SEND ► {"id":5,"method":"Playwright.createPage","params":{"browserContextId":"8000000000000002"}} +20ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:protocol ◀ RECV {"method":"Playwright.pageProxyCreated","params":{"browserContextId":"8000000000000002","pageProxyId":"8"}} +8ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:protocol ◀ RECV {"method":"Playwright.pageProxyCreated","params":{"browserContextId":"8000000000000002","pageProxyId":"8"}} +7ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:browser [pid=29651][err] EGLDisplay Initialization failed: EGL_NOT_INITIALIZED +101ms pw:browser [pid=29651][err] Could not determine the accessibility bus address +1ms pw:protocol ◀ RECV {"method":"Target.targetCreated","params":{"targetInfo":{"targetId":"page-9","type":"page","isPaused":true}},"browserContextId":"8000000000000002","pageProxyId":"8"} +49ms pw:protocol SEND ► {"id":6,"method":"Dialog.enable","pageProxyId":"8"} +1ms pw:protocol SEND ► {"id":7,"method":"Emulation.setActiveAndFocused","params":{"active":true},"pageProxyId":"8"} +0ms pw:protocol SEND ► {"id":8,"method":"Emulation.setDeviceMetricsOverride","params":{"width":1280,"height":720,"fixedLayout":false,"deviceScaleFactor":2},"pageProxyId":"8"} +1ms pw:protocol SEND ► {"id":10,"method":"Target.sendMessageToTarget","params":{"message":"{\"id\":9,\"method\":\"Page.setScreenSizeOverride\",\"params\":{\"width\":1280,\"height\":720}}","targetId":"page-9"},"pageProxyId":"8"} +0ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:browser [pid=29652][err] EGLDisplay Initialization failed: EGL_NOT_INITIALIZED +105ms pw:browser [pid=29652][err] Could not determine the accessibility bus address +0ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:protocol SEND ► {"id":11,"method":"Emulation.setAuthCredentials","params":{"username":"","password":"","origin":""},"pageProxyId":"8"} +0ms pw:protocol SEND ► {"id":13,"method":"Target.sendMessageToTarget","params":{"message":"{\"id\":12,\"method\":\"Page.enable\"}","targetId":"page-9"},"pageProxyId":"8"} +1ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:protocol ◀ RECV {"method":"Target.targetCreated","params":{"targetInfo":{"targetId":"page-9","type":"page","isPaused":true}},"browserContextId":"8000000000000002","pageProxyId":"8"} +52ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:protocol SEND ► {"id":15,"method":"Target.sendMessageToTarget","params":{"message":"{\"id\":14,\"method\":\"Page.getResourceTree\"}","targetId":"page-9"},"pageProxyId":"8"} +1ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:protocol SEND ► {"id":6,"method":"Dialog.enable","pageProxyId":"8"} +1ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:protocol ◀ RECV {"result":{"pageProxyId":"8"},"id":5} +0ms pw:protocol ◀ RECV {"result":{},"id":6,"browserContextId":"8000000000000002","pageProxyId":"8"} +0ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:protocol SEND ► {"id":7,"method":"Emulation.setActiveAndFocused","params":{"active":true},"pageProxyId":"8"} +0ms pw:protocol SEND ► {"id":8,"method":"Emulation.setDeviceMetricsOverride","params":{"width":1280,"height":720,"fixedLayout":false,"deviceScaleFactor":2},"pageProxyId":"8"} +1ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:protocol ◀ RECV {"result":{},"id":7,"browserContextId":"8000000000000002","pageProxyId":"8"} +1ms pw:protocol ◀ RECV {"result":{},"id":8,"browserContextId":"8000000000000002","pageProxyId":"8"} +0ms pw:protocol ◀ RECV {"result":{},"id":10,"browserContextId":"8000000000000002","pageProxyId":"8"} +0ms pw:protocol ◀ RECV {"result":{},"id":11,"browserContextId":"8000000000000002","pageProxyId":"8"} +0ms pw:protocol ◀ RECV {"result":{},"id":13,"browserContextId":"8000000000000002","pageProxyId":"8"} +0ms pw:protocol ◀ RECV {"result":{},"id":15,"browserContextId":"8000000000000002","pageProxyId":"8"} +0ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:protocol SEND ► {"id":10,"method":"Target.sendMessageToTarget","params":{"message":"{\"id\":9,\"method\":\"Page.setScreenSizeOverride\",\"params\":{\"width\":1280,\"height\":720}}","targetId":"page-9"},"pageProxyId":"8"} +0ms pw:protocol SEND ► {"id":11,"method":"Emulation.setAuthCredentials","params":{"username":"","password":"","origin":""},"pageProxyId":"8"} +1ms pw:protocol SEND ► {"id":13,"method":"Target.sendMessageToTarget","params":{"message":"{\"id\":12,\"method\":\"Page.enable\"}","targetId":"page-9"},"pageProxyId":"8"} +0ms pw:protocol SEND ► {"id":15,"method":"Target.sendMessageToTarget","params":{"message":"{\"id\":14,\"method\":\"Page.getResourceTree\"}","targetId":"page-9"},"pageProxyId":"8"} +1ms pw:protocol ◀ RECV {"result":{"pageProxyId":"8"},"id":5} +0ms pw:protocol ◀ RECV {"result":{},"id":6,"browserContextId":"8000000000000002","pageProxyId":"8"} +0ms pw:protocol ◀ RECV {"result":{},"id":7,"browserContextId":"8000000000000002","pageProxyId":"8"} +1ms pw:protocol ◀ RECV {"result":{},"id":8,"browserContextId":"8000000000000002","pageProxyId":"8"} +0ms pw:protocol ◀ RECV {"result":{},"id":10,"browserContextId":"8000000000000002","pageProxyId":"8"} +1ms pw:protocol ◀ RECV {"result":{},"id":11,"browserContextId":"8000000000000002","pageProxyId":"8"} +0ms pw:protocol ◀ RECV {"result":{},"id":13,"browserContextId":"8000000000000002","pageProxyId":"8"} +0ms pw:protocol ◀ RECV {"result":{},"id":15,"browserContextId":"8000000000000002","pageProxyId":"8"} +0ms pw:protocol ◀ RECV {"method":"Target.targetDestroyed","params":{"targetId":"page-9","crashed":true},"browserContextId":"8000000000000002","pageProxyId":"8"} +559ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:protocol ◀ RECV {"method":"Target.targetDestroyed","params":{"targetId":"page-9","crashed":true},"browserContextId":"8000000000000002","pageProxyId":"8"} +563ms pw:protocol SEND ► {"id":16,"method":"Target.resume","params":{"targetId":"page-9"},"pageProxyId":"8"} +2ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:protocol SEND ► {"id":16,"method":"Target.resume","params":{"targetId":"page-9"},"pageProxyId":"8"} +2ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:protocol ◀ RECV {"error":{"code":-32000,"message":"Missing target for given targetId","data":[{"code":-32000,"message":"Missing target for given targetId"}]},"id":16,"browserContextId":"8000000000000002","pageProxyId":"8"} +7ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:protocol ◀ RECV {"error":{"code":-32000,"message":"Missing target for given targetId","data":[{"code":-32000,"message":"Missing target for given targetId"}]},"id":16,"browserContextId":"8000000000000002","pageProxyId":"8"} +7ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:protocol SEND ► {"id":17,"method":"Playwright.deleteContext","params":{"browserContextId":"8000000000000002"}} +1ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:protocol SEND ► {"id":17,"method":"Playwright.deleteContext","params":{"browserContextId":"8000000000000002"}} +1ms pw:browser [pid=29652][err] +576ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:browser [pid=29651][err] +579ms pw:browser [pid=29651][err] (MiniBrowser:29663): GLib-GIO-CRITICAL **: 21:26:41.522: g_application_quit: assertion 'G_IS_APPLICATION (application)' failed +0ms pw:protocol ◀ RECV {"method":"Playwright.pageProxyDestroyed","params":{"pageProxyId":"8"}} +1ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:browser [pid=29652][err] (MiniBrowser:29664): GLib-GIO-CRITICAL **: 21:26:41.522: g_application_quit: assertion 'G_IS_APPLICATION (application)' failed +0ms pw:protocol ◀ RECV {"method":"Playwright.pageProxyDestroyed","params":{"pageProxyId":"8"}} +0ms pw:protocol ◀ RECV {"result":{},"id":17} +1ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:protocol ◀ RECV {"result":{},"id":17} +1ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:browser [pid=29652] +6ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:browser [pid=29651] +6ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:protocol ◀ RECV {"result":{},"id":-9999} +5ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:protocol ◀ RECV {"result":{},"id":-9999} +4ms pw:browser [pid=29651] +5ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:browser [pid=29652] +5ms pw:browser [pid=29652] starting temporary directories cleanup +0ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:browser [pid=29651] starting temporary directories cleanup +0ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:browser [pid=29652] finished temporary directories cleanup +1ms pw:browser [pid=29652] +0ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:browser [pid=29651] finished temporary directories cleanup +2ms pw:browser [pid=29651] +0ms 1) [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository ─────────────────── Error: browserContext.newPage: Target page, context or browser has been closed 2) [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives ─────────────────────── Error: browserContext.newPage: Target page, context or browser has been closed 2 failed [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives ──────────────────────── [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository ──────────────────── Serving HTML report at http://localhost:9323. Press Ctrl+C to quit. ```
mxschmitt commented 1 year ago

Not sure how relevant it would be to provide a more minimal example as the issue may be elsewhere given the existence of this ticket: https://github.com/microsoft/playwright/issues/20576

The issue which you linked might look similar, but it was related to macOS and had a different root cause.

I see that you are using a beta-version, aka. next. Did Playwright ever work on your machine? Have you tried Stable?

Could you give us a "dump" of your environment variables by just executing "env"? Make sure to hide personal information there, since it could contain sensitive tokens etc.

NashJames commented 1 year ago

Yeah it was working no problem before. All tests passed just days ago.

I'm not sure if or how this could have affected it, but I updated from version 1.37.1 to 1.39.0 at some point over the weekend. I don't know if that was part of the reason at all. I went back and tested with the old version of the library and the error persisted so didn't mention it.

I actually haven't visited the project or even launched WSL in at least a few weeks so there's no updates to the environment that should have come into it.

Here's the dump ``` USER=root SHLVL=1 HOME=/root OLDPWD=/home/nashjames/Documents/Github/Holocron.io WSL_DISTRO_NAME=Ubuntu-18.04 LOGNAME=root WSL_INTEROP=/run/WSL/13_interop NAME=**************** _=/usr/bin/env TERM=xterm-256color PATH=/root/.vscode-server/bin/f1b07bd25dfad64b0167beb15359ae573aecd2cc/bin/remote-cli:/root/.nvm/versions/node/v18.16.1/bin:/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/mnt/c/ProgramData/Oracle/Java/javapath:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/Intel/WiFi/bin/:/mnt/c/Program Files/Common Files/Intel/WirelessCommon/:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Topaz Labs LLC/Topaz Video Enhance AI:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/Microsoft VS Code/bin:/mnt/c/Users/james/.cargo/bin:/mnt/c/Users/james/AppData/Local/pnpm:/mnt/d/Documents/Python 3.7.6/Scripts/:/mnt/d/Documents/Python 3.7.6/:/mnt/c/Users/james/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/james/AppData/Local/Microsoft/WindowsApps:/mnt/d/Users/james/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/james/AppData/Local/GitHubDesktop/bin:/mnt/c/Users/james/.deno/bin LANG=en_GB.UTF-8 SHELL=/bin/zsh PWD=/home/nashjames/Documents/Github/Holocron.io HOSTTYPE=x86_64 WSLENV=VSCODE_WSL_EXT_LOCATION/up NVM_DIR=/root/.nvm NVM_CD_FLAGS=-q NVM_BIN=/root/.nvm/versions/node/v18.16.1/bin NVM_INC=/root/.nvm/versions/node/v18.16.1/include/node LC_ALL=en_GB.UTF-8 STARSHIP_SHELL=zsh STARSHIP_SESSION_KEY=8227231672117532 TERM_PROGRAM=vscode TERM_PROGRAM_VERSION=1.83.1 COLORTERM=truecolor GIT_ASKPASS=/root/.vscode-server/bin/f1b07bd25dfad64b0167beb15359ae573aecd2cc/extensions/git/dist/askpass.sh VSCODE_GIT_ASKPASS_NODE=/root/.vscode-server/bin/f1b07bd25dfad64b0167beb15359ae573aecd2cc/node VSCODE_GIT_ASKPASS_EXTRA_ARGS= VSCODE_GIT_ASKPASS_MAIN=/root/.vscode-server/bin/f1b07bd25dfad64b0167beb15359ae573aecd2cc/extensions/git/dist/askpass-main.js VSCODE_GIT_IPC_HANDLE=/tmp/vscode-git-b8e619bc7b.sock VSCODE_IPC_HOOK_CLI=/tmp/vscode-ipc-37b95b68-28f3-4520-89a0-8e8d6b1bb5df.sock VSCODE_INJECTION=1 ZDOTDIR=/root USER_ZDOTDIR=/root ```
mxschmitt commented 1 year ago

WSL_DISTRO_NAME=Ubuntu-18.04 this looks suspicious, since we don't support Ubuntu 18 since a long time anymore. We recommend upgrading to Ubuntu 22.04.

NashJames commented 1 year ago

It's likely the name is unchanged because that was my original WSL version.

❯ lsb_release -a 
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:        20.04
Codename:       focal

However, I've upgraded to 22.04 anyway. All webkit tests now fail with:

    Error: browserType.launch: 
    ╔══════════════════════════════════════════════════════╗
    ║ Host system is missing dependencies to run browsers. ║
    ║ Please install them with the following command:      ║
    ║                                                      ║
    ║     pnpm exec playwright install-deps                ║
    ║                                                      ║
    ║ Alternatively, use apt:                              ║
    ║     apt-get install libwebp6                         ║
    ║                                                      ║
    ║ <3 Playwright Team                                   ║
    ╚══════════════════════════════════════════════════════╝

Steps I've tried: 1) pnpm exec playwright install-deps 2) apt-get install libwebp6 3) pnpm exec playwright install --force --with-deps chromium firefox webkit chrome msedge

mxschmitt commented 1 year ago

My rough guess is that the upgrade from Ubuntu 18.04 to 20.04 broke something somewhere and now WebKit is not able to launch anymore. Would it be possible to create a new Ubuntu 20.04/22.04 machine in WSL to see if the issue replicates there?

We saw this issue the first time, so this is mostly some configuration issue of the machine where Playwright is running on.

NashJames commented 1 year ago

So I've created an entirely new distro using Ubuntu-22.04, cloned the project, installed only the bare minimum to run the tests and it's still having issues. I get this for all webkits:

  15) [webkit] › components/FetchPlayground.spec.ts:83:7 › Easter Egg › Toast Hint Invisible ───────

    Error: browserContext.newPage: Target closed

  16) [webkit] › components/FetchPlayground.spec.ts:77:7 › Easter Egg › Toast Hint Visible ─────────

    Error: browserContext.newPage: Target closed

A real fun problem.

mxschmitt commented 1 year ago

So I've created an entirely new distro using Ubuntu-22.04, cloned the project, installed only the bare minimum to run the tests and it's still having issues. I get this for all webkits:


  15) [webkit] › components/FetchPlayground.spec.ts:83:7 › Easter Egg › Toast Hint Invisible ───────

    Error: browserContext.newPage: Target closed

  16) [webkit] › components/FetchPlayground.spec.ts:77:7 › Easter Egg › Toast Hint Visible ─────────

    Error: browserContext.newPage: Target closed

A real fun problem.

Did you do npx playwright install --with-deps?

Please also provide the output when setting DEBUG=pw:browser env var.

NashJames commented 1 year ago

Yep I did pnpm exec playwright install --force --with-deps chromium firefox webkit chrome msedge.

I've also just done it again to be extra sure it worked properly.

Debug logs ``` $ DEBUG=pw:browser,pw:protocol pnpm exec playwright test --config ./config/playwright.config.ts --project=webkit ./tests/e2e/components/AppHeader.spec.ts Running 2 tests using 2 workers [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:browser /home/james/.cache/ms-playwright/webkit-1921/pw_run.sh --inspector-pipe --headless --no-startup-window +0ms pw:browser pid=15399 +5ms pw:protocol SEND ► {"id":1,"method":"Playwright.enable"} +0ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:browser /home/james/.cache/ms-playwright/webkit-1921/pw_run.sh --inspector-pipe --headless --no-startup-window +0ms pw:browser pid=15528 +5ms pw:protocol SEND ► {"id":1,"method":"Playwright.enable"} +0ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:protocol ◀ RECV {"result":{},"id":1} +88ms pw:protocol SEND ► {"id":2,"method":"Playwright.createContext"} +7ms pw:protocol ◀ RECV {"result":{"browserContextId":"8000000000000002"},"id":2} +3ms pw:protocol SEND ► {"id":3,"method":"Playwright.setDownloadBehavior","params":{"behavior":"allow","downloadPath":"/tmp/playwright-artifacts-xSBGPj","browserContextId":"8000000000000002"}} +2ms pw:protocol SEND ► {"id":4,"method":"Playwright.setLanguages","params":{"browserContextId":"8000000000000002","languages":["en-US"]}} +0ms pw:protocol ◀ RECV {"result":{},"id":3} +0ms pw:protocol ◀ RECV {"result":{},"id":4} +1ms pw:protocol SEND ► {"id":5,"method":"Playwright.createPage","params":{"browserContextId":"8000000000000002"}} +12ms pw:protocol ◀ RECV {"method":"Playwright.pageProxyCreated","params":{"browserContextId":"8000000000000002","pageProxyId":"8"}} +5ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:protocol ◀ RECV {"result":{},"id":1} +95ms pw:protocol SEND ► {"id":2,"method":"Playwright.createContext"} +5ms pw:protocol ◀ RECV {"result":{"browserContextId":"8000000000000002"},"id":2} +3ms pw:protocol SEND ► {"id":3,"method":"Playwright.setDownloadBehavior","params":{"behavior":"allow","downloadPath":"/tmp/playwright-artifacts-z91avt","browserContextId":"8000000000000002"}} +1ms pw:protocol SEND ► {"id":4,"method":"Playwright.setLanguages","params":{"browserContextId":"8000000000000002","languages":["en-US"]}} +0ms pw:protocol ◀ RECV {"result":{},"id":3} +0ms pw:protocol ◀ RECV {"result":{},"id":4} +1ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:browser [pid=15399][err] EGLDisplay Initialization failed: EGL_NOT_INITIALIZED +195ms pw:browser [pid=15399][err] Could not determine the accessibility bus address +0ms pw:protocol ◀ RECV {"method":"Target.targetCreated","params":{"targetInfo":{"targetId":"page-9","type":"page","isPaused":true}},"browserContextId":"8000000000000002","pageProxyId":"8"} +72ms pw:protocol SEND ► {"id":6,"method":"Dialog.enable","pageProxyId":"8"} +1ms pw:protocol SEND ► {"id":7,"method":"Emulation.setActiveAndFocused","params":{"active":true},"pageProxyId":"8"} +0ms pw:protocol SEND ► {"id":8,"method":"Emulation.setDeviceMetricsOverride","params":{"width":1280,"height":720,"fixedLayout":false,"deviceScaleFactor":2},"pageProxyId":"8"} +1ms pw:protocol SEND ► {"id":10,"method":"Target.sendMessageToTarget","params":{"message":"{\"id\":9,\"method\":\"Page.setScreenSizeOverride\",\"params\":{\"width\":1280,\"height\":720}}","targetId":"page-9"},"pageProxyId":"8"} +0ms pw:protocol SEND ► {"id":11,"method":"Emulation.setAuthCredentials","params":{"username":"","password":"","origin":""},"pageProxyId":"8"} +1ms pw:protocol SEND ► {"id":13,"method":"Target.sendMessageToTarget","params":{"message":"{\"id\":12,\"method\":\"Page.enable\"}","targetId":"page-9"},"pageProxyId":"8"} +0ms pw:protocol SEND ► {"id":15,"method":"Target.sendMessageToTarget","params":{"message":"{\"id\":14,\"method\":\"Page.getResourceTree\"}","targetId":"page-9"},"pageProxyId":"8"} +1ms pw:protocol ◀ RECV {"result":{"pageProxyId":"8"},"id":5} +0ms pw:protocol ◀ RECV {"result":{},"id":6,"browserContextId":"8000000000000002","pageProxyId":"8"} +1ms pw:protocol ◀ RECV {"result":{},"id":7,"browserContextId":"8000000000000002","pageProxyId":"8"} +0ms pw:protocol ◀ RECV {"result":{},"id":8,"browserContextId":"8000000000000002","pageProxyId":"8"} +0ms pw:protocol ◀ RECV {"result":{},"id":10,"browserContextId":"8000000000000002","pageProxyId":"8"} +0ms pw:protocol ◀ RECV {"result":{},"id":11,"browserContextId":"8000000000000002","pageProxyId":"8"} +0ms pw:protocol ◀ RECV {"result":{},"id":13,"browserContextId":"8000000000000002","pageProxyId":"8"} +0ms pw:protocol ◀ RECV {"result":{},"id":15,"browserContextId":"8000000000000002","pageProxyId":"8"} +1ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:protocol SEND ► {"id":5,"method":"Playwright.createPage","params":{"browserContextId":"8000000000000002"}} +9ms pw:protocol ◀ RECV {"method":"Playwright.pageProxyCreated","params":{"browserContextId":"8000000000000002","pageProxyId":"8"}} +5ms pw:browser [pid=15528][err] EGLDisplay Initialization failed: EGL_NOT_INITIALIZED +185ms pw:browser [pid=15528][err] Could not determine the accessibility bus address +0ms pw:protocol ◀ RECV {"method":"Target.targetCreated","params":{"targetInfo":{"targetId":"page-9","type":"page","isPaused":true}},"browserContextId":"8000000000000002","pageProxyId":"8"} +65ms pw:protocol SEND ► {"id":6,"method":"Dialog.enable","pageProxyId":"8"} +0ms pw:protocol SEND ► {"id":7,"method":"Emulation.setActiveAndFocused","params":{"active":true},"pageProxyId":"8"} +1ms pw:protocol SEND ► {"id":8,"method":"Emulation.setDeviceMetricsOverride","params":{"width":1280,"height":720,"fixedLayout":false,"deviceScaleFactor":2},"pageProxyId":"8"} +0ms pw:protocol SEND ► {"id":10,"method":"Target.sendMessageToTarget","params":{"message":"{\"id\":9,\"method\":\"Page.setScreenSizeOverride\",\"params\":{\"width\":1280,\"height\":720}}","targetId":"page-9"},"pageProxyId":"8"} +0ms pw:protocol SEND ► {"id":11,"method":"Emulation.setAuthCredentials","params":{"username":"","password":"","origin":""},"pageProxyId":"8"} +0ms pw:protocol SEND ► {"id":13,"method":"Target.sendMessageToTarget","params":{"message":"{\"id\":12,\"method\":\"Page.enable\"}","targetId":"page-9"},"pageProxyId":"8"} +1ms pw:protocol SEND ► {"id":15,"method":"Target.sendMessageToTarget","params":{"message":"{\"id\":14,\"method\":\"Page.getResourceTree\"}","targetId":"page-9"},"pageProxyId":"8"} +0ms pw:protocol ◀ RECV {"result":{"pageProxyId":"8"},"id":5} +0ms pw:protocol ◀ RECV {"result":{},"id":6,"browserContextId":"8000000000000002","pageProxyId":"8"} +1ms pw:protocol ◀ RECV {"result":{},"id":7,"browserContextId":"8000000000000002","pageProxyId":"8"} +0ms pw:protocol ◀ RECV {"result":{},"id":8,"browserContextId":"8000000000000002","pageProxyId":"8"} +0ms pw:protocol ◀ RECV {"result":{},"id":10,"browserContextId":"8000000000000002","pageProxyId":"8"} +0ms pw:protocol ◀ RECV {"result":{},"id":11,"browserContextId":"8000000000000002","pageProxyId":"8"} +0ms pw:protocol ◀ RECV {"result":{},"id":13,"browserContextId":"8000000000000002","pageProxyId":"8"} +0ms pw:protocol ◀ RECV {"result":{},"id":15,"browserContextId":"8000000000000002","pageProxyId":"8"} +0ms pw:protocol ◀ RECV {"method":"Target.targetDestroyed","params":{"targetId":"page-9","crashed":true},"browserContextId":"8000000000000002","pageProxyId":"8"} +556ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:protocol ◀ RECV {"method":"Target.targetDestroyed","params":{"targetId":"page-9","crashed":true},"browserContextId":"8000000000000002","pageProxyId":"8"} +631ms pw:protocol SEND ► {"id":16,"method":"Target.resume","params":{"targetId":"page-9"},"pageProxyId":"8"} +3ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:protocol SEND ► {"id":16,"method":"Target.resume","params":{"targetId":"page-9"},"pageProxyId":"8"} +3ms pw:protocol ◀ RECV {"error":{"code":-32000,"message":"Missing target for given targetId","data":[{"code":-32000,"message":"Missing target for given targetId"}]},"id":16,"browserContextId":"8000000000000002","pageProxyId":"8"} +7ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:protocol ◀ RECV {"error":{"code":-32000,"message":"Missing target for given targetId","data":[{"code":-32000,"message":"Missing target for given targetId"}]},"id":16,"browserContextId":"8000000000000002","pageProxyId":"8"} +7ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:protocol SEND ► {"id":17,"method":"Playwright.deleteContext","params":{"browserContextId":"8000000000000002"}} +1ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:protocol SEND ► {"id":17,"method":"Playwright.deleteContext","params":{"browserContextId":"8000000000000002"}} +1ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:browser [pid=15528][err] +571ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:browser [pid=15399][err] +649ms pw:browser [pid=15399][err] (MiniBrowser:15423): GLib-GIO-CRITICAL **: 13:31:15.659: g_application_quit: assertion 'G_IS_APPLICATION (application)' failed +1ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:browser [pid=15528][err] (MiniBrowser:15537): GLib-GIO-CRITICAL **: 13:31:15.659: g_application_quit: assertion 'G_IS_APPLICATION (application)' failed +1ms pw:protocol ◀ RECV {"method":"Playwright.pageProxyDestroyed","params":{"pageProxyId":"8"}} +1ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:protocol ◀ RECV {"method":"Playwright.pageProxyDestroyed","params":{"pageProxyId":"8"}} +1ms pw:protocol ◀ RECV {"result":{},"id":17} +1ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:protocol ◀ RECV {"result":{},"id":17} +1ms pw:browser [pid=15528] +7ms pw:protocol ◀ RECV {"result":{},"id":-9999} +7ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:browser [pid=15399] +9ms pw:protocol ◀ RECV {"result":{},"id":-9999} +9ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:browser [pid=15528] +6ms pw:browser [pid=15528] starting temporary directories cleanup +0ms [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:browser [pid=15399] +5ms pw:browser [pid=15399] starting temporary directories cleanup +0ms [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository pw:browser [pid=15528] finished temporary directories cleanup +1ms pw:browser [pid=15528] +0ms 1) [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository ─────────────────── Error: browserContext.newPage: Target closed [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives pw:browser [pid=15399] finished temporary directories cleanup +1ms pw:browser [pid=15399] +0ms 2) [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives ─────────────────────── Error: browserContext.newPage: Target closed 2 failed [webkit] › components/AppHeader.spec.ts:14:7 › NavLinks › Data Archives ──────────────────────── [webkit] › components/AppHeader.spec.ts:23:7 › NavLinks › GitHub Repository ──────────────────── Serving HTML report at http://localhost:9323. Press Ctrl+C to quit. ```
mxschmitt commented 1 year ago

I tried to run your repro repository on my Ubuntu 20 and 22 machine and it was working without any issues.

The fact that it was working at some point on your environment, and then without changing the underlying Playwright version it stopped working, might mean that some other external factor is influencing it. (if I understand it correctly from your comments above in https://github.com/microsoft/playwright/issues/27615#issuecomment-1765147620)

We unfortunately run out of ideas! I also tried WSL2 on Windows 11 with your repository and it was working without any issues.

NashJames commented 1 year ago

I can't imagine what has affected it. Especially after trying on an entirely new WSL2 instance. The only difference left compared to your test would be that I'm on Win10, but that shouldn't be a factor.

If I figure out a solution, I'll drop an update here. Thanks for trying. Do let me know if you think of anything else.

yury-s commented 11 months ago

Closing as part of the triage process. We need to be able to reproduce the problem to make this report actionable. Feel free to open a new issue if you have a repro.

morganney commented 9 months ago

Fresh install of OS. Fresh install of Playwright. I ran npx install playwright --with-deps. Only way to get webkit tests to pass is to run in --headed mode.

morgan@machine:~/code/busmap(develop)$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.2 LTS
Release:    22.04
Codename:   jammy
morgan@machine:~/code/busmap(develop)$ uname -m
x86_64
morgan@machine:~/code/busmap(develop)$ ./node_modules/.bin/playwright --version
Version 1.41.1
morgan@machine:~/code/busmap(develop)$ ./node_modules/.bin/playwright test --project=webkit tests/geolocation/omnitrans.spec.ts 

Running 1 test using 1 worker

  ✘  1 [webkit] › geolocation/omnitrans.spec.ts:11:1 › Nearby stops for OmniTrans. (1.0s)

  1) [webkit] › geolocation/omnitrans.spec.ts:11:1 › Nearby stops for OmniTrans. ───────────────────

    Error: browserContext.newPage: Target page, context or browser has been closed

  1 failed
    [webkit] › geolocation/omnitrans.spec.ts:11:1 › Nearby stops for OmniTrans. ────────────────────
morgan@machine:~/code/busmap(develop)$ ./node_modules/.bin/playwright test --project=webkit --headed tests/geolocation/omnitrans.spec.ts 

Running 1 test using 1 worker

  ✓  1 [webkit] › geolocation/omnitrans.spec.ts:11:1 › Nearby stops for OmniTrans. (4.2s)

  1 passed (5.2s)
morgan@machine:~/code/busmap(develop)$ env
SHELL=/bin/bash
SESSION_MANAGER=local/machine:@/tmp/.ICE-unix/2083,unix/machine:/tmp/.ICE-unix/2083
QT_ACCESSIBILITY=1
COLORTERM=truecolor
XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
SSH_AGENT_LAUNCHER=gnome-keyring
XDG_MENU_PREFIX=gnome-
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
LANGUAGE=en
LC_ADDRESS=en_US.UTF-8
GNOME_SHELL_SESSION_MODE=ubuntu
LC_NAME=en_US.UTF-8
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
XMODIFIERS=@im=ibus
DESKTOP_SESSION=ubuntu
LC_MONETARY=en_US.UTF-8
GTK_MODULES=gail:atk-bridge
PWD=/home/morgan/code/busmap
LOGNAME=morgan
XDG_SESSION_DESKTOP=ubuntu
XDG_SESSION_TYPE=wayland
SYSTEMD_EXEC_PID=64589
XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.8HAHI2
HOME=/home/morgan
USERNAME=morgan
IM_CONFIG_PHASE=1
LC_PAPER=en_US.UTF-8
LANG=en_US.UTF-8
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
XDG_CURRENT_DESKTOP=ubuntu:GNOME
VTE_VERSION=6800
N_PREFIX=/home/morgan/n
WAYLAND_DISPLAY=wayland-0
GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/e5ae1f4a_0340_4dfa_b809_3a96e0dc6b8b
GNOME_SETUP_DISPLAY=:1
LESSCLOSE=/usr/bin/lesspipe %s %s
XDG_SESSION_CLASS=user
TERM=xterm-256color
LC_IDENTIFICATION=en_US.UTF-8
LESSOPEN=| /usr/bin/lesspipe %s
USER=morgan
GNOME_TERMINAL_SERVICE=:1.561
DISPLAY=:0
SHLVL=1
LC_TELEPHONE=en_US.UTF-8
QT_IM_MODULE=ibus
LC_MEASUREMENT=en_US.UTF-8
PAPERSIZE=letter
XDG_RUNTIME_DIR=/run/user/1000
LC_TIME=en_US.UTF-8
XDG_DATA_DIRS=/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/morgan/n/bin
GDMSESSION=ubuntu
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
LC_NUMERIC=en_US.UTF-8
_=/usr/bin/env

This does not happen during a GitHub Action run: https://github.com/morganney/busmap/actions/runs/7647438352/job/20838349686

mxschmitt commented 9 months ago

Could you try: npm init playwright mytestproject && cd mytestproject && npx playwright test?

Could you try DISPLAY= npx playwright test as per https://github.com/microsoft/playwright/issues/18255#issuecomment-1438066002? Looks related!

morganney commented 9 months ago

@mxschmitt thanks for the suggestion. Here are the results, neither worked:

morgan@machine:~/code/busmap(develop)$ DISPLAY= ./node_modules/.bin/playwright test --project=webkit tests/geolocation/omnitrans.spec.ts 

Running 1 test using 1 worker

  ✘  1 [webkit] › geolocation/omnitrans.spec.ts:11:1 › Nearby stops for OmniTrans. (694ms)

  1) [webkit] › geolocation/omnitrans.spec.ts:11:1 › Nearby stops for OmniTrans. ───────────────────

    Error: browserContext.newPage: Target page, context or browser has been closed

  1 failed
    [webkit] › geolocation/omnitrans.spec.ts:11:1 › Nearby stops for OmniTrans. ────────────────────

And for the new project:

morgan@machine:~/code$ npm init playwright mytestproject
Need to install the following packages:
create-playwright@1.17.131
Ok to proceed? (y) y
Getting started with writing end-to-end tests with Playwright:
Initializing project in 'mytestproject'
✔ Do you want to use TypeScript or JavaScript? · JavaScript
✔ Where to put your end-to-end tests? · tests
✔ Add a GitHub Actions workflow? (y/N) · true
✔ Install Playwright browsers (can be done manually via 'npx playwright install')? (Y/n) · false
✔ Install Playwright operating system dependencies (requires sudo / root - can be done manually via 'sudo npx playwright install-deps')? (y/N) · false
Initializing NPM project (npm init -y)…
Wrote to /home/morgan/code/mytestproject/package.json:

{
  "name": "mytestproject",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}

Installing Playwright Test (npm install --save-dev @playwright/test)…

added 3 packages, and audited 4 packages in 2s

found 0 vulnerabilities
Installing Types (npm install --save-dev @types/node)…

added 2 packages, and audited 6 packages in 1s

found 0 vulnerabilities
Writing mytestproject/playwright.config.js.
Writing mytestproject/.github/workflows/playwright.yml.
Writing mytestproject/tests/example.spec.js.
Writing mytestproject/tests-examples/demo-todo-app.spec.js.
Writing mytestproject/package.json.
✔ Success! Created a Playwright Test project at /home/morgan/code/mytestproject

Inside that directory, you can run several commands:

  npx playwright test
    Runs the end-to-end tests.

  npx playwright test --ui
    Starts the interactive UI mode.

  npx playwright test --project=chromium
    Runs the tests only on Desktop Chrome.

  npx playwright test example
    Runs the tests in a specific file.

  npx playwright test --debug
    Runs the tests in debug mode.

  npx playwright codegen
    Auto generate tests with Codegen.

We suggest that you begin by typing:

    cd mytestproject
  npx playwright test

And check out the following files:
  - ./mytestproject/tests/example.spec.js - Example end-to-end test
  - ./mytestproject/tests-examples/demo-todo-app.spec.js - Demo Todo App end-to-end tests
  - ./mytestproject/playwright.config.js - Playwright Test configuration

Visit https://playwright.dev/docs/intro for more information. ✨

Happy hacking! 🎭
morgan@machine:~/code$ ls
busmap  mytestproject
morgan@machine:~/code$ cd mytestproject/
morgan@machine:~/code/mytestproject$ npx playwright test

Running 6 tests using 6 workers
  1) [webkit] › example.spec.js:11:1 › get started link ────────────────────────────────────────────

    Error: browserContext.newPage: Target page, context or browser has been closed

  2) [webkit] › example.spec.js:4:1 › has title ────────────────────────────────────────────────────

    Error: browserContext.newPage: Target page, context or browser has been closed

  2 failed
    [webkit] › example.spec.js:4:1 › has title ─────────────────────────────────────────────────────
    [webkit] › example.spec.js:11:1 › get started link ─────────────────────────────────────────────
  4 passed (4.3s)

  Serving HTML report at http://localhost:9323. Press Ctrl+C to quit.
mxschmitt commented 9 months ago

Could you try running as root? Might be a permission problem.

morganney commented 9 months ago

Hmm, doesn't appear to be a permissions problem. I didn't want to install the browsers again under the root user, and had to specify the path to the node binary, but still not working:

root@machine:/home/morgan/code/busmap# PLAYWRIGHT_BROWSERS_PATH=/home/morgan/.cache/ms-playwright /home/morgan/n/bin/node ./node_modules/.bin/playwright test --project=webkit tests/geolocation/omnitrans.spec.ts 

Running 1 test using 1 worker

  ✘  1 [webkit] › geolocation/omnitrans.spec.ts:11:1 › Nearby stops for OmniTrans. (977ms)

  1) [webkit] › geolocation/omnitrans.spec.ts:11:1 › Nearby stops for OmniTrans. ───────────────────

    Error: browserContext.newPage: Target page, context or browser has been closed

  1 failed
    [webkit] › geolocation/omnitrans.spec.ts:11:1 › Nearby stops for OmniTrans. ────────────────────

I appreciate you trying to help, nevertheless.

FWIW, here's the machine's specs: https://system76.com/laptops/lemur#specs

ysris commented 3 weeks ago

I came here for a similar issue (first google result) after updating my mac to macos 15 (Sequoia). In case somebody else is here for the same reason, here is how I fixed the issue.

Apparently, there are modifications made by apple on this update that broke the ability to open chromium (and possibly other browsers) from an integration test from console playwright client or vscode extension.

I could fix that by using :

And after that, in vscode,

After that, tests can run again. Note that, in my case, trying to reinstall the browsers from shell didn't work, I had to do this from vscode.

TheDutchCoder commented 3 weeks ago

I also have this issue after upgrading MacOS to Sequoia, really hard to figure out what the issue is.