Wait until a new window is opened

This commit is contained in:
Yuya Ochiai
2016-06-25 22:09:37 +09:00
parent 98b6ce8760
commit 9e6d6fcfdb

View File

@@ -64,12 +64,17 @@ describe('application', function() {
it('should NOT be able to call Node.js API in a new window', function() {
env.addClientCommands(this.app.client);
const client = this.app.client;
return this.app.client
.execute(function() {
const webview = document.querySelector('webview');
webview.executeJavaScript('open_window();');
})
.pause(1000) // wait for the new window
.waitUntil(function async() {
return client.windowHandles().then((handles) => {
return handles.value.length === 4;
});
}, 5000, 'expected a new window')
.windowByIndex(3).isNodeEnabled().should.eventually.be.false;
})
});