-
Notifications
You must be signed in to change notification settings - Fork 4.9k
fix: throw pretty error if opening userDataDir twice #36007
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
fix: throw pretty error if opening userDataDir twice #36007
Conversation
79f0638 to
a2231b6
Compare
| }); | ||
| }); | ||
|
|
||
| test('should throw when connecting twice to an already running persistent context (--remote-debugging-port)', async ({ browserType, channel, createUserDataDir }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't we connect to the same instance twice without trying to recreate the user-data-dir?
This comment has been minimized.
This comment has been minimized.
| const wsEndpoint = (await readyState?.waitUntilReady())?.wsEndpoint; | ||
| if (options.cdpPort !== undefined || !this.supportsPipeTransport()) { | ||
| transport = await WebSocketTransport.connect(progress, wsEndpoint!); | ||
| if (!wsEndpoint) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is related to wsEndpoint. We should rather throw if the browser is launched with the same profile more than once. Saying "Browser with the given profile is already running".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the browser is launched with the same profile more than once
This is written to the stderr by the browser but only for Chrome/Edge. Normal Chromium allows opening it multiple times. The error I throw contains this message as well, since the stderr is wrapped inside it.
This comment has been minimized.
This comment has been minimized.
d10ace0 to
f0f3592
Compare
f0f3592 to
496faf7
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
eb25825 to
77afbd1
Compare
Test results for "tests 1"3 failed 8 flaky39246 passed, 827 skipped Merge workflow run. |
Test results for "tests others"18 failed 5 flaky22003 passed, 527 skipped Merge workflow run. |
Test results for "tests 2"20 failed 183 flaky239978 passed, 9434 skipped Merge workflow run. |
What happened?
In the scenario of that a persistent browser profile is already used, the browser is directly exiting with an error message to stderr. This only happens with Chrome/Edge. Not with normal Chromium.
When that happens, we resolve the readyState to undefined. This will then resolve the wsEndpoint and try to connect to it even tho its
undefined.Relates microsoft/playwright-mcp#366 (does not fix it but throws a better error now)