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,
|
denyLaunch: true,
|
||||||
dispose: async () => {
|
dispose: async () => {
|
||||||
// Don't close the pages so that user could debug them,
|
// Don't close the pages so that user could debug them,
|
||||||
// but close all the empty browsers and contexts to clean up.
|
// but close all the empty contexts to clean up.
|
||||||
for (const browser of this._playwright.allBrowsers()) {
|
// keep around browser so it can be reused by the next connection.
|
||||||
for (const context of browser.contexts()) {
|
for (const context of browser.contexts()) {
|
||||||
if (!context.pages().length)
|
if (!context.pages().length)
|
||||||
await context.close({ reason: 'Connection terminated' });
|
await context.close({ reason: 'Connection terminated' });
|
||||||
else
|
else
|
||||||
await context.stopPendingOperations('Connection closed');
|
await context.stopPendingOperations('Connection closed');
|
||||||
}
|
|
||||||
if (!browser.contexts())
|
|
||||||
await browser.close({ reason: 'Connection terminated' });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue