Merge pull request #502 from yuya-oc/remove-chai-as-promised
Stop using chai-as-promised
This commit is contained in:
@@ -43,7 +43,6 @@
|
|||||||
"babel-plugin-transform-object-rest-spread": "^6.23.0",
|
"babel-plugin-transform-object-rest-spread": "^6.23.0",
|
||||||
"babel-preset-react": "^6.23.0",
|
"babel-preset-react": "^6.23.0",
|
||||||
"chai": "^3.5.0",
|
"chai": "^3.5.0",
|
||||||
"chai-as-promised": "^6.0.0",
|
|
||||||
"cross-env": "^3.1.4",
|
"cross-env": "^3.1.4",
|
||||||
"devtron": "^1.4.0",
|
"devtron": "^1.4.0",
|
||||||
"electron": "1.6.1",
|
"electron": "1.6.1",
|
||||||
|
@@ -1,10 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const chai = require('chai');
|
const chai = require('chai');
|
||||||
const chaiAsPromised = require('chai-as-promised');
|
|
||||||
|
|
||||||
chai.should();
|
chai.should();
|
||||||
chai.use(chaiAsPromised);
|
|
||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
@@ -42,12 +39,10 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getSpectronApp() {
|
getSpectronApp() {
|
||||||
const app = new Application({
|
return new Application({
|
||||||
path: electronBinaryPath,
|
path: electronBinaryPath,
|
||||||
args: [`${path.join(sourceRootDir, 'src')}`, `--data-dir=${userDataDir}`, '--disable-dev-mode']
|
args: [`${path.join(sourceRootDir, 'src')}`, `--data-dir=${userDataDir}`, '--disable-dev-mode']
|
||||||
});
|
});
|
||||||
chaiAsPromised.transferPromiseness = app.transferPromiseness;
|
|
||||||
return app;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
addClientCommands(client) {
|
addClientCommands(client) {
|
||||||
|
@@ -26,9 +26,9 @@ describe('application', function desc() {
|
|||||||
return this.app.start().then(() => {
|
return this.app.start().then(() => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
waitUntilWindowLoaded().
|
waitUntilWindowLoaded().
|
||||||
getWindowCount().should.eventually.equal(1).
|
getWindowCount().then((count) => count.should.equal(1)).
|
||||||
browserWindow.isDevToolsOpened().should.eventually.be.false.
|
browserWindow.isDevToolsOpened().then((opened) => opened.should.be.false).
|
||||||
browserWindow.isVisible().should.eventually.be.true;
|
browserWindow.isVisible().then((visible) => visible.should.be.true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -68,8 +68,8 @@ describe('application', function desc() {
|
|||||||
return this.app.start().then(() => {
|
return this.app.start().then(() => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
waitUntilWindowLoaded().
|
waitUntilWindowLoaded().
|
||||||
getUrl().should.eventually.match(/\/settings.html$/).
|
getUrl().then((url) => url.should.match(/\/settings.html$/)).
|
||||||
isExisting('#newServerModal').should.eventually.equal(true);
|
isExisting('#newServerModal').then((existing) => existing.should.equal(true));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ describe('application', function desc() {
|
|||||||
return this.app.start().then(() => {
|
return this.app.start().then(() => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
waitUntilWindowLoaded().
|
waitUntilWindowLoaded().
|
||||||
getUrl().should.eventually.match(/\/index.html$/);
|
getUrl().then((url) => url.should.match(/\/index.html$/));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ describe('application', function desc() {
|
|||||||
return this.app.start().then(() => {
|
return this.app.start().then(() => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
waitUntilWindowLoaded().
|
waitUntilWindowLoaded().
|
||||||
getUrl().should.eventually.match(/\/index.html$/);
|
getUrl().then((url) => url.should.match(/\/index.html$/));
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
var str = fs.readFileSync(env.configFilePath, 'utf8');
|
var str = fs.readFileSync(env.configFilePath, 'utf8');
|
||||||
var config = JSON.parse(str);
|
var config = JSON.parse(str);
|
||||||
|
@@ -55,31 +55,31 @@ describe('browser/index.html', function desc() {
|
|||||||
}));
|
}));
|
||||||
return this.app.restart().then(() => {
|
return this.app.restart().then(() => {
|
||||||
return this.app.client.waitUntilWindowLoaded().
|
return this.app.client.waitUntilWindowLoaded().
|
||||||
isExisting('#tabBar').should.eventually.be.false;
|
isExisting('#tabBar').then((existing) => existing.should.be.false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set src of webview from config file', () => {
|
it('should set src of webview from config file', () => {
|
||||||
return this.app.client.waitUntilWindowLoaded().
|
return this.app.client.waitUntilWindowLoaded().
|
||||||
getAttribute('#mattermostView0', 'src').should.eventually.equal(config.teams[0].url).
|
getAttribute('#mattermostView0', 'src').then((src) => src.should.equal(config.teams[0].url)).
|
||||||
getAttribute('#mattermostView1', 'src').should.eventually.equal(config.teams[1].url).
|
getAttribute('#mattermostView1', 'src').then((src) => src.should.equal(config.teams[1].url)).
|
||||||
isExisting('#mattermostView2').should.eventually.be.false;
|
isExisting('#mattermostView2').then((existing) => existing.should.be.false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set name of tab from config file', () => {
|
it('should set name of tab from config file', () => {
|
||||||
return this.app.client.waitUntilWindowLoaded().
|
return this.app.client.waitUntilWindowLoaded().
|
||||||
getText('#teamTabItem0').should.eventually.equal(config.teams[0].name).
|
getText('#teamTabItem0').then((text) => text.should.equal(config.teams[0].name)).
|
||||||
getText('#teamTabItem1').should.eventually.equal(config.teams[1].name);
|
getText('#teamTabItem1').then((text) => text.should.equal(config.teams[1].name));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show only the selected team', () => {
|
it('should show only the selected team', () => {
|
||||||
return this.app.client.waitUntilWindowLoaded().
|
return this.app.client.waitUntilWindowLoaded().
|
||||||
isVisible('#mattermostView0').should.eventually.be.true.
|
isVisible('#mattermostView0').then((visible) => visible.should.be.true).
|
||||||
isVisible('#mattermostView1').should.eventually.be.false.
|
isVisible('#mattermostView1').then((visible) => visible.should.be.false).
|
||||||
click('#teamTabItem1').
|
click('#teamTabItem1').
|
||||||
pause(1000).
|
pause(1000).
|
||||||
isVisible('#mattermostView1').should.eventually.be.true.
|
isVisible('#mattermostView1').then((visible) => visible.should.be.true).
|
||||||
isVisible('#mattermostView0').should.eventually.be.false;
|
isVisible('#mattermostView0').then((visible) => visible.should.be.false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show error when using incorrect URL', () => {
|
it('should show error when using incorrect URL', () => {
|
||||||
@@ -108,8 +108,8 @@ describe('browser/index.html', function desc() {
|
|||||||
return this.app.restart().then(() => {
|
return this.app.restart().then(() => {
|
||||||
return this.app.client.waitUntilWindowLoaded().pause(1500);
|
return this.app.client.waitUntilWindowLoaded().pause(1500);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
return this.app.browserWindow.getTitle().should.eventually.equal('Mattermost Desktop testing html');
|
return this.app.browserWindow.getTitle();
|
||||||
});
|
}).then((title) => title.should.equal('Mattermost Desktop testing html'));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update window title when the activated tab\'s title is updated', () => {
|
it('should update window title when the activated tab\'s title is updated', () => {
|
||||||
@@ -132,13 +132,13 @@ describe('browser/index.html', function desc() {
|
|||||||
document.title = 'Title 0';
|
document.title = 'Title 0';
|
||||||
}).
|
}).
|
||||||
windowByIndex(0).
|
windowByIndex(0).
|
||||||
browserWindow.getTitle().should.eventually.equal('Title 0').
|
browserWindow.getTitle().then((title) => title.should.equal('Title 0')).
|
||||||
windowByIndex(2).
|
windowByIndex(2).
|
||||||
execute(() => {
|
execute(() => {
|
||||||
document.title = 'Title 1';
|
document.title = 'Title 1';
|
||||||
}).
|
}).
|
||||||
windowByIndex(0).
|
windowByIndex(0).
|
||||||
browserWindow.getTitle().should.eventually.equal('Title 0');
|
browserWindow.getTitle().then((title) => title.should.equal('Title 0'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -166,9 +166,9 @@ describe('browser/index.html', function desc() {
|
|||||||
document.title = 'Title 1';
|
document.title = 'Title 1';
|
||||||
}).
|
}).
|
||||||
windowByIndex(0).
|
windowByIndex(0).
|
||||||
browserWindow.getTitle().should.eventually.equal('Title 0').
|
browserWindow.getTitle().then((title) => title.should.equal('Title 0')).
|
||||||
click('#teamTabItem1').
|
click('#teamTabItem1').
|
||||||
browserWindow.getTitle().should.eventually.equal('Title 1');
|
browserWindow.getTitle().then((title) => title.should.equal('Title 1'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -177,6 +177,6 @@ describe('browser/index.html', function desc() {
|
|||||||
return this.app.client.waitUntilWindowLoaded().
|
return this.app.client.waitUntilWindowLoaded().
|
||||||
click('#tabBarAddNewTeam').
|
click('#tabBarAddNewTeam').
|
||||||
pause(500).
|
pause(500).
|
||||||
isExisting('#newServerModal').should.eventually.be.true;
|
isExisting('#newServerModal').then((existing) => existing.should.be.true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -37,7 +37,7 @@ describe('browser/settings.html', function desc() {
|
|||||||
loadSettingsPage().
|
loadSettingsPage().
|
||||||
click('#btnClose').
|
click('#btnClose').
|
||||||
pause(1000).
|
pause(1000).
|
||||||
getUrl().should.eventually.match(/\/index.html(\?.+)?$/);
|
getUrl().then((url) => url.should.match(/\/index.html(\?.+)?$/));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show NewServerModal after all servers are removed', () => {
|
it('should show NewServerModal after all servers are removed', () => {
|
||||||
@@ -53,7 +53,7 @@ describe('browser/settings.html', function desc() {
|
|||||||
waitForVisible(modalTitleSelector).
|
waitForVisible(modalTitleSelector).
|
||||||
element('.modal-dialog').click('.btn=Remove').
|
element('.modal-dialog').click('.btn=Remove').
|
||||||
pause(500).
|
pause(500).
|
||||||
isExisting('#newServerModal').should.eventually.equal(true);
|
isExisting('#newServerModal').then((existing) => existing.should.be.true);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Server list', () => {
|
describe('Server list', () => {
|
||||||
@@ -64,17 +64,17 @@ describe('browser/settings.html', function desc() {
|
|||||||
click('h4=example_1').
|
click('h4=example_1').
|
||||||
pause(100).
|
pause(100).
|
||||||
waitUntilWindowLoaded().
|
waitUntilWindowLoaded().
|
||||||
getUrl().should.eventually.match(/\/index.html(\?.+)?$/).
|
getUrl().then((url) => url.should.match(/\/index.html(\?.+)?$/)).
|
||||||
isVisible('#mattermostView0').should.eventually.be.true.
|
isVisible('#mattermostView0').then((visible) => visible.should.be.true).
|
||||||
isVisible('#mattermostView1').should.eventually.be.false.
|
isVisible('#mattermostView1').then((visible) => visible.should.be.false).
|
||||||
|
|
||||||
loadSettingsPage().
|
loadSettingsPage().
|
||||||
click('h4=example_2').
|
click('h4=example_2').
|
||||||
pause(100).
|
pause(100).
|
||||||
waitUntilWindowLoaded().
|
waitUntilWindowLoaded().
|
||||||
getUrl().should.eventually.match(/\/index.html(\?.+)?$/).
|
getUrl().then((url) => url.should.match(/\/index.html(\?.+)?$/)).
|
||||||
isVisible('#mattermostView0').should.eventually.be.false.
|
isVisible('#mattermostView0').then((visible) => visible.should.be.false).
|
||||||
isVisible('#mattermostView1').should.eventually.be.true;
|
isVisible('#mattermostView1').then((visible) => visible.should.be.true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ describe('browser/settings.html', function desc() {
|
|||||||
env.addClientCommands(this.app.client);
|
env.addClientCommands(this.app.client);
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
loadSettingsPage().
|
loadSettingsPage().
|
||||||
isExisting('#inputHideMenuBar').should.eventually.equal(expected);
|
isExisting('#inputHideMenuBar').then((existing) => existing.should.equal(expected));
|
||||||
});
|
});
|
||||||
|
|
||||||
[true, false].forEach((v) => {
|
[true, false].forEach((v) => {
|
||||||
@@ -106,14 +106,14 @@ describe('browser/settings.html', function desc() {
|
|||||||
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
||||||
savedConfig.hideMenuBar.should.equal(v);
|
savedConfig.hideMenuBar.should.equal(v);
|
||||||
}).
|
}).
|
||||||
browserWindow.isMenuBarAutoHide().should.eventually.equal(v).then(() => { // confirm actual behavior
|
browserWindow.isMenuBarAutoHide().then((autoHide) => autoHide.should.equal(v)).then(() => { // confirm actual behavior
|
||||||
return this.app.restart();
|
return this.app.restart();
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
env.addClientCommands(this.app.client);
|
env.addClientCommands(this.app.client);
|
||||||
return this.app.client. // confirm actual behavior
|
return this.app.client. // confirm actual behavior
|
||||||
browserWindow.isMenuBarAutoHide().should.eventually.equal(v).
|
browserWindow.isMenuBarAutoHide().then((autoHide) => autoHide.should.equal(v)).
|
||||||
loadSettingsPage().
|
loadSettingsPage().
|
||||||
isSelected('#inputHideMenuBar').should.eventually.equal(v);
|
isSelected('#inputHideMenuBar').then((autoHide) => autoHide.should.equal(v));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -125,7 +125,7 @@ describe('browser/settings.html', function desc() {
|
|||||||
env.addClientCommands(this.app.client);
|
env.addClientCommands(this.app.client);
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
loadSettingsPage().
|
loadSettingsPage().
|
||||||
isExisting('#inputAutoStart').should.eventually.equal(expected);
|
isExisting('#inputAutoStart').then((existing) => existing.should.equal(expected));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ describe('browser/settings.html', function desc() {
|
|||||||
env.addClientCommands(this.app.client);
|
env.addClientCommands(this.app.client);
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
loadSettingsPage().
|
loadSettingsPage().
|
||||||
isExisting('#inputShowTrayIcon').should.eventually.equal(expected);
|
isExisting('#inputShowTrayIcon').then((existing) => existing.should.equal(expected));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Save tray icon theme on linux', () => {
|
describe('Save tray icon theme on linux', () => {
|
||||||
@@ -167,7 +167,7 @@ describe('browser/settings.html', function desc() {
|
|||||||
env.addClientCommands(this.app.client);
|
env.addClientCommands(this.app.client);
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
loadSettingsPage().
|
loadSettingsPage().
|
||||||
isExisting('#inputMinimizeToTray').should.eventually.equal(expected);
|
isExisting('#inputMinimizeToTray').then((existing) => existing.should.equal(expected));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ describe('browser/settings.html', function desc() {
|
|||||||
env.addClientCommands(this.app.client);
|
env.addClientCommands(this.app.client);
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
loadSettingsPage().
|
loadSettingsPage().
|
||||||
isExisting('#inputToggleWindowOnTrayIconClick').should.eventually.equal(expected);
|
isExisting('#inputToggleWindowOnTrayIconClick').then((existing) => existing.should.equal(expected));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ describe('browser/settings.html', function desc() {
|
|||||||
env.addClientCommands(this.app.client);
|
env.addClientCommands(this.app.client);
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
loadSettingsPage().
|
loadSettingsPage().
|
||||||
isExisting('#inputflashWindow').should.eventually.equal(expected);
|
isExisting('#inputflashWindow').then((existing) => existing.should.equal(expected));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ describe('browser/settings.html', function desc() {
|
|||||||
env.addClientCommands(this.app.client);
|
env.addClientCommands(this.app.client);
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
loadSettingsPage().
|
loadSettingsPage().
|
||||||
isExisting('#inputShowUnreadBadge').should.eventually.equal(expected);
|
isExisting('#inputShowUnreadBadge').then((existing) => existing.should.equal(expected));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -209,8 +209,8 @@ describe('browser/settings.html', function desc() {
|
|||||||
env.addClientCommands(this.app.client);
|
env.addClientCommands(this.app.client);
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
loadSettingsPage().
|
loadSettingsPage().
|
||||||
isExisting(modalTitleSelector).should.eventually.false.
|
isExisting(modalTitleSelector).then((existing) => existing.should.be.false).
|
||||||
isVisible(modalTitleSelector).should.eventually.false.
|
isVisible(modalTitleSelector).then((visible) => visible.should.be.false).
|
||||||
click('=Remove').
|
click('=Remove').
|
||||||
waitForVisible(modalTitleSelector);
|
waitForVisible(modalTitleSelector);
|
||||||
});
|
});
|
||||||
@@ -219,7 +219,7 @@ describe('browser/settings.html', function desc() {
|
|||||||
this.app.client.
|
this.app.client.
|
||||||
element('.modal-dialog').click('.btn=Remove').
|
element('.modal-dialog').click('.btn=Remove').
|
||||||
pause(500).
|
pause(500).
|
||||||
isExisting(modalTitleSelector).should.eventually.false.
|
isExisting(modalTitleSelector).then((existing) => existing.should.be.false).
|
||||||
click('#btnClose').
|
click('#btnClose').
|
||||||
pause(500).then(() => {
|
pause(500).then(() => {
|
||||||
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
||||||
@@ -232,7 +232,7 @@ describe('browser/settings.html', function desc() {
|
|||||||
this.app.client.
|
this.app.client.
|
||||||
element('.modal-dialog').click('.btn=Cancel').
|
element('.modal-dialog').click('.btn=Cancel').
|
||||||
pause(500).
|
pause(500).
|
||||||
isExisting(modalTitleSelector).should.eventually.false.
|
isExisting(modalTitleSelector).then((existing) => existing.should.be.false).
|
||||||
click('#btnClose').
|
click('#btnClose').
|
||||||
pause(500).then(() => {
|
pause(500).then(() => {
|
||||||
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
||||||
@@ -245,14 +245,14 @@ describe('browser/settings.html', function desc() {
|
|||||||
return this.app.client.
|
return this.app.client.
|
||||||
click('.modal-dialog button.close').
|
click('.modal-dialog button.close').
|
||||||
pause(500).
|
pause(500).
|
||||||
isExisting(modalTitleSelector).should.eventually.false;
|
isExisting(modalTitleSelector).then((existing) => existing.should.be.false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should disappear on click background', () => {
|
it('should disappear on click background', () => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
click('body').
|
click('body').
|
||||||
pause(500).
|
pause(500).
|
||||||
isExisting(modalTitleSelector).should.eventually.false;
|
isExisting(modalTitleSelector).then((existing) => existing.should.be.false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -265,28 +265,28 @@ describe('browser/settings.html', function desc() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should open the new server modal', () => {
|
it('should open the new server modal', () => {
|
||||||
return this.app.client.isExisting('#newServerModal').should.eventually.equal(true);
|
return this.app.client.isExisting('#newServerModal').then((existing) => existing.should.be.true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should close the window after clicking cancel', () => {
|
it('should close the window after clicking cancel', () => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
click('#cancelNewServerModal').
|
click('#cancelNewServerModal').
|
||||||
pause(1000). // Animation
|
pause(1000). // Animation
|
||||||
isExisting('#newServerModal').should.eventually.equal(false);
|
isExisting('#newServerModal').then((existing) => existing.should.be.false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not be valid if no team name has been set', () => {
|
it('should not be valid if no team name has been set', () => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
click('#saveNewServerModal').
|
click('#saveNewServerModal').
|
||||||
pause(500).
|
pause(500).
|
||||||
isExisting('.has-error #teamNameInput').should.eventually.equal(true);
|
isExisting('.has-error #teamNameInput').then((existing) => existing.should.be.true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not be valid if no server address has been set', () => {
|
it('should not be valid if no server address has been set', () => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
click('#saveNewServerModal').
|
click('#saveNewServerModal').
|
||||||
pause(500).
|
pause(500).
|
||||||
isExisting('.has-error #teamUrlInput').should.eventually.equal(true);
|
isExisting('.has-error #teamUrlInput').then((existing) => existing.should.be.true);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Valid server name', () => {
|
describe('Valid server name', () => {
|
||||||
@@ -298,12 +298,12 @@ describe('browser/settings.html', function desc() {
|
|||||||
|
|
||||||
it('should not be marked invalid', () => {
|
it('should not be marked invalid', () => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
isExisting('.has-error #teamNameInput').should.eventually.equal(false);
|
isExisting('.has-error #teamNameInput').then((existing) => existing.should.be.false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not be possible to click save', () => {
|
it('should not be possible to click save', () => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
getAttribute('#saveNewServerModal', 'disabled').should.eventually.equal('true');
|
getAttribute('#saveNewServerModal', 'disabled').then((disabled) => disabled.should.equal('true'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -316,12 +316,12 @@ describe('browser/settings.html', function desc() {
|
|||||||
|
|
||||||
it('should be valid', () => {
|
it('should be valid', () => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
isExisting('.has-error #teamUrlInput').should.eventually.equal(false);
|
isExisting('.has-error #teamUrlInput').then((existing) => existing.should.be.false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not be possible to click save', () => {
|
it('should not be possible to click save', () => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
getAttribute('#saveNewServerModal', 'disabled').should.eventually.equal('true');
|
getAttribute('#saveNewServerModal', 'disabled').then((disabled) => disabled.should.equal('true'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -330,7 +330,7 @@ describe('browser/settings.html', function desc() {
|
|||||||
setValue('#teamUrlInput', 'superInvalid url').
|
setValue('#teamUrlInput', 'superInvalid url').
|
||||||
click('#saveNewServerModal').
|
click('#saveNewServerModal').
|
||||||
pause(500).
|
pause(500).
|
||||||
isExisting('.has-error #teamUrlInput').should.eventually.equal(true);
|
isExisting('.has-error #teamUrlInput').then((existing) => existing.should.be.true);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Valid Team Settings', () => {
|
describe('Valid Team Settings', () => {
|
||||||
@@ -342,7 +342,7 @@ describe('browser/settings.html', function desc() {
|
|||||||
|
|
||||||
it('should be possible to click add', () => {
|
it('should be possible to click add', () => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
getAttribute('#saveNewServerModal', 'disabled').should.eventually.equal(null);
|
getAttribute('#saveNewServerModal', 'disabled').then((disabled) => (disabled === null).should.be.true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add the team to the config file', (done) => {
|
it('should add the team to the config file', (done) => {
|
||||||
|
@@ -54,8 +54,8 @@ describe('application', function desc() {
|
|||||||
|
|
||||||
// webview is handled as a window by chromedriver.
|
// webview is handled as a window by chromedriver.
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
windowByIndex(1).isNodeEnabled().should.eventually.be.false.
|
windowByIndex(1).isNodeEnabled().then((enabled) => enabled.should.be.false).
|
||||||
windowByIndex(2).isNodeEnabled().should.eventually.be.false.
|
windowByIndex(2).isNodeEnabled().then((enabled) => enabled.should.be.false).
|
||||||
windowByIndex(0).
|
windowByIndex(0).
|
||||||
getAttribute('webview', 'nodeintegration').then((nodeintegration) => {
|
getAttribute('webview', 'nodeintegration').then((nodeintegration) => {
|
||||||
// nodeintegration is an array of string
|
// nodeintegration is an array of string
|
||||||
@@ -78,7 +78,7 @@ describe('application', function desc() {
|
|||||||
return handles.value.length === 4;
|
return handles.value.length === 4;
|
||||||
});
|
});
|
||||||
}, 5000, 'expected a new window').
|
}, 5000, 'expected a new window').
|
||||||
windowByIndex(3).isNodeEnabled().should.eventually.be.false;
|
windowByIndex(3).isNodeEnabled().then((enabled) => enabled.should.be.false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should NOT be able to call eval() in any window', () => {
|
it('should NOT be able to call eval() in any window', () => {
|
||||||
@@ -88,7 +88,9 @@ describe('application', function desc() {
|
|||||||
windowByIndex(index).
|
windowByIndex(index).
|
||||||
execute(() => {
|
execute(() => {
|
||||||
return eval('1 + 1');
|
return eval('1 + 1');
|
||||||
}).should.eventually.be.rejected;
|
}).then((result) => {
|
||||||
|
throw new Error(`Promise was unexpectedly fulfilled (result: ${result})`);
|
||||||
|
}, (error) => (error !== null).should.be.true);
|
||||||
};
|
};
|
||||||
const tryEvalInSettingsPage = () => {
|
const tryEvalInSettingsPage = () => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
@@ -96,7 +98,9 @@ describe('application', function desc() {
|
|||||||
loadSettingsPage().
|
loadSettingsPage().
|
||||||
execute(() => {
|
execute(() => {
|
||||||
return eval('1 + 1');
|
return eval('1 + 1');
|
||||||
}).should.eventually.be.rejected;
|
}).then((result) => {
|
||||||
|
throw new Error(`Promise was unexpectedly fulfilled (result: ${result})`);
|
||||||
|
}, (error) => (error !== null).should.be.true);
|
||||||
};
|
};
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
tryEval(0),
|
tryEval(0),
|
||||||
|
Reference in New Issue
Block a user