Fix tests with proper promise chain
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
"max-nested-callbacks": 0,
|
"max-nested-callbacks": 0,
|
||||||
"no-eval": 0,
|
"no-eval": 0,
|
||||||
"no-magic-numbers": 0,
|
"no-magic-numbers": 0,
|
||||||
|
"no-unused-expressions": 0,
|
||||||
"prefer-arrow-callback": 0
|
"prefer-arrow-callback": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -24,9 +24,15 @@ 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().then((count) => count.should.equal(1)).
|
getWindowCount().then((count) => {
|
||||||
browserWindow.isDevToolsOpened().then((opened) => opened.should.be.false).
|
count.should.equal(1);
|
||||||
browserWindow.isVisible().then((visible) => visible.should.be.true);
|
}).
|
||||||
|
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.start().then(() => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
waitUntilWindowLoaded().
|
waitUntilWindowLoaded().
|
||||||
getUrl().then((url) => url.should.match(/\/settings.html$/)).
|
getUrl().then((url) => {
|
||||||
isExisting('#newServerModal').then((existing) => existing.should.equal(true));
|
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.start().then(() => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
waitUntilWindowLoaded().
|
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.start().then(() => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
waitUntilWindowLoaded().
|
waitUntilWindowLoaded().
|
||||||
getUrl().then((url) => url.should.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,30 +55,48 @@ 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').then((existing) => existing.should.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').then((src) => src.should.equal(config.teams[0].url)).
|
getAttribute('#mattermostView0', 'src').then((src) => {
|
||||||
getAttribute('#mattermostView1', 'src').then((src) => src.should.equal(config.teams[1].url)).
|
src.should.equal(config.teams[0].url);
|
||||||
isExisting('#mattermostView2').then((existing) => existing.should.be.false);
|
}).
|
||||||
|
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', () => {
|
it('should set name of tab from config file', () => {
|
||||||
return this.app.client.waitUntilWindowLoaded().
|
return this.app.client.waitUntilWindowLoaded().
|
||||||
getText('#teamTabItem0').then((text) => text.should.equal(config.teams[0].name)).
|
getText('#teamTabItem0').then((text) => {
|
||||||
getText('#teamTabItem1').then((text) => text.should.equal(config.teams[1].name));
|
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', () => {
|
it('should show only the selected team', () => {
|
||||||
return this.app.client.waitUntilWindowLoaded().
|
return this.app.client.waitUntilWindowLoaded().
|
||||||
isVisible('#mattermostView0').then((visible) => visible.should.be.true).
|
isVisible('#mattermostView0').then((visible) => {
|
||||||
isVisible('#mattermostView1').then((visible) => visible.should.be.false).
|
visible.should.be.true;
|
||||||
|
}).
|
||||||
|
isVisible('#mattermostView1').then((visible) => {
|
||||||
|
visible.should.be.false;
|
||||||
|
}).
|
||||||
click('#teamTabItem1').
|
click('#teamTabItem1').
|
||||||
waitForVisible('#mattermostView1', 2000).
|
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', () => {
|
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);
|
return this.app.client.waitUntilWindowLoaded().pause(2000);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
return this.app.browserWindow.getTitle();
|
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
|
// Skip because it's very unstable in CI
|
||||||
@@ -135,14 +155,18 @@ describe('browser/index.html', function desc() {
|
|||||||
}).
|
}).
|
||||||
windowByIndex(0).
|
windowByIndex(0).
|
||||||
pause(500).
|
pause(500).
|
||||||
browserWindow.getTitle().then((title) => title.should.equal('Title 0')).
|
browserWindow.getTitle().then((title) => {
|
||||||
|
title.should.equal('Title 0');
|
||||||
|
}).
|
||||||
windowByIndex(1).
|
windowByIndex(1).
|
||||||
execute(() => {
|
execute(() => {
|
||||||
document.title = 'Title 1';
|
document.title = 'Title 1';
|
||||||
}).
|
}).
|
||||||
windowByIndex(0).
|
windowByIndex(0).
|
||||||
pause(500).
|
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).
|
windowByIndex(0).
|
||||||
pause(500).
|
pause(500).
|
||||||
browserWindow.getTitle().then((title) => title.should.equal('Title 0')).
|
browserWindow.getTitle().then((title) => {
|
||||||
|
title.should.equal('Title 0');
|
||||||
|
}).
|
||||||
click('#teamTabItem1').
|
click('#teamTabItem1').
|
||||||
pause(500).
|
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().
|
return this.app.client.waitUntilWindowLoaded().
|
||||||
click('#addServerButton').
|
click('#addServerButton').
|
||||||
pause(500).
|
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().
|
loadSettingsPage().
|
||||||
click('#btnClose').
|
click('#btnClose').
|
||||||
pause(1000).
|
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', () => {
|
it('should be disabled when the number of servers is zero', () => {
|
||||||
@@ -81,7 +83,9 @@ 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').then((existing) => existing.should.be.true);
|
isExisting('#newServerModal').then((existing) => {
|
||||||
|
existing.should.be.true;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Server list', () => {
|
describe('Server list', () => {
|
||||||
@@ -92,17 +96,29 @@ describe('browser/settings.html', function desc() {
|
|||||||
click('h4=example_1').
|
click('h4=example_1').
|
||||||
pause(100).
|
pause(100).
|
||||||
waitUntilWindowLoaded().
|
waitUntilWindowLoaded().
|
||||||
getUrl().then((url) => url.should.match(/\/index.html(\?.+)?$/)).
|
getUrl().then((url) => {
|
||||||
isVisible('#mattermostView0').then((visible) => visible.should.be.true).
|
url.should.match(/\/index.html(\?.+)?$/);
|
||||||
isVisible('#mattermostView1').then((visible) => visible.should.be.false).
|
}).
|
||||||
|
isVisible('#mattermostView0').then((visible) => {
|
||||||
|
visible.should.be.true;
|
||||||
|
}).
|
||||||
|
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().then((url) => url.should.match(/\/index.html(\?.+)?$/)).
|
getUrl().then((url) => {
|
||||||
isVisible('#mattermostView0').then((visible) => visible.should.be.false).
|
url.should.match(/\/index.html(\?.+)?$/);
|
||||||
isVisible('#mattermostView1').then((visible) => visible.should.be.true);
|
}).
|
||||||
|
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);
|
env.addClientCommands(this.app.client);
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
loadSettingsPage().
|
loadSettingsPage().
|
||||||
isExisting('#inputHideMenuBar').then((existing) => existing.should.equal(expected));
|
isExisting('#inputHideMenuBar').then((existing) => {
|
||||||
|
existing.should.equal(expected);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
[true, false].forEach((v) => {
|
[true, false].forEach((v) => {
|
||||||
@@ -134,14 +152,20 @@ 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().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();
|
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().then((autoHide) => autoHide.should.equal(v)).
|
browserWindow.isMenuBarAutoHide().then((autoHide) => {
|
||||||
|
autoHide.should.equal(v);
|
||||||
|
}).
|
||||||
loadSettingsPage().
|
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);
|
env.addClientCommands(this.app.client);
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
loadSettingsPage().
|
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);
|
env.addClientCommands(this.app.client);
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
loadSettingsPage().
|
loadSettingsPage().
|
||||||
isExisting('#inputShowTrayIcon').then((existing) => existing.should.equal(expected));
|
isExisting('#inputShowTrayIcon').then((existing) => {
|
||||||
|
existing.should.equal(expected);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Save tray icon theme on linux', () => {
|
describe('Save tray icon theme on linux', () => {
|
||||||
@@ -195,7 +223,9 @@ 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').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);
|
env.addClientCommands(this.app.client);
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
loadSettingsPage().
|
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);
|
env.addClientCommands(this.app.client);
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
loadSettingsPage().
|
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);
|
env.addClientCommands(this.app.client);
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
loadSettingsPage().
|
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);
|
env.addClientCommands(this.app.client);
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
loadSettingsPage().
|
loadSettingsPage().
|
||||||
isExisting('#inputSpellChecker').then((existing) => existing.should.equal(true)).
|
isExisting('#inputSpellChecker').then((existing) => {
|
||||||
|
existing.should.equal(true);
|
||||||
|
}).
|
||||||
scroll('#inputSpellChecker').
|
scroll('#inputSpellChecker').
|
||||||
isSelected('#inputSpellChecker').then((selected) => selected.should.equal(true)).
|
isSelected('#inputSpellChecker').then((selected) => {
|
||||||
|
selected.should.equal(true);
|
||||||
|
}).
|
||||||
click('#inputSpellChecker').
|
click('#inputSpellChecker').
|
||||||
pause(700).
|
pause(700).
|
||||||
then(() => {
|
then(() => {
|
||||||
@@ -254,8 +294,12 @@ 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).then((existing) => existing.should.be.false).
|
isExisting(modalTitleSelector).then((existing) => {
|
||||||
isVisible(modalTitleSelector).then((visible) => visible.should.be.false).
|
existing.should.be.false;
|
||||||
|
}).
|
||||||
|
isVisible(modalTitleSelector).then((visible) => {
|
||||||
|
visible.should.be.false;
|
||||||
|
}).
|
||||||
click('=Remove').
|
click('=Remove').
|
||||||
waitForVisible(modalTitleSelector);
|
waitForVisible(modalTitleSelector);
|
||||||
});
|
});
|
||||||
@@ -264,7 +308,9 @@ 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).then((existing) => existing.should.be.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'));
|
||||||
@@ -277,7 +323,9 @@ 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).then((existing) => existing.should.be.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'));
|
||||||
@@ -290,14 +338,18 @@ 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).then((existing) => existing.should.be.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).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', () => {
|
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', () => {
|
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').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', () => {
|
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').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', () => {
|
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').then((existing) => existing.should.be.true);
|
isExisting('.has-error #teamUrlInput').then((existing) => {
|
||||||
|
existing.should.be.true;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Valid server name', () => {
|
describe('Valid server name', () => {
|
||||||
@@ -343,12 +403,16 @@ 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').then((existing) => existing.should.be.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').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', () => {
|
it('should be valid', () => {
|
||||||
return this.app.client.
|
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', () => {
|
it('should not be possible to click save', () => {
|
||||||
return this.app.client.
|
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').
|
setValue('#teamUrlInput', 'superInvalid url').
|
||||||
click('#saveNewServerModal').
|
click('#saveNewServerModal').
|
||||||
pause(500).
|
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', () => {
|
describe('Valid Team Settings', () => {
|
||||||
@@ -387,7 +457,9 @@ 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').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) => {
|
it('should add the team to the config file', (done) => {
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
/* eslint-disable no-unused-expressions */
|
|
||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const env = require('../modules/environment');
|
const env = require('../modules/environment');
|
||||||
|
@@ -54,8 +54,12 @@ 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().then((enabled) => enabled.should.be.false).
|
windowByIndex(1).isNodeEnabled().then((enabled) => {
|
||||||
windowByIndex(2).isNodeEnabled().then((enabled) => enabled.should.be.false).
|
enabled.should.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 +82,9 @@ 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().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', () => {
|
it('should NOT be able to call eval() in any window', () => {
|
||||||
@@ -90,7 +96,9 @@ describe('application', function desc() {
|
|||||||
return eval('1 + 1');
|
return eval('1 + 1');
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
throw new Error(`Promise was unexpectedly fulfilled (result: ${result})`);
|
throw new Error(`Promise was unexpectedly fulfilled (result: ${result})`);
|
||||||
}, (error) => (error !== null).should.be.true);
|
}, (error) => {
|
||||||
|
(error !== null).should.be.true;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
const tryEvalInSettingsPage = () => {
|
const tryEvalInSettingsPage = () => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
@@ -100,7 +108,9 @@ describe('application', function desc() {
|
|||||||
return eval('1 + 1');
|
return eval('1 + 1');
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
throw new Error(`Promise was unexpectedly fulfilled (result: ${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([
|
return Promise.all([
|
||||||
tryEval(0),
|
tryEval(0),
|
||||||
|
Reference in New Issue
Block a user