d2435a561c
* wip * background download * various fixes * wip * wokring autoupgrade * fix menu * fix windows * cleanup * add publishername * fix messages and titles * Test updates * Moved module and added functionality to click icon to install (instead of just download) * Add auto update setting, update on close app if downloaded * Tests, changes for security fixes, update version number * Update E2E tests * Lint fix * Update to latest electron-updater * Revert to stable electron-builder (only needed to update electron-updater) * Fix package-lock * skip flaky test * Update package * Fix E2E test * Fixes for enabling/disabled autoupdater * Fixed GPO definitions * [MM-38300] Set localhost as the test server * blank * Switch to s3 bucket for testing * Update icons to match spec * Add menu items for download/update actions * Type and test fixes * Fix notification circle * Fix macOS app not restarting on Restart/Update * Update dialog box titles * Turn off file system check for Linux * Changes to support deployments * Testing autoupdater deployments to s3 * disable tests for now * asfrehwf * fine no windows WHATEVER * remove windows again * Try universal all in one * pffftttngggguhhhh * make sure it's working * Missed artifacts script * Modify destination as well * one more time! * Update yml files * Oops * add yq manually * oof * Fix the script to work properly * Fix release script * Fix script again so it runs in time * Build version 2 * Revert build specific changes * Lint override * Fix build apps for PR builds * One more change * Add file generation for .deb repo * Deb repo test * skip tests for now * Fix artifact push * Persist after repo creation * Put tests back * Fix unit tests * Enable mac generated builds temp * Temporarily disable tests * Fix issue where notification doesn't pop dialog box * Try version 2 again * Put the version back * Attempting to debug mac app path issue * Fix issue where Mac app will quarantine itself after first update * Lock versions of yq * Fix yq for mac * As usual, Mac is difficult :P * Add quotes to anti-quarantine command * Change to spawn to avoid command injection * Oops * Nightly deployment changes (#2005) * Test nightly deploy * I fixed a some things * aaaaaaaaa * Restore old bucket * Added progress indicator via tooltip * Ship nightly builds to main S3 bucket * PR feedback * Fix a couple security exploits * Fix opacity on light mode button * Use large app icon * Resize icon for Windows * Resize icon for Mac * Update to electron-updater final * Remove Mac support and deb repo * Typo * Remove deb script * Remove checksum function * Removed autoUpdateSettingsPath * Update URL Co-authored-by: = <=> Co-authored-by: Devin Binnie <devin.binnie@mattermost.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com> Co-authored-by: Devin Binnie <52460000+devinbinnie@users.noreply.github.com>
241 lines
12 KiB
JavaScript
241 lines
12 KiB
JavaScript
// Copyright (c) 2015-2016 Yuya Ochiai
|
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
'use strict';
|
|
|
|
const fs = require('fs');
|
|
|
|
const {SHOW_SETTINGS_WINDOW} = require('../../src/common/communication');
|
|
|
|
const env = require('../modules/environment');
|
|
const {asyncSleep} = require('../modules/utils');
|
|
|
|
describe('Settings', function desc() {
|
|
this.timeout(30000);
|
|
|
|
const config = env.demoConfig;
|
|
|
|
beforeEach(async () => {
|
|
env.createTestUserDataDir();
|
|
env.cleanTestConfig();
|
|
fs.writeFileSync(env.configFilePath, JSON.stringify(config));
|
|
await asyncSleep(1000);
|
|
this.app = await env.getApp();
|
|
});
|
|
|
|
afterEach(async () => {
|
|
if (this.app) {
|
|
await this.app.close();
|
|
}
|
|
});
|
|
|
|
describe('Options', () => {
|
|
describe('Start app on login', () => {
|
|
it('MM-T4392 should appear on win32 or linux', async () => {
|
|
const expected = (process.platform === 'win32' || process.platform === 'linux');
|
|
this.app.evaluate(({ipcMain}, showWindow) => {
|
|
ipcMain.emit(showWindow);
|
|
}, SHOW_SETTINGS_WINDOW);
|
|
const settingsWindow = await this.app.waitForEvent('window', {
|
|
predicate: (window) => window.url().includes('settings'),
|
|
});
|
|
await settingsWindow.waitForSelector('.settingsPage.container');
|
|
await settingsWindow.waitForSelector('#inputAutoStart');
|
|
const existing = await settingsWindow.isVisible('#inputAutoStart');
|
|
existing.should.equal(expected);
|
|
});
|
|
});
|
|
|
|
describe('Show icon in menu bar / notification area', () => {
|
|
it('MM-T4393_1 should appear on darwin or linux', async () => {
|
|
const expected = (process.platform === 'darwin' || process.platform === 'linux');
|
|
this.app.evaluate(({ipcMain}, showWindow) => {
|
|
ipcMain.emit(showWindow);
|
|
}, SHOW_SETTINGS_WINDOW);
|
|
const settingsWindow = await this.app.waitForEvent('window', {
|
|
predicate: (window) => window.url().includes('settings'),
|
|
});
|
|
await settingsWindow.waitForSelector('.settingsPage.container');
|
|
await settingsWindow.waitForSelector('#inputShowTrayIcon');
|
|
const existing = await settingsWindow.isVisible('#inputShowTrayIcon');
|
|
existing.should.equal(expected);
|
|
});
|
|
|
|
describe('MM-T4393_2 Save tray icon setting on mac', () => {
|
|
env.shouldTest(it, env.isOneOf(['darwin', 'linux']))('should be saved when it\'s selected', async () => {
|
|
this.app.evaluate(({ipcMain}, showWindow) => {
|
|
ipcMain.emit(showWindow);
|
|
}, SHOW_SETTINGS_WINDOW);
|
|
const settingsWindow = await this.app.waitForEvent('window', {
|
|
predicate: (window) => window.url().includes('settings'),
|
|
});
|
|
await settingsWindow.waitForSelector('.settingsPage.container');
|
|
await settingsWindow.click('#inputShowTrayIcon');
|
|
await settingsWindow.waitForSelector('.appOptionsSaveIndicator :text("Saving...")');
|
|
await settingsWindow.waitForSelector('.appOptionsSaveIndicator :text("Saved")');
|
|
|
|
let config0 = JSON.parse(fs.readFileSync(env.configFilePath, 'utf-8'));
|
|
config0.showTrayIcon.should.true;
|
|
|
|
await settingsWindow.click('#inputShowTrayIcon');
|
|
await settingsWindow.waitForSelector('.appOptionsSaveIndicator :text("Saving...")');
|
|
await settingsWindow.waitForSelector('.appOptionsSaveIndicator :text("Saved")');
|
|
|
|
config0 = JSON.parse(fs.readFileSync(env.configFilePath, 'utf-8'));
|
|
config0.showTrayIcon.should.false;
|
|
});
|
|
});
|
|
|
|
describe('MM-T4393_3 Save tray icon theme on linux', () => {
|
|
env.shouldTest(it, process.platform === 'linux')('should be saved when it\'s selected', async () => {
|
|
this.app.evaluate(({ipcMain}, showWindow) => {
|
|
ipcMain.emit(showWindow);
|
|
}, SHOW_SETTINGS_WINDOW);
|
|
const settingsWindow = await this.app.waitForEvent('window', {
|
|
predicate: (window) => window.url().includes('settings'),
|
|
});
|
|
await settingsWindow.waitForSelector('.settingsPage.container');
|
|
await settingsWindow.click('#inputShowTrayIcon');
|
|
await settingsWindow.click('input[value="dark"]');
|
|
await settingsWindow.waitForSelector('.appOptionsSaveIndicator :text("Saving...")');
|
|
await settingsWindow.waitForSelector('.appOptionsSaveIndicator :text("Saved")');
|
|
|
|
const config0 = JSON.parse(fs.readFileSync(env.configFilePath, 'utf-8'));
|
|
config0.trayIconTheme.should.equal('dark');
|
|
|
|
await settingsWindow.click('input[value="light"]');
|
|
await settingsWindow.waitForSelector('.appOptionsSaveIndicator :text("Saving...")');
|
|
await settingsWindow.waitForSelector('.appOptionsSaveIndicator :text("Saved")');
|
|
|
|
const config1 = JSON.parse(fs.readFileSync(env.configFilePath, 'utf-8'));
|
|
config1.trayIconTheme.should.equal('light');
|
|
});
|
|
});
|
|
});
|
|
|
|
describe('Leave app running in notification area when application window is closed', () => {
|
|
it('MM-T4394 should appear on linux', async () => {
|
|
const expected = (process.platform === 'linux');
|
|
this.app.evaluate(({ipcMain}, showWindow) => {
|
|
ipcMain.emit(showWindow);
|
|
}, SHOW_SETTINGS_WINDOW);
|
|
const settingsWindow = await this.app.waitForEvent('window', {
|
|
predicate: (window) => window.url().includes('settings'),
|
|
});
|
|
await settingsWindow.waitForSelector('.settingsPage.container');
|
|
const existing = await settingsWindow.isVisible('#inputMinimizeToTray');
|
|
existing.should.equal(expected);
|
|
});
|
|
});
|
|
|
|
describe('Flash app window and taskbar icon when a new message is received', () => {
|
|
it('MM-T4395 should appear on win32 and linux', async () => {
|
|
const expected = (process.platform === 'win32' || process.platform === 'linux');
|
|
this.app.evaluate(({ipcMain}, showWindow) => {
|
|
ipcMain.emit(showWindow);
|
|
}, SHOW_SETTINGS_WINDOW);
|
|
const settingsWindow = await this.app.waitForEvent('window', {
|
|
predicate: (window) => window.url().includes('settings'),
|
|
});
|
|
await settingsWindow.waitForSelector('.settingsPage.container');
|
|
const existing = await settingsWindow.isVisible('#inputflashWindow');
|
|
existing.should.equal(expected);
|
|
});
|
|
});
|
|
|
|
describe('Show red badge on taskbar icon to indicate unread messages', () => {
|
|
it('MM-T4396 should appear on darwin or win32', async () => {
|
|
const expected = (process.platform === 'darwin' || process.platform === 'win32');
|
|
this.app.evaluate(({ipcMain}, showWindow) => {
|
|
ipcMain.emit(showWindow);
|
|
}, SHOW_SETTINGS_WINDOW);
|
|
const settingsWindow = await this.app.waitForEvent('window', {
|
|
predicate: (window) => window.url().includes('settings'),
|
|
});
|
|
await settingsWindow.waitForSelector('.settingsPage.container');
|
|
const existing = await settingsWindow.isVisible('#inputShowUnreadBadge');
|
|
existing.should.equal(expected);
|
|
});
|
|
});
|
|
|
|
describe('Check spelling', () => {
|
|
it('MM-T4397 should appear and be selectable', async () => {
|
|
this.app.evaluate(({ipcMain}, showWindow) => {
|
|
ipcMain.emit(showWindow);
|
|
}, SHOW_SETTINGS_WINDOW);
|
|
const settingsWindow = await this.app.waitForEvent('window', {
|
|
predicate: (window) => window.url().includes('settings'),
|
|
});
|
|
await settingsWindow.waitForSelector('.settingsPage.container');
|
|
const existing = await settingsWindow.isVisible('#inputSpellChecker');
|
|
existing.should.equal(true);
|
|
|
|
const selected = await settingsWindow.isChecked('#inputSpellChecker');
|
|
selected.should.equal(true);
|
|
|
|
await settingsWindow.click('#inputSpellChecker');
|
|
await settingsWindow.waitForSelector('.appOptionsSaveIndicator :text("Saving...")');
|
|
await settingsWindow.waitForSelector('.appOptionsSaveIndicator :text("Saved")');
|
|
|
|
const config1 = JSON.parse(fs.readFileSync(env.configFilePath, 'utf-8'));
|
|
config1.useSpellChecker.should.equal(false);
|
|
});
|
|
});
|
|
|
|
describe('Enable GPU hardware acceleration', () => {
|
|
it('MM-T4398 should save selected option', async () => {
|
|
const ID_INPUT_ENABLE_HARDWARE_ACCELERATION = '#inputEnableHardwareAcceleration';
|
|
this.app.evaluate(({ipcMain}, showWindow) => {
|
|
ipcMain.emit(showWindow);
|
|
}, SHOW_SETTINGS_WINDOW);
|
|
const settingsWindow = await this.app.waitForEvent('window', {
|
|
predicate: (window) => window.url().includes('settings'),
|
|
});
|
|
await settingsWindow.waitForSelector('.settingsPage.container');
|
|
const selected = await settingsWindow.isChecked(ID_INPUT_ENABLE_HARDWARE_ACCELERATION);
|
|
selected.should.equal(true); // default is true
|
|
|
|
await settingsWindow.click(ID_INPUT_ENABLE_HARDWARE_ACCELERATION);
|
|
await settingsWindow.waitForSelector('.appOptionsSaveIndicator :text("Saving...")');
|
|
await settingsWindow.waitForSelector('.appOptionsSaveIndicator :text("Saved")');
|
|
const config0 = JSON.parse(fs.readFileSync(env.configFilePath, 'utf-8'));
|
|
config0.enableHardwareAcceleration.should.equal(false);
|
|
|
|
await settingsWindow.click(ID_INPUT_ENABLE_HARDWARE_ACCELERATION);
|
|
await settingsWindow.waitForSelector('.appOptionsSaveIndicator :text("Saving...")');
|
|
await settingsWindow.waitForSelector('.appOptionsSaveIndicator :text("Saved")');
|
|
const config1 = JSON.parse(fs.readFileSync(env.configFilePath, 'utf-8'));
|
|
config1.enableHardwareAcceleration.should.equal(true);
|
|
});
|
|
});
|
|
|
|
describe('Enable automatic check for updates', () => {
|
|
it('MM-T4549 should save selected option', async () => {
|
|
const ID_INPUT_ENABLE_AUTO_UPDATES = '#inputAutoCheckForUpdates';
|
|
this.app.evaluate(({ipcMain}, showWindow) => {
|
|
ipcMain.emit(showWindow);
|
|
}, SHOW_SETTINGS_WINDOW);
|
|
const settingsWindow = await this.app.waitForEvent('window', {
|
|
predicate: (window) => window.url().includes('settings'),
|
|
});
|
|
await settingsWindow.waitForSelector('.settingsPage.container');
|
|
const selected = await settingsWindow.isChecked(ID_INPUT_ENABLE_AUTO_UPDATES);
|
|
selected.should.equal(true); // default is true
|
|
|
|
await settingsWindow.click(ID_INPUT_ENABLE_AUTO_UPDATES);
|
|
await settingsWindow.waitForSelector('.updatesSaveIndicator :text("Saving...")');
|
|
await settingsWindow.waitForSelector('.updatesSaveIndicator :text("Saved")');
|
|
const config0 = JSON.parse(fs.readFileSync(env.configFilePath, 'utf-8'));
|
|
config0.autoCheckForUpdates.should.equal(false);
|
|
|
|
await settingsWindow.click(ID_INPUT_ENABLE_AUTO_UPDATES);
|
|
await settingsWindow.waitForSelector('.updatesSaveIndicator :text("Saving...")');
|
|
await settingsWindow.waitForSelector('.updatesSaveIndicator :text("Saved")');
|
|
const config1 = JSON.parse(fs.readFileSync(env.configFilePath, 'utf-8'));
|
|
config1.autoCheckForUpdates.should.equal(true);
|
|
});
|
|
});
|
|
});
|
|
});
|