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

Co-authored-by: Jeremy Rose <jeremya@chromium.org>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
This commit is contained in:
trop[bot]
2022-10-27 14:07:07 -04:00
committed by GitHub
parent a75e369e9c
commit 47bc841d6c

View File

@@ -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();
});