Fix tests with proper promise chain

This commit is contained in:
Yuya Ochiai
2018-02-02 22:45:54 +09:00
parent abfe5f1ae8
commit 88e6dd9de0
6 changed files with 190 additions and 65 deletions

View File

@@ -54,8 +54,12 @@ describe('application', function desc() {
// webview is handled as a window by chromedriver.
return this.app.client.
windowByIndex(1).isNodeEnabled().then((enabled) => enabled.should.be.false).
windowByIndex(2).isNodeEnabled().then((enabled) => enabled.should.be.false).
windowByIndex(1).isNodeEnabled().then((enabled) => {
enabled.should.be.false;
}).
windowByIndex(2).isNodeEnabled().then((enabled) => {
enabled.should.be.false;
}).
windowByIndex(0).
getAttribute('webview', 'nodeintegration').then((nodeintegration) => {
// nodeintegration is an array of string
@@ -78,7 +82,9 @@ describe('application', function desc() {
return handles.value.length === 4;
});
}, 5000, 'expected a new window').
windowByIndex(3).isNodeEnabled().then((enabled) => enabled.should.be.false);
windowByIndex(3).isNodeEnabled().then((enabled) => {
enabled.should.be.false;
});
});
it('should NOT be able to call eval() in any window', () => {
@@ -90,7 +96,9 @@ describe('application', function desc() {
return eval('1 + 1');
}).then((result) => {
throw new Error(`Promise was unexpectedly fulfilled (result: ${result})`);
}, (error) => (error !== null).should.be.true);
}, (error) => {
(error !== null).should.be.true;
});
};
const tryEvalInSettingsPage = () => {
return this.app.client.
@@ -100,7 +108,9 @@ describe('application', function desc() {
return eval('1 + 1');
}).then((result) => {
throw new Error(`Promise was unexpectedly fulfilled (result: ${result})`);
}, (error) => (error !== null).should.be.true);
}, (error) => {
(error !== null).should.be.true;
});
};
return Promise.all([
tryEval(0),