mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore: don't close other browsers in reuse-browsers mode (#36383)
Signed-off-by: Simon Knott <info@simonknott.de> Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
This commit is contained in:
parent
41bcfc9986
commit
ed7e552006
@ -210,16 +210,13 @@ export class PlaywrightServer {
|
||||
denyLaunch: true,
|
||||
dispose: async () => {
|
||||
// Don't close the pages so that user could debug them,
|
||||
// but close all the empty browsers and contexts to clean up.
|
||||
for (const browser of this._playwright.allBrowsers()) {
|
||||
for (const context of browser.contexts()) {
|
||||
if (!context.pages().length)
|
||||
await context.close({ reason: 'Connection terminated' });
|
||||
else
|
||||
await context.stopPendingOperations('Connection closed');
|
||||
}
|
||||
if (!browser.contexts())
|
||||
await browser.close({ reason: 'Connection terminated' });
|
||||
// but close all the empty contexts to clean up.
|
||||
// keep around browser so it can be reused by the next connection.
|
||||
for (const context of browser.contexts()) {
|
||||
if (!context.pages().length)
|
||||
await context.close({ reason: 'Connection terminated' });
|
||||
else
|
||||
await context.stopPendingOperations('Connection closed');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user