Fix tests for auto-saving

This commit is contained in:
Yuya Ochiai
2017-02-15 22:44:51 +09:00
parent 3447d49cbd
commit f2e26ec276
2 changed files with 8 additions and 16 deletions

View File

@@ -417,6 +417,7 @@ const SettingsPage = React.createClass({
<div style={{position: 'relative'}}>
<h1 style={settingsPage.heading}>{'Settings'}</h1>
<Button
id='btnClose'
bsStyle='link'
style={settingsPage.close}
onClick={this.handleCancel}

View File

@@ -31,20 +31,11 @@ describe('browser/settings.html', function desc() {
return true;
});
it('should show index.html when Cancel button is clicked', () => {
it('should show index.html when Close button is clicked', () => {
env.addClientCommands(this.app.client);
return this.app.client.
loadSettingsPage().
click('#btnCancel').
pause(1000).
getUrl().should.eventually.match(/\/index.html(\?.+)?$/);
});
it('should show index.html when Save button is clicked', () => {
env.addClientCommands(this.app.client);
return this.app.client.
loadSettingsPage().
click('#btnSave').
click('#btnClose').
pause(1000).
getUrl().should.eventually.match(/\/index.html(\?.+)?$/);
});
@@ -109,7 +100,7 @@ describe('browser/settings.html', function desc() {
}
return true;
}).
click('#btnSave').
click('#btnClose').
pause(1000).then(() => {
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
savedConfig.hideMenuBar.should.equal(v);
@@ -142,7 +133,7 @@ describe('browser/settings.html', function desc() {
}
return true;
}).
click('#btnSave').
click('#btnClose').
pause(1000).then(() => {
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
savedConfig.disablewebsecurity.should.equal(!v);
@@ -248,7 +239,7 @@ describe('browser/settings.html', function desc() {
element('.modal-dialog').click('.btn=Remove').
pause(500).
isExisting(modalTitleSelector).should.eventually.false.
click('#btnSave').
click('#btnClose').
pause(500).then(() => {
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
savedConfig.teams.should.deep.equal(config.teams.slice(1));
@@ -261,7 +252,7 @@ describe('browser/settings.html', function desc() {
element('.modal-dialog').click('.btn=Cancel').
pause(500).
isExisting(modalTitleSelector).should.eventually.false.
click('#btnSave').
click('#btnClose').
pause(500).then(() => {
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
savedConfig.teams.should.deep.equal(config.teams);
@@ -374,7 +365,7 @@ describe('browser/settings.html', function desc() {
this.app.client.
click('#saveNewServerModal').
pause(1000). // Animation
click('#btnSave').
click('#btnClose').
pause(1000).then(() => {
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
savedConfig.teams.should.contain({