From 07530f8e37060fc58991224e7d027614bffb4721 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Thu, 27 Oct 2022 06:29:19 -0700 Subject: [PATCH] test: fix flake in will-navigate test (#36153) --- spec/api-browser-window-spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 1edc690465de..85fc5f229a49 100644 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -567,6 +567,10 @@ describe('BrowserWindow module', () => { targetId: iframeTarget.targetId, flatten: true }); + let willNavigateEmitted = false; + w.webContents.on('will-navigate', () => { + willNavigateEmitted = true; + }); await w.webContents.debugger.sendCommand('Input.dispatchMouseEvent', { type: 'mousePressed', x: 10, @@ -581,10 +585,6 @@ describe('BrowserWindow module', () => { clickCount: 1, button: 'left' }, sessionId); - let willNavigateEmitted = false; - w.webContents.on('will-navigate', () => { - willNavigateEmitted = true; - }); await emittedOnce(w.webContents, 'did-navigate'); expect(willNavigateEmitted).to.be.true(); });