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
67.11k stars 3.69k forks source link

[Bug]: ProtocolError when running the UI #33707

Open pereriksson opened 1 day ago

pereriksson commented 1 day ago

Version

1.48.0

Steps to reproduce

This is an intermittent issue. Usually it happens when switching to the Playwright UI in the Dock on macOS.

Expected behavior

That the UI does not crash when switching applications

Actual behavior

The UI crashes with a ProtocolError.

`% yarn test
yarn run v1.22.19
$ playwright test --ui
/Users/per/git/playwright-demo/node_modules/playwright-core/lib/server/chromium/crConnection.js:129
    if (this._crashed || this._closed || this._connection._closed || this._connection._browserDisconnectedLogs) throw new _protocolError.ProtocolError(this._crashed ? 'crashed' : 'closed', undefined, this._connection._browserDisconnectedLogs);
                                                                                                                      ^

ProtocolError: 
    at CRSession.send (/Users/per/git/playwright-demo/node_modules/playwright-core/lib/server/chromium/crConnection.js:129:119)
    at CRPage.bringToFront (/Users/per/git/playwright-demo/node_modules/playwright-core/lib/server/chromium/crPage.js:185:42)
    at Page.bringToFront (/Users/per/git/playwright-demo/node_modules/playwright-core/lib/server/page.js:385:26)
    at CRBrowserContext.<anonymous> (/Users/per/git/playwright-demo/node_modules/playwright-core/lib/server/launchApp.js:51:20)
    at CRBrowserContext.emit (node:events:515:28)
    at Page.emitOnContext (/Users/per/git/playwright-demo/node_modules/playwright-core/lib/server/page.js:128:26)
    at Page.reportAsNew (/Users/per/git/playwright-demo/node_modules/playwright-core/lib/server/page.js:111:10)
    at CRPage._reportAsNew (/Users/per/git/playwright-demo/node_modules/playwright-core/lib/server/chromium/crPage.js:129:16)
    at /Users/per/git/playwright-demo/node_modules/playwright-core/lib/server/chromium/crPage.js:118:12 {
  type: 'crashed',
  method: undefined,
  logs: undefined
}

Node.js v21.1.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`

Additional context

No response

Environment

System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M1
    Memory: 71.28 MB / 16.00 GB
  Binaries:
    Node: 21.1.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.8.3 - /usr/local/bin/npm
    pnpm: 8.6.6 - ~/Library/pnpm/pnpm
  Languages:
    Bash: 3.2.57 - /bin/bash
  npmPackages:
    @playwright/test: ^1.47.2 => 1.48.0
dgozman commented 22 hours ago

@pereriksson I tried to reproduce but it works for me locally. Is there anything specific in your setup? Could you share a small repro that triggers this problem? Additionally, I'd recommend running as DEBUG=pw:browser npx playwright test --ui to collect browser logs and post them here - in case we can see the reason for the crash.