Browse Source

test: fix flake in will-navigate test (#36167)

Co-authored-by: Jeremy Rose <[email protected]>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <[email protected]>
trop[bot] 2 years ago
parent
commit
b2ca7f9c05
1 changed files with 4 additions and 4 deletions
  1. 4 4
      spec-main/api-browser-window-spec.ts

+ 4 - 4
spec-main/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();
         });