From 9e6d6fcfdb82b07af5fbfae481be595399d1cfae Mon Sep 17 00:00:00 2001 From: Yuya Ochiai Date: Sat, 25 Jun 2016 22:09:37 +0900 Subject: [PATCH] Wait until a new window is opened --- test/specs/security_test.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/specs/security_test.js b/test/specs/security_test.js index fc8ce26b..821880f0 100644 --- a/test/specs/security_test.js +++ b/test/specs/security_test.js @@ -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; }) });