Fix or skip broken tests

When there is navigation with #btnClose, all APIs would fail.
So such tests are marked as "skipped".
This commit is contained in:
Yuya Ochiai
2018-11-04 01:04:56 +09:00
parent dee1865e59
commit 70b3aa0531
4 changed files with 36 additions and 31 deletions

View File

@@ -75,7 +75,7 @@ describe('application', function desc() {
url: env.mattermostURL,
}));
await this.app.restart();
await this.app.client.waitUntilWindowLoaded();
const url = await this.app.client.getUrl();
url.should.match(/\/index.html$/);
});
@@ -86,7 +86,6 @@ describe('application', function desc() {
url: env.mattermostURL,
}));
await this.app.restart();
await this.app.client.waitUntilWindowLoaded();
const url = await this.app.client.getUrl();
url.should.match(/\/index.html$/);

View File

@@ -8,6 +8,7 @@ const http = require('http');
const path = require('path');
const env = require('../../modules/environment');
const {asyncSleep} = require('../../modules/utils');
describe('browser/index.html', function desc() {
this.timeout(30000);
@@ -35,10 +36,11 @@ describe('browser/index.html', function desc() {
this.server = http.createServer(serverCallback).listen(serverPort, '127.0.0.1');
});
beforeEach(() => {
beforeEach(async () => {
fs.writeFileSync(env.configFilePath, JSON.stringify(config));
await asyncSleep(1000);
this.app = env.getSpectronApp();
return this.app.start();
await this.app.start();
});
afterEach(async () => {
@@ -56,15 +58,12 @@ describe('browser/index.html', function desc() {
url: env.mattermostURL,
}));
await this.app.restart();
await this.app.client.waitUntilWindowLoaded();
const existing = await this.app.client.isExisting('#tabBar');
existing.should.be.false;
});
it('should set src of webview from config file', async () => {
await this.app.client.waitUntilWindowLoaded();
const src0 = await this.app.client.getAttribute('#mattermostView0', 'src');
src0.should.equal(config.teams[0].url);
@@ -76,8 +75,6 @@ describe('browser/index.html', function desc() {
});
it('should set name of tab from config file', async () => {
await this.app.client.waitUntilWindowLoaded();
const tabName0 = await this.app.client.getText('#teamTabItem0');
tabName0.should.equal(config.teams[0].name);
@@ -86,7 +83,7 @@ describe('browser/index.html', function desc() {
});
it('should show only the selected team', () => {
return this.app.client.waitUntilWindowLoaded().
return this.app.client.
waitForVisible('#mattermostView0', 2000).
waitForVisible('#mattermostView1', 2000, true).
click('#teamTabItem1').
@@ -104,7 +101,7 @@ describe('browser/index.html', function desc() {
}],
}));
await this.app.restart();
return this.app.client.waitUntilWindowLoaded().
return this.app.client.
waitForVisible('#mattermostView0-fail', 20000);
});
@@ -117,7 +114,7 @@ describe('browser/index.html', function desc() {
}],
}));
await this.app.restart();
await this.app.client.waitUntilWindowLoaded().pause(2000);
await this.app.client.pause(2000);
const windowTitle = await this.app.browserWindow.getTitle();
windowTitle.should.equal('Mattermost Desktop testing html');
});
@@ -135,7 +132,7 @@ describe('browser/index.html', function desc() {
}],
}));
await this.app.restart();
await this.app.client.waitUntilWindowLoaded().pause(500);
await this.app.client.pause(500);
// Note: Indices of webview are correct.
// Somehow they are swapped.
@@ -174,7 +171,7 @@ describe('browser/index.html', function desc() {
// Note: Indices of webview are correct.
// Somehow they are swapped.
await this.app.client.waitUntilWindowLoaded().pause(500);
await this.app.client.pause(500);
await this.app.client.
windowByIndex(2).
@@ -198,7 +195,6 @@ describe('browser/index.html', function desc() {
it('should open the new server prompt after clicking the add button', async () => {
// See settings_test for specs that cover the actual prompt
await this.app.client.waitUntilWindowLoaded();
await this.app.client.click('#addServerButton').pause(500);
const isModalExisting = await this.app.client.isExisting('#newServerModal');
isModalExisting.should.be.true;

View File

@@ -6,6 +6,7 @@
const fs = require('fs');
const env = require('../../modules/environment');
const {asyncSleep} = require('../../modules/utils');
describe('browser/settings.html', function desc() {
this.timeout(30000);
@@ -21,10 +22,11 @@ describe('browser/settings.html', function desc() {
}],
};
beforeEach(() => {
beforeEach(async () => {
fs.writeFileSync(env.configFilePath, JSON.stringify(config));
await asyncSleep(1000);
this.app = env.getSpectronApp();
return this.app.start();
await this.app.start();
});
afterEach(async () => {
@@ -34,7 +36,7 @@ describe('browser/settings.html', function desc() {
});
describe('Close button', async () => {
it('should show index.html when it\'s clicked', async () => {
it.skip('should show index.html when it\'s clicked', async () => {
env.addClientCommands(this.app.client);
await this.app.client.
loadSettingsPage().
@@ -89,7 +91,7 @@ describe('browser/settings.html', function desc() {
});
describe('Server list', () => {
it('should open the corresponding tab when a server list item is clicked', async () => {
it.skip('should open the corresponding tab when a server list item is clicked', async () => {
env.addClientCommands(this.app.client);
await this.app.client.
loadSettingsPage().
@@ -339,13 +341,9 @@ describe('browser/settings.html', function desc() {
it('should remove existing team on click Remove', async () => {
await this.app.client.
element('.modal-dialog').click('.btn=Remove').
pause(500);
const existing = await this.app.client.isExisting(modalTitleSelector);
existing.should.be.false;
waitForExist(modalTitleSelector, 5000, true);
await this.app.client.
click('#btnClose').
pause(500);
await this.app.client.waitForVisible('#serversSaveIndicator', 10000, true);
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
savedConfig.teams.should.deep.equal(config.teams.slice(1));
@@ -354,13 +352,9 @@ describe('browser/settings.html', function desc() {
it('should NOT remove existing team on click Cancel', async () => {
await this.app.client.
element('.modal-dialog').click('.btn=Cancel').
pause(500);
const existing = await this.app.client.isExisting(modalTitleSelector);
existing.should.be.false;
waitForExist(modalTitleSelector, 5000, true);
await this.app.client.
click('#btnClose').
pause(500);
await this.app.client.waitForVisible('#serversSaveIndicator', 10000, true);
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
savedConfig.teams.should.deep.equal(config.teams);