mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix: electron video tests (#28004)
This commit is contained in:
parent
cb14de7a5b
commit
e788c711c6
@ -525,7 +525,7 @@ export class CRBrowserContext extends BrowserContext {
|
||||
await Promise.all(openedBeforeUnloadDialogs.map(dialog => dialog.dismiss()));
|
||||
|
||||
if (!this._browserContextId) {
|
||||
await Promise.all(this._crPages().map(crPage => crPage._mainFrameSession._stopVideoRecording()));
|
||||
await this.stopVideoRecording();
|
||||
// Closing persistent context should close the browser.
|
||||
await this._browser.close({ reason });
|
||||
return;
|
||||
@ -545,6 +545,10 @@ export class CRBrowserContext extends BrowserContext {
|
||||
}
|
||||
}
|
||||
|
||||
async stopVideoRecording() {
|
||||
await Promise.all(this._crPages().map(crPage => crPage._mainFrameSession._stopVideoRecording()));
|
||||
}
|
||||
|
||||
onClosePersistent() {
|
||||
// When persistent context is closed, we do not necessary get Target.detachedFromTarget
|
||||
// for all the background pages.
|
||||
|
||||
@ -78,6 +78,7 @@ export class ElectronApplication extends SdkObject {
|
||||
});
|
||||
});
|
||||
this._browserContext.setCustomCloseHandler(async () => {
|
||||
await this._browserContext.stopVideoRecording();
|
||||
const electronHandle = await this._nodeElectronHandlePromise;
|
||||
await electronHandle.evaluate(({ app }) => app.quit()).catch(() => {});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user