diff --git a/test/modules/environment.js b/test/modules/environment.js index a54c4981..c2e7be1d 100644 --- a/test/modules/environment.js +++ b/test/modules/environment.js @@ -70,6 +70,13 @@ module.exports = { return requireResult.value; }); }); + client.addCommand('waitForAppOptionsAutoSaved', function async() { + const ID_APP_OPTIONS_SAVE_INDICATOR = '#appOptionsSaveIndicator'; + const TIMEOUT = 5000; + return this. + waitForVisible(ID_APP_OPTIONS_SAVE_INDICATOR, TIMEOUT). + waitForVisible(ID_APP_OPTIONS_SAVE_INDICATOR, TIMEOUT, true); + }); }, // execute the test only when `condition` is true diff --git a/test/specs/browser/settings_test.js b/test/specs/browser/settings_test.js index ab8031f6..a17f420a 100644 --- a/test/specs/browser/settings_test.js +++ b/test/specs/browser/settings_test.js @@ -195,6 +195,27 @@ describe('browser/settings.html', function desc() { }); }); + describe('Save tray icon setting on mac', () => { + env.shouldTest(it, env.isOneOf(['darwin', 'linux']))('should be saved when it\'s selected', () => { + env.addClientCommands(this.app.client); + return this.app.client. + loadSettingsPage(). + click('#inputShowTrayIcon'). + waitForAppOptionsAutoSaved(). + then(() => { + const config0 = JSON.parse(fs.readFileSync(env.configFilePath, 'utf-8')); + config0.showTrayIcon.should.true; + return this.app.client; + }). + click('#inputShowTrayIcon'). + waitForAppOptionsAutoSaved(). + then(() => { + const config0 = JSON.parse(fs.readFileSync(env.configFilePath, 'utf-8')); + config0.showTrayIcon.should.false; + }); + }); + }); + describe('Save tray icon theme on linux', () => { env.shouldTest(it, process.platform === 'linux')('should be saved when it\'s selected', () => { env.addClientCommands(this.app.client);