Browse Source

test: guarantee the order of webview and devtools creation (#14849)

Samuel Attard 6 years ago
parent
commit
b42493e6e6
1 changed files with 5 additions and 3 deletions
  1. 5 3
      spec/api-web-contents-spec.js

+ 5 - 3
spec/api-web-contents-spec.js

@@ -46,14 +46,16 @@ describe('webContents module', () => {
 
         assert.ok(all.length >= 4)
         assert.strictEqual(all[0].getType(), 'window')
-        assert.strictEqual(all[all.length - 2].getType(), 'remote')
-        assert.strictEqual(all[all.length - 1].getType(), 'webview')
+        assert.strictEqual(all[all.length - 2].getType(), 'webview')
+        assert.strictEqual(all[all.length - 1].getType(), 'remote')
 
         done()
       })
 
       w.loadFile(path.join(fixtures, 'pages', 'webview-zoom-factor.html'))
-      w.webContents.openDevTools()
+      w.webContents.on('did-attach-webview', () => {
+        w.webContents.openDevTools()
+      })
     })
   })