From 882fa36940fc5846a4c72b1c73a4ccc3ac146437 Mon Sep 17 00:00:00 2001 From: Samuel Maddock Date: Mon, 6 Jun 2022 17:39:58 -0400 Subject: [PATCH] test: fix for flaky renderer crash test (#34452) --- spec-main/api-web-frame-main-spec.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec-main/api-web-frame-main-spec.ts b/spec-main/api-web-frame-main-spec.ts index bf3106a6efb7..8890e1402f52 100644 --- a/spec-main/api-web-frame-main-spec.ts +++ b/spec-main/api-web-frame-main-spec.ts @@ -230,7 +230,9 @@ describe('webFrameMain module', () => { // Keep reference to mainFrame alive throughout crash and recovery. const { mainFrame } = w.webContents; await w.webContents.loadURL(server.url); + const crashEvent = emittedOnce(w.webContents, 'render-process-gone'); w.webContents.forcefullyCrashRenderer(); + await crashEvent; await w.webContents.loadURL(server.url); // Log just to keep mainFrame in scope. console.log('mainFrame.url', mainFrame.url); @@ -244,7 +246,9 @@ describe('webFrameMain module', () => { // Keep reference to mainFrame alive throughout crash and recovery. const { mainFrame } = w.webContents; await w.webContents.loadURL(server.url); + const crashEvent = emittedOnce(w.webContents, 'render-process-gone'); w.webContents.forcefullyCrashRenderer(); + await crashEvent; // A short wait seems to be required to reproduce the crash. await new Promise(resolve => setTimeout(resolve, 100)); await w.webContents.loadURL(crossOriginUrl);