Browse Source

robustify async webview test

Jeremy Apthorp 6 years ago
parent
commit
8c1b5311fd
1 changed files with 4 additions and 2 deletions
  1. 4 2
      spec/webview-spec.js

+ 4 - 2
spec/webview-spec.js

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