From 8c1b5311fda504cf0eb06c548717b21f0f401fc9 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Tue, 15 Jan 2019 13:22:24 -0800 Subject: [PATCH] robustify async webview test --- spec/webview-spec.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/webview-spec.js b/spec/webview-spec.js index a308ef369570..1eb02e28f604 100644 --- a/spec/webview-spec.js +++ b/spec/webview-spec.js @@ -1332,10 +1332,12 @@ describe(' tag', function () { nodeIntegration: true } }) + const didAttachWebview = emittedOnce(w.webContents, 'did-attach-webview') + const webviewDomReady = emittedOnce(ipcMain, 'webview-dom-ready') w.loadFile(path.join(fixtures, 'pages', 'webview-did-attach-event.html')) - const [, webContents] = await emittedOnce(w.webContents, 'did-attach-webview') - const [, id] = await emittedOnce(ipcMain, 'webview-dom-ready') + const [, webContents] = await didAttachWebview + const [, id] = await webviewDomReady expect(webContents.id).to.equal(id) }) })