Fix tests with proper promise chain
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
"max-nested-callbacks": 0,
|
||||
"no-eval": 0,
|
||||
"no-magic-numbers": 0,
|
||||
"no-unused-expressions": 0,
|
||||
"prefer-arrow-callback": 0
|
||||
}
|
||||
}
|
||||
|
@@ -24,9 +24,15 @@ describe('application', function desc() {
|
||||
return this.app.start().then(() => {
|
||||
return this.app.client.
|
||||
waitUntilWindowLoaded().
|
||||
getWindowCount().then((count) => count.should.equal(1)).
|
||||
browserWindow.isDevToolsOpened().then((opened) => opened.should.be.false).
|
||||
browserWindow.isVisible().then((visible) => visible.should.be.true);
|
||||
getWindowCount().then((count) => {
|
||||
count.should.equal(1);
|
||||
}).
|
||||
browserWindow.isDevToolsOpened().then((opened) => {
|
||||
opened.should.be.false;
|
||||
}).
|
||||
browserWindow.isVisible().then((visible) => {
|
||||
visible.should.be.true;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -66,8 +72,12 @@ describe('application', function desc() {
|
||||
return this.app.start().then(() => {
|
||||
return this.app.client.
|
||||
waitUntilWindowLoaded().
|
||||
getUrl().then((url) => url.should.match(/\/settings.html$/)).
|
||||
isExisting('#newServerModal').then((existing) => existing.should.equal(true));
|
||||
getUrl().then((url) => {
|
||||
url.should.match(/\/settings.html$/);
|
||||
}).
|
||||
isExisting('#newServerModal').then((existing) => {
|
||||
existing.should.equal(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -78,7 +88,9 @@ describe('application', function desc() {
|
||||
return this.app.start().then(() => {
|
||||
return this.app.client.
|
||||
waitUntilWindowLoaded().
|
||||
getUrl().then((url) => url.should.match(/\/index.html$/));
|
||||
getUrl().then((url) => {
|
||||
url.should.match(/\/index.html$/);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -90,7 +102,9 @@ describe('application', function desc() {
|
||||
return this.app.start().then(() => {
|
||||
return this.app.client.
|
||||
waitUntilWindowLoaded().
|
||||
getUrl().then((url) => url.should.match(/\/index.html$/));
|
||||
getUrl().then((url) => {
|
||||
url.should.match(/\/index.html$/);
|
||||
});
|
||||
}).then(() => {
|
||||
var str = fs.readFileSync(env.configFilePath, 'utf8');
|
||||
var config = JSON.parse(str);
|
||||
|
@@ -55,30 +55,48 @@ describe('browser/index.html', function desc() {
|
||||
}));
|
||||
return this.app.restart().then(() => {
|
||||
return this.app.client.waitUntilWindowLoaded().
|
||||
isExisting('#tabBar').then((existing) => existing.should.be.false);
|
||||
isExisting('#tabBar').then((existing) => {
|
||||
existing.should.be.false;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should set src of webview from config file', () => {
|
||||
return this.app.client.waitUntilWindowLoaded().
|
||||
getAttribute('#mattermostView0', 'src').then((src) => src.should.equal(config.teams[0].url)).
|
||||
getAttribute('#mattermostView1', 'src').then((src) => src.should.equal(config.teams[1].url)).
|
||||
isExisting('#mattermostView2').then((existing) => existing.should.be.false);
|
||||
getAttribute('#mattermostView0', 'src').then((src) => {
|
||||
src.should.equal(config.teams[0].url);
|
||||
}).
|
||||
getAttribute('#mattermostView1', 'src').then((src) => {
|
||||
src.should.equal(config.teams[1].url);
|
||||
}).
|
||||
isExisting('#mattermostView2').then((existing) => {
|
||||
existing.should.be.false;
|
||||
});
|
||||
});
|
||||
|
||||
it('should set name of tab from config file', () => {
|
||||
return this.app.client.waitUntilWindowLoaded().
|
||||
getText('#teamTabItem0').then((text) => text.should.equal(config.teams[0].name)).
|
||||
getText('#teamTabItem1').then((text) => text.should.equal(config.teams[1].name));
|
||||
getText('#teamTabItem0').then((text) => {
|
||||
text.should.equal(config.teams[0].name);
|
||||
}).
|
||||
getText('#teamTabItem1').then((text) => {
|
||||
text.should.equal(config.teams[1].name);
|
||||
});
|
||||
});
|
||||
|
||||
it('should show only the selected team', () => {
|
||||
return this.app.client.waitUntilWindowLoaded().
|
||||
isVisible('#mattermostView0').then((visible) => visible.should.be.true).
|
||||
isVisible('#mattermostView1').then((visible) => visible.should.be.false).
|
||||
isVisible('#mattermostView0').then((visible) => {
|
||||
visible.should.be.true;
|
||||
}).
|
||||
isVisible('#mattermostView1').then((visible) => {
|
||||
visible.should.be.false;
|
||||
}).
|
||||
click('#teamTabItem1').
|
||||
waitForVisible('#mattermostView1', 2000).
|
||||
isVisible('#mattermostView0').then((visible) => visible.should.be.false);
|
||||
isVisible('#mattermostView0').then((visible) => {
|
||||
visible.should.be.false;
|
||||
});
|
||||
});
|
||||
|
||||
it('should show error when using incorrect URL', () => {
|
||||
@@ -108,7 +126,9 @@ describe('browser/index.html', function desc() {
|
||||
return this.app.client.waitUntilWindowLoaded().pause(2000);
|
||||
}).then(() => {
|
||||
return this.app.browserWindow.getTitle();
|
||||
}).then((title) => title.should.equal('Mattermost Desktop testing html'));
|
||||
}).then((title) => {
|
||||
title.should.equal('Mattermost Desktop testing html');
|
||||
});
|
||||
});
|
||||
|
||||
// Skip because it's very unstable in CI
|
||||
@@ -135,14 +155,18 @@ describe('browser/index.html', function desc() {
|
||||
}).
|
||||
windowByIndex(0).
|
||||
pause(500).
|
||||
browserWindow.getTitle().then((title) => title.should.equal('Title 0')).
|
||||
browserWindow.getTitle().then((title) => {
|
||||
title.should.equal('Title 0');
|
||||
}).
|
||||
windowByIndex(1).
|
||||
execute(() => {
|
||||
document.title = 'Title 1';
|
||||
}).
|
||||
windowByIndex(0).
|
||||
pause(500).
|
||||
browserWindow.getTitle().then((title) => title.should.equal('Title 0'));
|
||||
browserWindow.getTitle().then((title) => {
|
||||
title.should.equal('Title 0');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -174,10 +198,14 @@ describe('browser/index.html', function desc() {
|
||||
}).
|
||||
windowByIndex(0).
|
||||
pause(500).
|
||||
browserWindow.getTitle().then((title) => title.should.equal('Title 0')).
|
||||
browserWindow.getTitle().then((title) => {
|
||||
title.should.equal('Title 0');
|
||||
}).
|
||||
click('#teamTabItem1').
|
||||
pause(500).
|
||||
browserWindow.getTitle().then((title) => title.should.equal('Title 1'));
|
||||
browserWindow.getTitle().then((title) => {
|
||||
title.should.equal('Title 1');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -186,6 +214,8 @@ describe('browser/index.html', function desc() {
|
||||
return this.app.client.waitUntilWindowLoaded().
|
||||
click('#addServerButton').
|
||||
pause(500).
|
||||
isExisting('#newServerModal').then((existing) => existing.should.be.true);
|
||||
isExisting('#newServerModal').then((existing) => {
|
||||
existing.should.be.true;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -38,7 +38,9 @@ describe('browser/settings.html', function desc() {
|
||||
loadSettingsPage().
|
||||
click('#btnClose').
|
||||
pause(1000).
|
||||
getUrl().then((url) => url.should.match(/\/index.html(\?.+)?$/));
|
||||
getUrl().then((url) => {
|
||||
url.should.match(/\/index.html(\?.+)?$/);
|
||||
});
|
||||
});
|
||||
|
||||
it('should be disabled when the number of servers is zero', () => {
|
||||
@@ -81,7 +83,9 @@ describe('browser/settings.html', function desc() {
|
||||
waitForVisible(modalTitleSelector).
|
||||
element('.modal-dialog').click('.btn=Remove').
|
||||
pause(500).
|
||||
isExisting('#newServerModal').then((existing) => existing.should.be.true);
|
||||
isExisting('#newServerModal').then((existing) => {
|
||||
existing.should.be.true;
|
||||
});
|
||||
});
|
||||
|
||||
describe('Server list', () => {
|
||||
@@ -92,17 +96,29 @@ describe('browser/settings.html', function desc() {
|
||||
click('h4=example_1').
|
||||
pause(100).
|
||||
waitUntilWindowLoaded().
|
||||
getUrl().then((url) => url.should.match(/\/index.html(\?.+)?$/)).
|
||||
isVisible('#mattermostView0').then((visible) => visible.should.be.true).
|
||||
isVisible('#mattermostView1').then((visible) => visible.should.be.false).
|
||||
getUrl().then((url) => {
|
||||
url.should.match(/\/index.html(\?.+)?$/);
|
||||
}).
|
||||
isVisible('#mattermostView0').then((visible) => {
|
||||
visible.should.be.true;
|
||||
}).
|
||||
isVisible('#mattermostView1').then((visible) => {
|
||||
visible.should.be.false;
|
||||
}).
|
||||
|
||||
loadSettingsPage().
|
||||
click('h4=example_2').
|
||||
pause(100).
|
||||
waitUntilWindowLoaded().
|
||||
getUrl().then((url) => url.should.match(/\/index.html(\?.+)?$/)).
|
||||
isVisible('#mattermostView0').then((visible) => visible.should.be.false).
|
||||
isVisible('#mattermostView1').then((visible) => visible.should.be.true);
|
||||
getUrl().then((url) => {
|
||||
url.should.match(/\/index.html(\?.+)?$/);
|
||||
}).
|
||||
isVisible('#mattermostView0').then((visible) => {
|
||||
visible.should.be.false;
|
||||
}).
|
||||
isVisible('#mattermostView1').then((visible) => {
|
||||
visible.should.be.true;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -113,7 +129,9 @@ describe('browser/settings.html', function desc() {
|
||||
env.addClientCommands(this.app.client);
|
||||
return this.app.client.
|
||||
loadSettingsPage().
|
||||
isExisting('#inputHideMenuBar').then((existing) => existing.should.equal(expected));
|
||||
isExisting('#inputHideMenuBar').then((existing) => {
|
||||
existing.should.equal(expected);
|
||||
});
|
||||
});
|
||||
|
||||
[true, false].forEach((v) => {
|
||||
@@ -134,14 +152,20 @@ describe('browser/settings.html', function desc() {
|
||||
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
||||
savedConfig.hideMenuBar.should.equal(v);
|
||||
}).
|
||||
browserWindow.isMenuBarAutoHide().then((autoHide) => autoHide.should.equal(v)).then(() => { // confirm actual behavior
|
||||
browserWindow.isMenuBarAutoHide().then((autoHide) => {
|
||||
autoHide.should.equal(v);
|
||||
}).then(() => { // confirm actual behavior
|
||||
return this.app.restart();
|
||||
}).then(() => {
|
||||
env.addClientCommands(this.app.client);
|
||||
return this.app.client. // confirm actual behavior
|
||||
browserWindow.isMenuBarAutoHide().then((autoHide) => autoHide.should.equal(v)).
|
||||
browserWindow.isMenuBarAutoHide().then((autoHide) => {
|
||||
autoHide.should.equal(v);
|
||||
}).
|
||||
loadSettingsPage().
|
||||
isSelected('#inputHideMenuBar').then((autoHide) => autoHide.should.equal(v));
|
||||
isSelected('#inputHideMenuBar').then((autoHide) => {
|
||||
autoHide.should.equal(v);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -153,7 +177,9 @@ describe('browser/settings.html', function desc() {
|
||||
env.addClientCommands(this.app.client);
|
||||
return this.app.client.
|
||||
loadSettingsPage().
|
||||
isExisting('#inputAutoStart').then((existing) => existing.should.equal(expected));
|
||||
isExisting('#inputAutoStart').then((existing) => {
|
||||
existing.should.equal(expected);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -163,7 +189,9 @@ describe('browser/settings.html', function desc() {
|
||||
env.addClientCommands(this.app.client);
|
||||
return this.app.client.
|
||||
loadSettingsPage().
|
||||
isExisting('#inputShowTrayIcon').then((existing) => existing.should.equal(expected));
|
||||
isExisting('#inputShowTrayIcon').then((existing) => {
|
||||
existing.should.equal(expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Save tray icon theme on linux', () => {
|
||||
@@ -195,7 +223,9 @@ describe('browser/settings.html', function desc() {
|
||||
env.addClientCommands(this.app.client);
|
||||
return this.app.client.
|
||||
loadSettingsPage().
|
||||
isExisting('#inputMinimizeToTray').then((existing) => existing.should.equal(expected));
|
||||
isExisting('#inputMinimizeToTray').then((existing) => {
|
||||
existing.should.equal(expected);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -205,7 +235,9 @@ describe('browser/settings.html', function desc() {
|
||||
env.addClientCommands(this.app.client);
|
||||
return this.app.client.
|
||||
loadSettingsPage().
|
||||
isExisting('#inputToggleWindowOnTrayIconClick').then((existing) => existing.should.equal(expected));
|
||||
isExisting('#inputToggleWindowOnTrayIconClick').then((existing) => {
|
||||
existing.should.equal(expected);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -215,7 +247,9 @@ describe('browser/settings.html', function desc() {
|
||||
env.addClientCommands(this.app.client);
|
||||
return this.app.client.
|
||||
loadSettingsPage().
|
||||
isExisting('#inputflashWindow').then((existing) => existing.should.equal(expected));
|
||||
isExisting('#inputflashWindow').then((existing) => {
|
||||
existing.should.equal(expected);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -225,7 +259,9 @@ describe('browser/settings.html', function desc() {
|
||||
env.addClientCommands(this.app.client);
|
||||
return this.app.client.
|
||||
loadSettingsPage().
|
||||
isExisting('#inputShowUnreadBadge').then((existing) => existing.should.equal(expected));
|
||||
isExisting('#inputShowUnreadBadge').then((existing) => {
|
||||
existing.should.equal(expected);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -234,9 +270,13 @@ describe('browser/settings.html', function desc() {
|
||||
env.addClientCommands(this.app.client);
|
||||
return this.app.client.
|
||||
loadSettingsPage().
|
||||
isExisting('#inputSpellChecker').then((existing) => existing.should.equal(true)).
|
||||
isExisting('#inputSpellChecker').then((existing) => {
|
||||
existing.should.equal(true);
|
||||
}).
|
||||
scroll('#inputSpellChecker').
|
||||
isSelected('#inputSpellChecker').then((selected) => selected.should.equal(true)).
|
||||
isSelected('#inputSpellChecker').then((selected) => {
|
||||
selected.should.equal(true);
|
||||
}).
|
||||
click('#inputSpellChecker').
|
||||
pause(700).
|
||||
then(() => {
|
||||
@@ -254,8 +294,12 @@ describe('browser/settings.html', function desc() {
|
||||
env.addClientCommands(this.app.client);
|
||||
return this.app.client.
|
||||
loadSettingsPage().
|
||||
isExisting(modalTitleSelector).then((existing) => existing.should.be.false).
|
||||
isVisible(modalTitleSelector).then((visible) => visible.should.be.false).
|
||||
isExisting(modalTitleSelector).then((existing) => {
|
||||
existing.should.be.false;
|
||||
}).
|
||||
isVisible(modalTitleSelector).then((visible) => {
|
||||
visible.should.be.false;
|
||||
}).
|
||||
click('=Remove').
|
||||
waitForVisible(modalTitleSelector);
|
||||
});
|
||||
@@ -264,7 +308,9 @@ describe('browser/settings.html', function desc() {
|
||||
this.app.client.
|
||||
element('.modal-dialog').click('.btn=Remove').
|
||||
pause(500).
|
||||
isExisting(modalTitleSelector).then((existing) => existing.should.be.false).
|
||||
isExisting(modalTitleSelector).then((existing) => {
|
||||
existing.should.be.false;
|
||||
}).
|
||||
click('#btnClose').
|
||||
pause(500).then(() => {
|
||||
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
||||
@@ -277,7 +323,9 @@ describe('browser/settings.html', function desc() {
|
||||
this.app.client.
|
||||
element('.modal-dialog').click('.btn=Cancel').
|
||||
pause(500).
|
||||
isExisting(modalTitleSelector).then((existing) => existing.should.be.false).
|
||||
isExisting(modalTitleSelector).then((existing) => {
|
||||
existing.should.be.false;
|
||||
}).
|
||||
click('#btnClose').
|
||||
pause(500).then(() => {
|
||||
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
||||
@@ -290,14 +338,18 @@ describe('browser/settings.html', function desc() {
|
||||
return this.app.client.
|
||||
click('.modal-dialog button.close').
|
||||
pause(500).
|
||||
isExisting(modalTitleSelector).then((existing) => existing.should.be.false);
|
||||
isExisting(modalTitleSelector).then((existing) => {
|
||||
existing.should.be.false;
|
||||
});
|
||||
});
|
||||
|
||||
it('should disappear on click background', () => {
|
||||
return this.app.client.
|
||||
click('body').
|
||||
pause(500).
|
||||
isExisting(modalTitleSelector).then((existing) => existing.should.be.false);
|
||||
isExisting(modalTitleSelector).then((existing) => {
|
||||
existing.should.be.false;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -310,28 +362,36 @@ describe('browser/settings.html', function desc() {
|
||||
});
|
||||
|
||||
it('should open the new server modal', () => {
|
||||
return this.app.client.isExisting('#newServerModal').then((existing) => existing.should.be.true);
|
||||
return this.app.client.isExisting('#newServerModal').then((existing) => {
|
||||
existing.should.be.true;
|
||||
});
|
||||
});
|
||||
|
||||
it('should close the window after clicking cancel', () => {
|
||||
return this.app.client.
|
||||
click('#cancelNewServerModal').
|
||||
pause(1000). // Animation
|
||||
isExisting('#newServerModal').then((existing) => existing.should.be.false);
|
||||
isExisting('#newServerModal').then((existing) => {
|
||||
existing.should.be.false;
|
||||
});
|
||||
});
|
||||
|
||||
it('should not be valid if no team name has been set', () => {
|
||||
return this.app.client.
|
||||
click('#saveNewServerModal').
|
||||
pause(500).
|
||||
isExisting('.has-error #teamNameInput').then((existing) => existing.should.be.true);
|
||||
isExisting('.has-error #teamNameInput').then((existing) => {
|
||||
existing.should.be.true;
|
||||
});
|
||||
});
|
||||
|
||||
it('should not be valid if no server address has been set', () => {
|
||||
return this.app.client.
|
||||
click('#saveNewServerModal').
|
||||
pause(500).
|
||||
isExisting('.has-error #teamUrlInput').then((existing) => existing.should.be.true);
|
||||
isExisting('.has-error #teamUrlInput').then((existing) => {
|
||||
existing.should.be.true;
|
||||
});
|
||||
});
|
||||
|
||||
describe('Valid server name', () => {
|
||||
@@ -343,12 +403,16 @@ describe('browser/settings.html', function desc() {
|
||||
|
||||
it('should not be marked invalid', () => {
|
||||
return this.app.client.
|
||||
isExisting('.has-error #teamNameInput').then((existing) => existing.should.be.false);
|
||||
isExisting('.has-error #teamNameInput').then((existing) => {
|
||||
existing.should.be.false;
|
||||
});
|
||||
});
|
||||
|
||||
it('should not be possible to click save', () => {
|
||||
return this.app.client.
|
||||
getAttribute('#saveNewServerModal', 'disabled').then((disabled) => disabled.should.equal('true'));
|
||||
getAttribute('#saveNewServerModal', 'disabled').then((disabled) => {
|
||||
disabled.should.equal('true');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -361,12 +425,16 @@ describe('browser/settings.html', function desc() {
|
||||
|
||||
it('should be valid', () => {
|
||||
return this.app.client.
|
||||
isExisting('.has-error #teamUrlInput').then((existing) => existing.should.be.false);
|
||||
isExisting('.has-error #teamUrlInput').then((existing) => {
|
||||
existing.should.be.false;
|
||||
});
|
||||
});
|
||||
|
||||
it('should not be possible to click save', () => {
|
||||
return this.app.client.
|
||||
getAttribute('#saveNewServerModal', 'disabled').then((disabled) => disabled.should.equal('true'));
|
||||
getAttribute('#saveNewServerModal', 'disabled').then((disabled) => {
|
||||
disabled.should.equal('true');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -375,7 +443,9 @@ describe('browser/settings.html', function desc() {
|
||||
setValue('#teamUrlInput', 'superInvalid url').
|
||||
click('#saveNewServerModal').
|
||||
pause(500).
|
||||
isExisting('.has-error #teamUrlInput').then((existing) => existing.should.be.true);
|
||||
isExisting('.has-error #teamUrlInput').then((existing) => {
|
||||
existing.should.be.true;
|
||||
});
|
||||
});
|
||||
|
||||
describe('Valid Team Settings', () => {
|
||||
@@ -387,7 +457,9 @@ describe('browser/settings.html', function desc() {
|
||||
|
||||
it('should be possible to click add', () => {
|
||||
return this.app.client.
|
||||
getAttribute('#saveNewServerModal', 'disabled').then((disabled) => (disabled === null).should.be.true);
|
||||
getAttribute('#saveNewServerModal', 'disabled').then((disabled) => {
|
||||
(disabled === null).should.be.true;
|
||||
});
|
||||
});
|
||||
|
||||
it('should add the team to the config file', (done) => {
|
||||
|
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-unused-expressions */
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const env = require('../modules/environment');
|
||||
|
@@ -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),
|
||||
|
Reference in New Issue
Block a user