robustify async webview test

This commit is contained in:
Jeremy Apthorp 2019-01-15 13:22:24 -08:00
parent 6d4480ea6b
commit 8c1b5311fd

View file

@ -1332,10 +1332,12 @@ describe('<webview> 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)
})
})