From 4fa89a5fce0a47d0dc805a82364f43829c98095d Mon Sep 17 00:00:00 2001 From: Devin Binnie <52460000+devinbinnie@users.noreply.github.com> Date: Fri, 19 Nov 2021 10:21:34 -0500 Subject: [PATCH] [MM-40144] Restructure tests, add test case numbers, some cleanup (#1864) * [MM-40144] Restructure tests, add test case numbers, some cleanup * Fix a test --- .eslintrc.json | 8 +- e2e/modules/environment.js | 65 +++ e2e/specs/browser/modal_test.js | 520 ------------------ e2e/specs/config_test.js | 116 ---- e2e/specs/deep_linking/deeplink.test.js | 49 ++ e2e/specs/deeplink_test.js | 111 ---- e2e/specs/index.js | 13 - e2e/specs/mattermost_test.js | 106 ---- .../dropdown.test.js} | 110 +--- e2e/specs/menu_bar/menu.test.js | 50 ++ e2e/specs/menu_bar/view_menu.test.js | 87 +++ e2e/specs/menu_bar/window_menu.test.js | 79 +++ e2e/specs/menu_test.js | 176 ------ .../add_server_modal.test.js | 155 ++++++ .../edit_server_modal.test.js | 280 ++++++++++ .../remove_server_modal.test.js | 78 +++ .../settings_test.js => settings.test.js} | 92 +--- .../{app_test.js => startup/app.test.js} | 10 +- e2e/specs/startup/config.test.js | 76 +++ .../window.test.js} | 8 +- webpack.config.test.js | 3 +- 21 files changed, 963 insertions(+), 1229 deletions(-) delete mode 100644 e2e/specs/browser/modal_test.js delete mode 100644 e2e/specs/config_test.js create mode 100644 e2e/specs/deep_linking/deeplink.test.js delete mode 100644 e2e/specs/deeplink_test.js delete mode 100644 e2e/specs/index.js delete mode 100644 e2e/specs/mattermost_test.js rename e2e/specs/{browser/index_test.js => menu_bar/dropdown.test.js} (62%) create mode 100644 e2e/specs/menu_bar/menu.test.js create mode 100644 e2e/specs/menu_bar/view_menu.test.js create mode 100644 e2e/specs/menu_bar/window_menu.test.js delete mode 100644 e2e/specs/menu_test.js create mode 100644 e2e/specs/server_management/add_server_modal.test.js create mode 100644 e2e/specs/server_management/edit_server_modal.test.js create mode 100644 e2e/specs/server_management/remove_server_modal.test.js rename e2e/specs/{browser/settings_test.js => settings.test.js} (78%) rename e2e/specs/{app_test.js => startup/app.test.js} (79%) create mode 100644 e2e/specs/startup/config.test.js rename e2e/specs/{window_test.js => startup/window.test.js} (87%) diff --git a/.eslintrc.json b/.eslintrc.json index 4c59f5c6..d6d083fb 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -58,12 +58,8 @@ { "files": [ "webpack.config.renderer.js", - "e2e/specs/spellchecker_test.js", - "e2e/specs/app_test.js", - "e2e/specs/security_test.js", - "e2e/specs/permisson_test.js", - "e2e/specs/browser/index_test.js", - "e2e/specs/browser/settings_test.js", + "e2e/specs/startup/app.test.js", + "e2e/specs/settings.test.js", "e2e/modules/utils.js", "e2e/modules/environment.js", "CHANGELOG.md", diff --git a/e2e/modules/environment.js b/e2e/modules/environment.js index 0a812611..1dc55fb5 100644 --- a/e2e/modules/environment.js +++ b/e2e/modules/environment.js @@ -29,12 +29,77 @@ const configFilePath = path.join(userDataDir, 'config.json'); const boundsInfoPath = path.join(userDataDir, 'bounds-info.json'); const mattermostURL = 'http://example.com/'; +const demoConfig = { + version: 3, + teams: [{ + name: 'example', + url: mattermostURL, + order: 0, + tabs: [ + { + name: 'TAB_MESSAGING', + order: 0, + isOpen: true, + }, + { + name: 'TAB_FOCALBOARD', + order: 1, + isOpen: true, + }, + { + name: 'TAB_PLAYBOOKS', + order: 2, + isOpen: true, + }, + ], + lastActiveTab: 0, + }, { + name: 'github', + url: 'https://github.com/', + order: 1, + tabs: [ + { + name: 'TAB_MESSAGING', + order: 0, + isOpen: true, + }, + { + name: 'TAB_FOCALBOARD', + order: 1, + isOpen: true, + }, + { + name: 'TAB_PLAYBOOKS', + order: 2, + isOpen: true, + }, + ], + lastActiveTab: 0, + }], + showTrayIcon: false, + trayIconTheme: 'light', + minimizeToTray: false, + notifications: { + flashWindow: 0, + bounceIcon: false, + bounceIconType: 'informational', + }, + showUnreadBadge: true, + useSpellChecker: true, + enableHardwareAcceleration: true, + autostart: true, + darkMode: false, + lastActiveTeam: 0, + spellCheckerLocales: [], +}; + module.exports = { sourceRootDir, configFilePath, userDataDir, boundsInfoPath, mattermostURL, + demoConfig, cleanTestConfig() { [configFilePath, boundsInfoPath].forEach((file) => { diff --git a/e2e/specs/browser/modal_test.js b/e2e/specs/browser/modal_test.js deleted file mode 100644 index 1852b7d1..00000000 --- a/e2e/specs/browser/modal_test.js +++ /dev/null @@ -1,520 +0,0 @@ -// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -'use strict'; - -const fs = require('fs'); - -const env = require('../../modules/environment'); -const {asyncSleep} = require('../../modules/utils'); - -describe('modals', function desc() { - this.timeout(30000); - - const config = { - version: 3, - teams: [{ - name: 'example', - url: env.mattermostURL, - order: 0, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - isOpen: true, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - isOpen: true, - }, - ], - lastActiveTab: 0, - }, { - name: 'github', - url: 'https://github.com/', - order: 1, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - isOpen: true, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - isOpen: true, - }, - ], - lastActiveTab: 0, - }], - showTrayIcon: false, - trayIconTheme: 'light', - minimizeToTray: false, - notifications: { - flashWindow: 0, - bounceIcon: false, - bounceIconType: 'informational', - }, - showUnreadBadge: true, - useSpellChecker: true, - enableHardwareAcceleration: true, - autostart: true, - darkMode: false, - lastActiveTeam: 0, - spellCheckerLocales: [], - }; - - 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('RemoveServerModal', () => { - let removeServerView; - - beforeEach(async () => { - const mainView = this.app.windows().find((window) => window.url().includes('index')); - const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown')); - await mainView.click('.TeamDropdownButton'); - await dropdownView.hover('.TeamDropdown .TeamDropdown__button:nth-child(1)'); - await dropdownView.click('.TeamDropdown .TeamDropdown__button:nth-child(1) button.TeamDropdown__button-remove'); - - removeServerView = await this.app.waitForEvent('window', { - predicate: (window) => window.url().includes('removeServer'), - }); - }); - - it('should remove existing team on click Remove', async () => { - await removeServerView.click('button:has-text("Remove")'); - await asyncSleep(1000); - - const expectedConfig = JSON.parse(JSON.stringify(config.teams.slice(1))); - expectedConfig.forEach((value) => { - value.order--; - }); - - const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8')); - savedConfig.teams.should.deep.equal(expectedConfig); - }); - - it('should NOT remove existing team on click Cancel', async () => { - await removeServerView.click('button:has-text("Cancel")'); - await asyncSleep(1000); - - const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8')); - savedConfig.teams.should.deep.equal(config.teams); - }); - - it('should disappear on click Close', async () => { - await removeServerView.click('button.close'); - await asyncSleep(1000); - const existing = Boolean(await this.app.windows().find((window) => window.url().includes('removeServer'))); - existing.should.be.false; - }); - - it('should disappear on click background', async () => { - await removeServerView.click('.modal', {position: {x: 20, y: 20}}); - await asyncSleep(1000); - const existing = Boolean(await this.app.windows().find((window) => window.url().includes('removeServer'))); - existing.should.be.false; - }); - }); - - describe('NewTeamModal', () => { - let newServerView; - - beforeEach(async () => { - const mainView = this.app.windows().find((window) => window.url().includes('index')); - const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown')); - await mainView.click('.TeamDropdownButton'); - await dropdownView.click('.TeamDropdown .TeamDropdown__button.addServer'); - newServerView = await this.app.waitForEvent('window', { - predicate: (window) => window.url().includes('newServer'), - }); - - // wait for autofocus to finish - await asyncSleep(500); - }); - - it('should open the new server modal', async () => { - const existing = Boolean(await this.app.windows().find((window) => window.url().includes('newServer'))); - existing.should.be.true; - }); - - it('should focus the first text input', async () => { - const isFocused = await newServerView.$eval('#teamNameInput', (el) => el === document.activeElement); - isFocused.should.be.true; - }); - - it('should close the window after clicking cancel', async () => { - await newServerView.click('#cancelNewServerModal'); - await asyncSleep(1000); - const existing = Boolean(await this.app.windows().find((window) => window.url().includes('newServer'))); - existing.should.be.false; - }); - - it('should not be valid if no team name has been set', async () => { - await newServerView.click('#saveNewServerModal'); - const existing = await newServerView.isVisible('#teamNameInput.is-invalid'); - existing.should.be.true; - }); - - it('should not be valid if no server address has been set', async () => { - await newServerView.click('#saveNewServerModal'); - const existing = await newServerView.isVisible('#teamUrlInput.is-invalid'); - existing.should.be.true; - }); - - describe('Valid server name', async () => { - beforeEach(async () => { - await newServerView.type('#teamNameInput', 'TestTeam'); - await newServerView.click('#saveNewServerModal'); - }); - - it('should not be marked invalid', async () => { - const existing = await newServerView.isVisible('#teamNameInput.is-invalid'); - existing.should.be.false; - }); - - it('should not be possible to click save', async () => { - const disabled = await newServerView.getAttribute('#saveNewServerModal', 'disabled'); - (disabled === '').should.be.true; - }); - }); - - describe('Valid server url', () => { - beforeEach(async () => { - await newServerView.type('#teamUrlInput', 'http://example.org'); - await newServerView.click('#saveNewServerModal'); - }); - - it('should be valid', async () => { - const existing = await newServerView.isVisible('#teamUrlInput.is-invalid'); - existing.should.be.false; - }); - - it('should not be possible to click save', async () => { - const disabled = await newServerView.getAttribute('#saveNewServerModal', 'disabled'); - (disabled === '').should.be.true; - }); - }); - - it('should not be valid if an invalid server address has been set', async () => { - await newServerView.type('#teamUrlInput', 'superInvalid url'); - await newServerView.click('#saveNewServerModal'); - const existing = await newServerView.isVisible('#teamUrlInput.is-invalid'); - existing.should.be.true; - }); - - describe('Valid Team Settings', () => { - beforeEach(async () => { - await newServerView.type('#teamUrlInput', 'http://example.org'); - await newServerView.type('#teamNameInput', 'TestTeam'); - }); - - it('should be possible to click add', async () => { - const disabled = await newServerView.getAttribute('#saveNewServerModal', 'disabled'); - (disabled === null).should.be.true; - }); - - it('should add the team to the config file', async () => { - await newServerView.click('#saveNewServerModal'); - await asyncSleep(1000); - const existing = Boolean(await this.app.windows().find((window) => window.url().includes('newServer'))); - existing.should.be.false; - - const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8')); - savedConfig.teams.should.deep.contain({ - name: 'TestTeam', - url: 'http://example.org', - order: 2, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - }, - ], - lastActiveTab: 0, - }); - }); - }); - }); - - describe('EditServerModal', () => { - let editServerView; - - beforeEach(async () => { - const mainView = this.app.windows().find((window) => window.url().includes('index')); - const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown')); - await mainView.click('.TeamDropdownButton'); - await dropdownView.hover('.TeamDropdown .TeamDropdown__button:nth-child(1)'); - await dropdownView.click('.TeamDropdown .TeamDropdown__button:nth-child(1) button.TeamDropdown__button-edit'); - - editServerView = await this.app.waitForEvent('window', { - predicate: (window) => window.url().includes('editServer'), - }); - }); - - it('should not edit team when Cancel is pressed', async () => { - await editServerView.click('#cancelNewServerModal'); - await asyncSleep(1000); - const existing = Boolean(await this.app.windows().find((window) => window.url().includes('editServer'))); - existing.should.be.false; - - const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8')); - savedConfig.teams.should.deep.contain({ - name: 'example', - url: env.mattermostURL, - order: 0, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - isOpen: true, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - isOpen: true, - }, - ], - lastActiveTab: 0, - }); - }); - - it('should not edit team when Save is pressed but nothing edited', async () => { - await editServerView.click('#saveNewServerModal'); - await asyncSleep(1000); - const existing = Boolean(await this.app.windows().find((window) => window.url().includes('editServer'))); - existing.should.be.false; - - const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8')); - savedConfig.teams.should.deep.contain({ - name: 'example', - url: env.mattermostURL, - order: 0, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - isOpen: true, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - isOpen: true, - }, - ], - lastActiveTab: 0, - }); - }); - - it('should edit team when Save is pressed and name edited', async () => { - await editServerView.fill('#teamNameInput', 'NewTestTeam'); - await editServerView.click('#saveNewServerModal'); - await asyncSleep(1000); - const existing = Boolean(await this.app.windows().find((window) => window.url().includes('editServer'))); - existing.should.be.false; - - const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8')); - savedConfig.teams.should.not.deep.contain({ - name: 'example', - url: env.mattermostURL, - order: 0, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - isOpen: true, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - isOpen: true, - }, - ], - lastActiveTab: 0, - }); - savedConfig.teams.should.deep.contain({ - name: 'NewTestTeam', - url: env.mattermostURL, - order: 0, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - isOpen: true, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - isOpen: true, - }, - ], - lastActiveTab: 0, - }); - }); - - it('should edit team when Save is pressed and URL edited', async () => { - await editServerView.fill('#teamUrlInput', 'http://google.com'); - await editServerView.click('#saveNewServerModal'); - await asyncSleep(1000); - const existing = Boolean(await this.app.windows().find((window) => window.url().includes('editServer'))); - existing.should.be.false; - - const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8')); - savedConfig.teams.should.not.deep.contain({ - name: 'example', - url: env.mattermostURL, - order: 0, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - isOpen: true, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - isOpen: true, - }, - ], - lastActiveTab: 0, - }); - savedConfig.teams.should.deep.contain({ - name: 'example', - url: 'http://google.com', - order: 0, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - isOpen: true, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - isOpen: true, - }, - ], - lastActiveTab: 0, - }); - }); - - it('should edit team when Save is pressed and both edited', async () => { - await editServerView.fill('#teamNameInput', 'NewTestTeam'); - await editServerView.fill('#teamUrlInput', 'http://google.com'); - await editServerView.click('#saveNewServerModal'); - await asyncSleep(1000); - const existing = Boolean(await this.app.windows().find((window) => window.url().includes('editServer'))); - existing.should.be.false; - - const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8')); - savedConfig.teams.should.not.deep.contain({ - name: 'example', - url: env.mattermostURL, - order: 0, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - isOpen: true, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - isOpen: true, - }, - ], - lastActiveTab: 0, - }); - savedConfig.teams.should.deep.contain({ - name: 'NewTestTeam', - url: 'http://google.com', - order: 0, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - isOpen: true, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - isOpen: true, - }, - ], - lastActiveTab: 0, - }); - }); - }); -}); diff --git a/e2e/specs/config_test.js b/e2e/specs/config_test.js deleted file mode 100644 index 046bb4fe..00000000 --- a/e2e/specs/config_test.js +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -'use strict'; - -const fs = require('fs'); - -const env = require('../modules/environment'); - -describe('config', function desc() { - this.timeout(30000); - - beforeEach(async () => { - env.createTestUserDataDir(); - env.cleanTestConfig(); - }); - - afterEach(async () => { - if (this.app) { - try { - await this.app.close(); - // eslint-disable-next-line no-empty - } catch (err) {} - } - }); - - it('should show servers in dropdown when there is config file', async () => { - const config = { - version: 3, - teams: [{ - name: 'example', - url: env.mattermostURL, - order: 0, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - isOpen: true, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - isOpen: true, - }, - ], - lastActiveTab: 0, - }, { - name: 'github', - url: 'https://github.com/', - order: 1, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - isOpen: true, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - isOpen: true, - }, - ], - lastActiveTab: 0, - }], - showTrayIcon: false, - trayIconTheme: 'light', - minimizeToTray: false, - notifications: { - flashWindow: 0, - bounceIcon: false, - bounceIconType: 'informational', - }, - showUnreadBadge: true, - useSpellChecker: true, - enableHardwareAcceleration: true, - autostart: true, - darkMode: false, - lastActiveTeam: 0, - spellCheckerLocales: [], - }; - fs.writeFileSync(env.configFilePath, JSON.stringify(config)); - this.app = await env.getApp(); - const mainWindow = this.app.windows().find((window) => window.url().includes('index')); - const dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton'); - dropdownButtonText.should.equal('example'); - await this.app.close(); - }); - - it('should upgrade v0 config file', async () => { - const Config = require('../../src/common/config').default; - const newConfig = new Config(env.configFilePath); - const oldConfig = { - url: env.mattermostURL, - }; - fs.writeFileSync(env.configFilePath, JSON.stringify(oldConfig)); - this.app = await env.getApp(); - const mainWindow = this.app.windows().find((window) => window.url().includes('index')); - const dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton:has-text("Primary team")'); - dropdownButtonText.should.equal('Primary team'); - - const str = fs.readFileSync(env.configFilePath, 'utf8'); - const upgradedConfig = JSON.parse(str); - upgradedConfig.version.should.equal(newConfig.defaultData.version); - await this.app.close(); - }); -}); diff --git a/e2e/specs/deep_linking/deeplink.test.js b/e2e/specs/deep_linking/deeplink.test.js new file mode 100644 index 00000000..8e4bf3bd --- /dev/null +++ b/e2e/specs/deep_linking/deeplink.test.js @@ -0,0 +1,49 @@ +// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +'use strict'; +const fs = require('fs'); + +const env = require('../../modules/environment'); +const {asyncSleep} = require('../../modules/utils'); + +describe('application', function desc() { + this.timeout(30000); + + const config = env.demoConfig; + + beforeEach(async () => { + env.cleanDataDir(); + env.createTestUserDataDir(); + env.cleanTestConfig(); + fs.writeFileSync(env.configFilePath, JSON.stringify(config)); + await asyncSleep(1000); + }); + + afterEach(async () => { + if (this.app) { + try { + await this.app.close(); + // eslint-disable-next-line no-empty + } catch (err) {} + } + }); + + if (process.platform === 'win32') { + it('MM-T1304/MM-T1306 should open the app on the requested deep link', async () => { + this.app = await env.getApp(['mattermost://github.com/test/url']); + this.serverMap = await env.getServerMap(this.app); + const mainWindow = await this.app.firstWindow(); + const browserWindow = await this.app.browserWindow(mainWindow); + const webContentsId = this.serverMap[`${config.teams[1].name}___TAB_MESSAGING`].webContentsId; + const isActive = await browserWindow.evaluate((window, id) => { + return window.getBrowserViews().find((view) => view.webContents.id === id).webContents.getURL(); + }, webContentsId); + isActive.should.equal('https://github.com/test/url'); + const mainView = this.app.windows().find((window) => window.url().includes('index')); + const dropdownButtonText = await mainView.innerText('.TeamDropdownButton'); + dropdownButtonText.should.equal('github'); + await this.app.close(); + }); + } +}); diff --git a/e2e/specs/deeplink_test.js b/e2e/specs/deeplink_test.js deleted file mode 100644 index 6c5324b5..00000000 --- a/e2e/specs/deeplink_test.js +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -'use strict'; -const fs = require('fs'); - -const env = require('../modules/environment'); -const {asyncSleep} = require('../modules/utils'); - -describe('application', function desc() { - this.timeout(30000); - - const config = { - version: 3, - teams: [{ - name: 'example', - url: env.mattermostURL, - order: 0, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - isOpen: false, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - isOpen: false, - }, - ], - lastActiveTab: 0, - }, { - name: 'github', - url: 'https://github.com/', - order: 1, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - isOpen: false, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - isOpen: false, - }, - ], - lastActiveTab: 0, - }], - showTrayIcon: false, - trayIconTheme: 'light', - minimizeToTray: false, - notifications: { - flashWindow: 0, - bounceIcon: false, - bounceIconType: 'informational', - }, - showUnreadBadge: true, - useSpellChecker: true, - enableHardwareAcceleration: true, - autostart: true, - darkMode: false, - lastActiveTeam: 0, - spellCheckerLocales: [], - }; - - beforeEach(async () => { - env.cleanDataDir(); - env.createTestUserDataDir(); - env.cleanTestConfig(); - fs.writeFileSync(env.configFilePath, JSON.stringify(config)); - await asyncSleep(1000); - }); - - afterEach(async () => { - if (this.app) { - try { - await this.app.close(); - // eslint-disable-next-line no-empty - } catch (err) {} - } - }); - - if (process.platform === 'win32') { - it('should open the app on the requested deep link', async () => { - this.app = await env.getApp(['mattermost://github.com/test/url']); - this.serverMap = await env.getServerMap(this.app); - const mainWindow = await this.app.firstWindow(); - const browserWindow = await this.app.browserWindow(mainWindow); - const webContentsId = this.serverMap[`${config.teams[1].name}___TAB_MESSAGING`].webContentsId; - const isActive = await browserWindow.evaluate((window, id) => { - return window.getBrowserViews().find((view) => view.webContents.id === id).webContents.getURL(); - }, webContentsId); - isActive.should.equal('https://github.com/test/url'); - const mainView = this.app.windows().find((window) => window.url().includes('index')); - const dropdownButtonText = await mainView.innerText('.TeamDropdownButton'); - dropdownButtonText.should.equal('github'); - await this.app.close(); - }); - } -}); diff --git a/e2e/specs/index.js b/e2e/specs/index.js deleted file mode 100644 index dfc43107..00000000 --- a/e2e/specs/index.js +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import './app_test.js'; -import './config_test.js'; -import './deeplink_test.js'; -import './mattermost_test.js'; -import './menu_test.js'; -import './window_test.js'; - -import './browser/index_test.js'; -import './browser/modal_test.js'; -import './browser/settings_test.js'; diff --git a/e2e/specs/mattermost_test.js b/e2e/specs/mattermost_test.js deleted file mode 100644 index 4f060d5a..00000000 --- a/e2e/specs/mattermost_test.js +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. -'use strict'; - -const fs = require('fs'); - -const env = require('../modules/environment'); -const {asyncSleep} = require('../modules/utils'); - -describe('mattermost', function desc() { - this.timeout(30000); - - const config = { - version: 3, - teams: [{ - name: 'example', - url: env.mattermostURL, - order: 0, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - isOpen: false, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - isOpen: false, - }, - ], - lastActiveTab: 0, - }, { - name: 'github', - url: 'https://github.com/', - order: 1, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - isOpen: false, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - isOpen: false, - }, - ], - lastActiveTab: 0, - }], - showTrayIcon: false, - trayIconTheme: 'light', - minimizeToTray: false, - notifications: { - flashWindow: 0, - bounceIcon: false, - bounceIconType: 'informational', - }, - showUnreadBadge: true, - useSpellChecker: true, - enableHardwareAcceleration: true, - autostart: true, - darkMode: false, - lastActiveTeam: 0, - spellCheckerLocales: [], - }; - - beforeEach(async () => { - env.cleanDataDir(); - env.createTestUserDataDir(); - env.cleanTestConfig(); - fs.writeFileSync(env.configFilePath, JSON.stringify(config)); - await asyncSleep(1000); - this.app = await env.getApp(); - this.serverMap = await env.getServerMap(this.app); - }); - - afterEach(async () => { - if (this.app) { - await this.app.close(); - } - }); - - // TODO: enable when we have a server to test against - it.skip('Control+F should focus the search bar in Mattermost', async () => { - const loadingScreen = this.app.windows().find((window) => window.url().includes('loadingScreen')); - await loadingScreen.waitForSelector('.LoadingScreen', {state: 'hidden'}); - const firstServer = this.serverMap[`${config.teams[0].name}___TAB_MESSAGING`].win; - await env.loginToMattermost(firstServer); - await firstServer.waitForSelector('#searchBox'); - await firstServer.press('body', process.platform === 'darwin' ? 'Meta+F' : 'Control+F'); - const isFocused = await firstServer.$eval('#searchBox', (el) => el === document.activeElement); - isFocused.should.be.true; - const text = await firstServer.inputValue('#searchBox'); - text.should.include('in:'); - }); -}); diff --git a/e2e/specs/browser/index_test.js b/e2e/specs/menu_bar/dropdown.test.js similarity index 62% rename from e2e/specs/browser/index_test.js rename to e2e/specs/menu_bar/dropdown.test.js index e36dc17e..cdd8a569 100644 --- a/e2e/specs/browser/index_test.js +++ b/e2e/specs/menu_bar/dropdown.test.js @@ -1,82 +1,16 @@ -// 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 http = require('http'); -// const path = require('path'); - const env = require('../../modules/environment'); const {asyncSleep} = require('../../modules/utils'); -describe('renderer/index.html', function desc() { +describe('menu_bar/dropdown', function desc() { this.timeout(30000); - const config = { - version: 3, - teams: [{ - name: 'example', - url: env.mattermostURL, - order: 0, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - isOpen: true, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - isOpen: true, - }, - ], - lastActiveTab: 0, - }, { - name: 'github', - url: 'https://github.com/', - order: 1, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - isOpen: true, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - isOpen: true, - }, - ], - lastActiveTab: 0, - }], - showTrayIcon: false, - trayIconTheme: 'light', - minimizeToTray: false, - notifications: { - flashWindow: 0, - bounceIcon: false, - bounceIconType: 'informational', - }, - showUnreadBadge: true, - useSpellChecker: true, - enableHardwareAcceleration: true, - autostart: true, - darkMode: false, - lastActiveTeam: 0, - spellCheckerLocales: [], - }; + const config = env.demoConfig; beforeEach(async () => { env.createTestUserDataDir(); @@ -92,15 +26,7 @@ describe('renderer/index.html', function desc() { } }); - it('should set src of browser view from config file', async () => { - const firstServer = this.app.windows().find((window) => window.url() === config.teams[0].url); - const secondServer = this.app.windows().find((window) => window.url() === config.teams[1].url); - - firstServer.should.not.be.null; - secondServer.should.not.be.null; - }); - - it('should set name of menu item from config file', async () => { + it('MM-T4405 should set name of menu item from config file', async () => { const mainWindow = this.app.windows().find((window) => window.url().includes('index')); const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown')); await mainWindow.click('.TeamDropdownButton'); @@ -111,7 +37,7 @@ describe('renderer/index.html', function desc() { secondMenuItem.should.equal(config.teams[1].name); }); - it('should only show dropdown when button is clicked', async () => { + it('MM-T4406 should only show dropdown when button is clicked', async () => { const mainWindow = await this.app.firstWindow(); const browserWindow = await this.app.browserWindow(mainWindow); const mainView = this.app.windows().find((window) => window.url().includes('index')); @@ -128,7 +54,20 @@ describe('renderer/index.html', function desc() { dropdownHeight.should.equal(0); }); - it('should show only the selected team', async () => { + it('MM-T4407 should open the new server prompt after clicking the add button', async () => { + const mainWindow = this.app.windows().find((window) => window.url().includes('index')); + const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown')); + await mainWindow.click('.TeamDropdownButton'); + await dropdownView.click('.TeamDropdown__button.addServer'); + + const newServerModal = await this.app.waitForEvent('window', { + predicate: (window) => window.url().includes('newServer'), + }); + const modalTitle = await newServerModal.innerText('#newServerModal .modal-title'); + modalTitle.should.equal('Add Server'); + }); + + it('MM-T4408 should show only the selected team', async () => { const mainWindow = await this.app.firstWindow(); const browserWindow = await this.app.browserWindow(mainWindow); @@ -147,17 +86,4 @@ describe('renderer/index.html', function desc() { secondViewIsAttached = await browserWindow.evaluate((window) => Boolean(window.getBrowserViews().find((view) => view.webContents.getURL() === 'https://github.com/'))); secondViewIsAttached.should.be.true; }); - - it('should open the new server prompt after clicking the add button', async () => { - const mainWindow = this.app.windows().find((window) => window.url().includes('index')); - const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown')); - await mainWindow.click('.TeamDropdownButton'); - await dropdownView.click('.TeamDropdown__button.addServer'); - - const newServerModal = await this.app.waitForEvent('window', { - predicate: (window) => window.url().includes('newServer'), - }); - const modalTitle = await newServerModal.innerText('#newServerModal .modal-title'); - modalTitle.should.equal('Add Server'); - }); }); diff --git a/e2e/specs/menu_bar/menu.test.js b/e2e/specs/menu_bar/menu.test.js new file mode 100644 index 00000000..6a64266c --- /dev/null +++ b/e2e/specs/menu_bar/menu.test.js @@ -0,0 +1,50 @@ +// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. +'use strict'; + +const fs = require('fs'); + +const robot = require('robotjs'); + +const env = require('../../modules/environment'); +const {asyncSleep} = require('../../modules/utils'); + +describe('menu/menu', function desc() { + this.timeout(30000); + + const config = env.demoConfig; + + beforeEach(async () => { + env.cleanDataDir(); + env.createTestUserDataDir(); + env.cleanTestConfig(); + fs.writeFileSync(env.configFilePath, JSON.stringify(config)); + await asyncSleep(1000); + this.app = await env.getApp(); + this.serverMap = await env.getServerMap(this.app); + }); + + afterEach(async () => { + if (this.app) { + await this.app.close(); + } + }); + + if (process.platform !== 'darwin') { + it('MM-T4404 should open the 3 dot menu with Alt', async () => { + const mainWindow = this.app.windows().find((window) => window.url().includes('index')); + mainWindow.should.not.be.null; + + // Settings window should open if Alt works + robot.keyTap('alt'); + robot.keyTap('enter'); + robot.keyTap('f'); + robot.keyTap('s'); + robot.keyTap('enter'); + const settingsWindow = await this.app.waitForEvent('window', { + predicate: (window) => window.url().includes('settings'), + }); + settingsWindow.should.not.be.null; + }); + } +}); diff --git a/e2e/specs/menu_bar/view_menu.test.js b/e2e/specs/menu_bar/view_menu.test.js new file mode 100644 index 00000000..54a3d83c --- /dev/null +++ b/e2e/specs/menu_bar/view_menu.test.js @@ -0,0 +1,87 @@ +// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. +'use strict'; + +const fs = require('fs'); + +const robot = require('robotjs'); + +const env = require('../../modules/environment'); +const {asyncSleep} = require('../../modules/utils'); + +async function setupPromise(window, id) { + const promise = new Promise((resolve) => { + const browserView = window.getBrowserViews().find((view) => view.webContents.id === id); + browserView.webContents.on('did-finish-load', () => { + resolve(); + }); + }); + await promise; + return true; +} + +describe('mattermost', function desc() { + this.timeout(30000); + + const config = env.demoConfig; + + beforeEach(async () => { + env.cleanDataDir(); + env.createTestUserDataDir(); + env.cleanTestConfig(); + fs.writeFileSync(env.configFilePath, JSON.stringify(config)); + await asyncSleep(1000); + this.app = await env.getApp(); + this.serverMap = await env.getServerMap(this.app); + }); + + afterEach(async () => { + if (this.app) { + await this.app.close(); + } + }); + + // TODO: enable when we have a server to test against + it.skip('MM-T813 Control+F should focus the search bar in Mattermost', async () => { + const loadingScreen = this.app.windows().find((window) => window.url().includes('loadingScreen')); + await loadingScreen.waitForSelector('.LoadingScreen', {state: 'hidden'}); + const firstServer = this.serverMap[`${config.teams[0].name}___TAB_MESSAGING`].win; + await env.loginToMattermost(firstServer); + await firstServer.waitForSelector('#searchBox'); + await firstServer.press('body', process.platform === 'darwin' ? 'Meta+F' : 'Control+F'); + const isFocused = await firstServer.$eval('#searchBox', (el) => el === document.activeElement); + isFocused.should.be.true; + const text = await firstServer.inputValue('#searchBox'); + text.should.include('in:'); + }); + + describe('Reload', () => { + let browserWindow; + let webContentsId; + + beforeEach(async () => { + const mainWindow = await this.app.firstWindow(); + browserWindow = await this.app.browserWindow(mainWindow); + webContentsId = this.serverMap[`${config.teams[0].name}___TAB_MESSAGING`].webContentsId; + + const loadingScreen = this.app.windows().find((window) => window.url().includes('loadingScreen')); + await loadingScreen.waitForSelector('.LoadingScreen', {state: 'hidden'}); + }); + + it('MM-T814 should reload page when pressing Ctrl+R', async () => { + const check = browserWindow.evaluate(setupPromise, webContentsId); + await asyncSleep(500); + robot.keyTap('r', ['control']); + const result = await check; + result.should.be.true; + }); + + it('MM-T815 should reload page when pressing Ctrl+Shift+R', async () => { + const check = browserWindow.evaluate(setupPromise, webContentsId); + await asyncSleep(500); + robot.keyTap('r', ['control', 'shift']); + const result = await check; + result.should.be.true; + }); + }); +}); diff --git a/e2e/specs/menu_bar/window_menu.test.js b/e2e/specs/menu_bar/window_menu.test.js new file mode 100644 index 00000000..26a73558 --- /dev/null +++ b/e2e/specs/menu_bar/window_menu.test.js @@ -0,0 +1,79 @@ +// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. +'use strict'; + +const fs = require('fs'); + +const robot = require('robotjs'); + +const env = require('../../modules/environment'); +const {asyncSleep} = require('../../modules/utils'); + +describe('mattermost', function desc() { + this.timeout(30000); + + const config = { + ...env.demoConfig, + teams: [ + ...env.demoConfig.teams, + { + name: 'google', + url: 'https://google.com/', + order: 2, + tabs: [ + { + name: 'TAB_MESSAGING', + order: 0, + isOpen: true, + }, + { + name: 'TAB_FOCALBOARD', + order: 1, + isOpen: false, + }, + { + name: 'TAB_PLAYBOOKS', + order: 2, + isOpen: false, + }, + ], + lastActiveTab: 0, + }, + ], + }; + + beforeEach(async () => { + env.cleanDataDir(); + env.createTestUserDataDir(); + env.cleanTestConfig(); + fs.writeFileSync(env.configFilePath, JSON.stringify(config)); + await asyncSleep(1000); + this.app = await env.getApp(); + this.serverMap = await env.getServerMap(this.app); + }); + + afterEach(async () => { + if (this.app) { + await this.app.close(); + } + }); + + it('MM-T826 should switch to servers when keyboard shortcuts are pressed', async () => { + const mainWindow = this.app.windows().find((window) => window.url().includes('index')); + + let dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton'); + dropdownButtonText.should.equal('example'); + + robot.keyTap('2', ['control', 'shift']); + dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton'); + dropdownButtonText.should.equal('github'); + + robot.keyTap('3', ['control', 'shift']); + dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton'); + dropdownButtonText.should.equal('google'); + + robot.keyTap('1', ['control', 'shift']); + dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton'); + dropdownButtonText.should.equal('example'); + }); +}); diff --git a/e2e/specs/menu_test.js b/e2e/specs/menu_test.js deleted file mode 100644 index ab8aea4a..00000000 --- a/e2e/specs/menu_test.js +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. -'use strict'; - -const fs = require('fs'); - -// const http = require('http'); -// const path = require('path'); - -const robot = require('robotjs'); - -const env = require('../modules/environment'); -const {asyncSleep} = require('../modules/utils'); - -describe('mattermost', function desc() { - this.timeout(30000); - - const config = { - version: 3, - teams: [{ - name: 'example', - url: env.mattermostURL, - order: 0, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - isOpen: false, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - isOpen: false, - }, - ], - lastActiveTab: 0, - }, { - name: 'github', - url: 'https://github.com/', - order: 1, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - isOpen: false, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - isOpen: false, - }, - ], - lastActiveTab: 0, - }], - showTrayIcon: false, - trayIconTheme: 'light', - minimizeToTray: false, - notifications: { - flashWindow: 0, - bounceIcon: false, - bounceIconType: 'informational', - }, - showUnreadBadge: true, - useSpellChecker: true, - enableHardwareAcceleration: true, - autostart: true, - darkMode: false, - lastActiveTeam: 0, - spellCheckerLocales: [], - }; - - beforeEach(async () => { - env.cleanDataDir(); - env.createTestUserDataDir(); - env.cleanTestConfig(); - fs.writeFileSync(env.configFilePath, JSON.stringify(config)); - await asyncSleep(1000); - this.app = await env.getApp(); - this.serverMap = await env.getServerMap(this.app); - }); - - afterEach(async () => { - if (this.app) { - await this.app.close(); - } - }); - - it('should reload page when pressing Ctrl+R', async () => { - const mainWindow = await this.app.firstWindow(); - const browserWindow = await this.app.browserWindow(mainWindow); - const webContentsId = this.serverMap[`${config.teams[0].name}___TAB_MESSAGING`].webContentsId; - - const loadingScreen = this.app.windows().find((window) => window.url().includes('loadingScreen')); - await loadingScreen.waitForSelector('.LoadingScreen', {state: 'hidden'}); - const check = browserWindow.evaluate(async (window, id) => { - const promise = new Promise((resolve) => { - const browserView = window.getBrowserViews().find((view) => view.webContents.id === id); - browserView.webContents.on('did-finish-load', () => { - resolve(); - }); - }); - await promise; - return true; - }, webContentsId); - await asyncSleep(500); - robot.keyTap('r', ['control']); - const result = await check; - result.should.be.true; - }); - - it('should reload page when pressing Ctrl+Shift+R', async () => { - const mainWindow = await this.app.firstWindow(); - const browserWindow = await this.app.browserWindow(mainWindow); - const webContentsId = this.serverMap[`${config.teams[0].name}___TAB_MESSAGING`].webContentsId; - - const loadingScreen = this.app.windows().find((window) => window.url().includes('loadingScreen')); - await loadingScreen.waitForSelector('.LoadingScreen', {state: 'hidden'}); - const check = browserWindow.evaluate(async (window, id) => { - const promise = new Promise((resolve) => { - const browserView = window.getBrowserViews().find((view) => view.webContents.id === id); - browserView.webContents.on('did-finish-load', () => { - resolve(); - }); - }); - await promise; - return true; - }, webContentsId); - await asyncSleep(500); - robot.keyTap('r', ['control', 'shift']); - const result = await check; - result.should.be.true; - }); - - it('should switch to servers when keyboard shortcuts are pressed', async () => { - const mainWindow = this.app.windows().find((window) => window.url().includes('index')); - - let dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton'); - dropdownButtonText.should.equal('example'); - - robot.keyTap('2', ['control', 'shift']); - dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton'); - dropdownButtonText.should.equal('github'); - - robot.keyTap('1', ['control', 'shift']); - dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton'); - dropdownButtonText.should.equal('example'); - }); - - if (process.platform !== 'darwin') { - it('should open the 3 dot menu with Alt', async () => { - const mainWindow = this.app.windows().find((window) => window.url().includes('index')); - mainWindow.should.not.be.null; - - // Settings window should open if Alt works - robot.keyTap('alt'); - robot.keyTap('enter'); - robot.keyTap('f'); - robot.keyTap('s'); - robot.keyTap('enter'); - const settingsWindow = await this.app.waitForEvent('window', { - predicate: (window) => window.url().includes('settings'), - }); - settingsWindow.should.not.be.null; - }); - } -}); diff --git a/e2e/specs/server_management/add_server_modal.test.js b/e2e/specs/server_management/add_server_modal.test.js new file mode 100644 index 00000000..e99825a1 --- /dev/null +++ b/e2e/specs/server_management/add_server_modal.test.js @@ -0,0 +1,155 @@ +// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +'use strict'; + +const fs = require('fs'); + +const env = require('../../modules/environment'); +const {asyncSleep} = require('../../modules/utils'); + +describe('Add Server Modal', 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(); + + const mainView = this.app.windows().find((window) => window.url().includes('index')); + const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown')); + await mainView.click('.TeamDropdownButton'); + await dropdownView.click('.TeamDropdown .TeamDropdown__button.addServer'); + newServerView = await this.app.waitForEvent('window', { + predicate: (window) => window.url().includes('newServer'), + }); + + // wait for autofocus to finish + await asyncSleep(500); + }); + + afterEach(async () => { + if (this.app) { + await this.app.close(); + } + }); + + let newServerView; + + it('MM-T4387 should open the new server modal', async () => { + const existing = Boolean(await this.app.windows().find((window) => window.url().includes('newServer'))); + existing.should.be.true; + }); + + it('MM-T1312 should focus the first text input', async () => { + const isFocused = await newServerView.$eval('#teamNameInput', (el) => el === document.activeElement); + isFocused.should.be.true; + }); + + it('MM-T4388 should close the window after clicking cancel', async () => { + await newServerView.click('#cancelNewServerModal'); + await asyncSleep(1000); + const existing = Boolean(await this.app.windows().find((window) => window.url().includes('newServer'))); + existing.should.be.false; + }); + + describe('MM-T4389 Invalid messages', () => { + it('MM-T4389_1 should not be valid if no team name has been set', async () => { + await newServerView.click('#saveNewServerModal'); + const existing = await newServerView.isVisible('#teamNameInput.is-invalid'); + existing.should.be.true; + }); + + it('MM-T4389_2 should not be valid if no server address has been set', async () => { + await newServerView.click('#saveNewServerModal'); + const existing = await newServerView.isVisible('#teamUrlInput.is-invalid'); + existing.should.be.true; + }); + + describe('Valid server name', async () => { + beforeEach(async () => { + await newServerView.type('#teamNameInput', 'TestTeam'); + await newServerView.click('#saveNewServerModal'); + }); + + it('MM-T4389_3 should not be marked invalid', async () => { + const existing = await newServerView.isVisible('#teamNameInput.is-invalid'); + existing.should.be.false; + }); + + it('MM-T4389_4 should not be possible to click save', async () => { + const disabled = await newServerView.getAttribute('#saveNewServerModal', 'disabled'); + (disabled === '').should.be.true; + }); + }); + + describe('Valid server url', () => { + beforeEach(async () => { + await newServerView.type('#teamUrlInput', 'http://example.org'); + await newServerView.click('#saveNewServerModal'); + }); + + it('MM-T4389_5 should be valid', async () => { + const existing = await newServerView.isVisible('#teamUrlInput.is-invalid'); + existing.should.be.false; + }); + + it('MM-T4389_6 should not be possible to click save', async () => { + const disabled = await newServerView.getAttribute('#saveNewServerModal', 'disabled'); + (disabled === '').should.be.true; + }); + }); + }); + + it('MM-T2826_1 should not be valid if an invalid server address has been set', async () => { + await newServerView.type('#teamUrlInput', 'superInvalid url'); + await newServerView.click('#saveNewServerModal'); + const existing = await newServerView.isVisible('#teamUrlInput.is-invalid'); + existing.should.be.true; + }); + + describe('Valid Team Settings', () => { + beforeEach(async () => { + await newServerView.type('#teamUrlInput', 'http://example.org'); + await newServerView.type('#teamNameInput', 'TestTeam'); + }); + + it('should be possible to click add', async () => { + const disabled = await newServerView.getAttribute('#saveNewServerModal', 'disabled'); + (disabled === null).should.be.true; + }); + + it('MM-T2826_2 should add the team to the config file', async () => { + await newServerView.click('#saveNewServerModal'); + await asyncSleep(1000); + const existing = Boolean(await this.app.windows().find((window) => window.url().includes('newServer'))); + existing.should.be.false; + + const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8')); + savedConfig.teams.should.deep.contain({ + name: 'TestTeam', + url: 'http://example.org', + order: 2, + tabs: [ + { + name: 'TAB_MESSAGING', + order: 0, + isOpen: true, + }, + { + name: 'TAB_FOCALBOARD', + order: 1, + }, + { + name: 'TAB_PLAYBOOKS', + order: 2, + }, + ], + lastActiveTab: 0, + }); + }); + }); +}); diff --git a/e2e/specs/server_management/edit_server_modal.test.js b/e2e/specs/server_management/edit_server_modal.test.js new file mode 100644 index 00000000..d9b7fae5 --- /dev/null +++ b/e2e/specs/server_management/edit_server_modal.test.js @@ -0,0 +1,280 @@ +// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +'use strict'; + +const fs = require('fs'); + +const env = require('../../modules/environment'); +const {asyncSleep} = require('../../modules/utils'); + +describe('EditServerModal', 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(); + + const mainView = this.app.windows().find((window) => window.url().includes('index')); + const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown')); + await mainView.click('.TeamDropdownButton'); + await dropdownView.hover('.TeamDropdown .TeamDropdown__button:nth-child(1)'); + await dropdownView.click('.TeamDropdown .TeamDropdown__button:nth-child(1) button.TeamDropdown__button-edit'); + + editServerView = await this.app.waitForEvent('window', { + predicate: (window) => window.url().includes('editServer'), + }); + }); + + afterEach(async () => { + if (this.app) { + await this.app.close(); + } + }); + + let editServerView; + + it('should not edit team when Cancel is pressed', async () => { + await editServerView.click('#cancelNewServerModal'); + await asyncSleep(1000); + const existing = Boolean(await this.app.windows().find((window) => window.url().includes('editServer'))); + existing.should.be.false; + + const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8')); + savedConfig.teams.should.deep.contain({ + name: 'example', + url: env.mattermostURL, + order: 0, + tabs: [ + { + name: 'TAB_MESSAGING', + order: 0, + isOpen: true, + }, + { + name: 'TAB_FOCALBOARD', + order: 1, + isOpen: true, + }, + { + name: 'TAB_PLAYBOOKS', + order: 2, + isOpen: true, + }, + ], + lastActiveTab: 0, + }); + }); + + it('MM-T4391_1 should not edit team when Save is pressed but nothing edited', async () => { + await editServerView.click('#saveNewServerModal'); + await asyncSleep(1000); + const existing = Boolean(await this.app.windows().find((window) => window.url().includes('editServer'))); + existing.should.be.false; + + const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8')); + savedConfig.teams.should.deep.contain({ + name: 'example', + url: env.mattermostURL, + order: 0, + tabs: [ + { + name: 'TAB_MESSAGING', + order: 0, + isOpen: true, + }, + { + name: 'TAB_FOCALBOARD', + order: 1, + isOpen: true, + }, + { + name: 'TAB_PLAYBOOKS', + order: 2, + isOpen: true, + }, + ], + lastActiveTab: 0, + }); + }); + + it('MM-T2826_3 should not edit team if an invalid server address has been set', async () => { + await editServerView.type('#teamUrlInput', 'superInvalid url'); + await editServerView.click('#saveNewServerModal'); + const existing = await editServerView.isVisible('#teamUrlInput.is-invalid'); + existing.should.be.true; + }); + + it('MM-T4391_2 should edit team when Save is pressed and name edited', async () => { + await editServerView.fill('#teamNameInput', 'NewTestTeam'); + await editServerView.click('#saveNewServerModal'); + await asyncSleep(1000); + const existing = Boolean(await this.app.windows().find((window) => window.url().includes('editServer'))); + existing.should.be.false; + + const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8')); + savedConfig.teams.should.not.deep.contain({ + name: 'example', + url: env.mattermostURL, + order: 0, + tabs: [ + { + name: 'TAB_MESSAGING', + order: 0, + isOpen: true, + }, + { + name: 'TAB_FOCALBOARD', + order: 1, + isOpen: true, + }, + { + name: 'TAB_PLAYBOOKS', + order: 2, + isOpen: true, + }, + ], + lastActiveTab: 0, + }); + savedConfig.teams.should.deep.contain({ + name: 'NewTestTeam', + url: env.mattermostURL, + order: 0, + tabs: [ + { + name: 'TAB_MESSAGING', + order: 0, + isOpen: true, + }, + { + name: 'TAB_FOCALBOARD', + order: 1, + isOpen: true, + }, + { + name: 'TAB_PLAYBOOKS', + order: 2, + isOpen: true, + }, + ], + lastActiveTab: 0, + }); + }); + + it('MM-T4391_3 should edit team when Save is pressed and URL edited', async () => { + await editServerView.fill('#teamUrlInput', 'http://google.com'); + await editServerView.click('#saveNewServerModal'); + await asyncSleep(1000); + const existing = Boolean(await this.app.windows().find((window) => window.url().includes('editServer'))); + existing.should.be.false; + + const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8')); + savedConfig.teams.should.not.deep.contain({ + name: 'example', + url: env.mattermostURL, + order: 0, + tabs: [ + { + name: 'TAB_MESSAGING', + order: 0, + isOpen: true, + }, + { + name: 'TAB_FOCALBOARD', + order: 1, + isOpen: true, + }, + { + name: 'TAB_PLAYBOOKS', + order: 2, + isOpen: true, + }, + ], + lastActiveTab: 0, + }); + savedConfig.teams.should.deep.contain({ + name: 'example', + url: 'http://google.com', + order: 0, + tabs: [ + { + name: 'TAB_MESSAGING', + order: 0, + isOpen: true, + }, + { + name: 'TAB_FOCALBOARD', + order: 1, + isOpen: true, + }, + { + name: 'TAB_PLAYBOOKS', + order: 2, + isOpen: true, + }, + ], + lastActiveTab: 0, + }); + }); + + it('MM-T4391_4 should edit team when Save is pressed and both edited', async () => { + await editServerView.fill('#teamNameInput', 'NewTestTeam'); + await editServerView.fill('#teamUrlInput', 'http://google.com'); + await editServerView.click('#saveNewServerModal'); + await asyncSleep(1000); + const existing = Boolean(await this.app.windows().find((window) => window.url().includes('editServer'))); + existing.should.be.false; + + const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8')); + savedConfig.teams.should.not.deep.contain({ + name: 'example', + url: env.mattermostURL, + order: 0, + tabs: [ + { + name: 'TAB_MESSAGING', + order: 0, + isOpen: true, + }, + { + name: 'TAB_FOCALBOARD', + order: 1, + isOpen: true, + }, + { + name: 'TAB_PLAYBOOKS', + order: 2, + isOpen: true, + }, + ], + lastActiveTab: 0, + }); + savedConfig.teams.should.deep.contain({ + name: 'NewTestTeam', + url: 'http://google.com', + order: 0, + tabs: [ + { + name: 'TAB_MESSAGING', + order: 0, + isOpen: true, + }, + { + name: 'TAB_FOCALBOARD', + order: 1, + isOpen: true, + }, + { + name: 'TAB_PLAYBOOKS', + order: 2, + isOpen: true, + }, + ], + lastActiveTab: 0, + }); + }); +}); diff --git a/e2e/specs/server_management/remove_server_modal.test.js b/e2e/specs/server_management/remove_server_modal.test.js new file mode 100644 index 00000000..11233cc7 --- /dev/null +++ b/e2e/specs/server_management/remove_server_modal.test.js @@ -0,0 +1,78 @@ +// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +'use strict'; + +const fs = require('fs'); + +const env = require('../../modules/environment'); +const {asyncSleep} = require('../../modules/utils'); + +describe('RemoveServerModal', 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(); + + const mainView = this.app.windows().find((window) => window.url().includes('index')); + const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown')); + await mainView.click('.TeamDropdownButton'); + await dropdownView.hover('.TeamDropdown .TeamDropdown__button:nth-child(1)'); + await dropdownView.click('.TeamDropdown .TeamDropdown__button:nth-child(1) button.TeamDropdown__button-remove'); + + removeServerView = await this.app.waitForEvent('window', { + predicate: (window) => window.url().includes('removeServer'), + }); + + // wait for autofocus to finish + await asyncSleep(500); + }); + + afterEach(async () => { + if (this.app) { + await this.app.close(); + } + }); + + let removeServerView; + + it('MM-T4390_1 should remove existing team on click Remove', async () => { + await removeServerView.click('button:has-text("Remove")'); + await asyncSleep(1000); + + const expectedConfig = JSON.parse(JSON.stringify(config.teams.slice(1))); + expectedConfig.forEach((value) => { + value.order--; + }); + + const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8')); + savedConfig.teams.should.deep.equal(expectedConfig); + }); + + it('MM-T4390_2 should NOT remove existing team on click Cancel', async () => { + await removeServerView.click('button:has-text("Cancel")'); + await asyncSleep(1000); + + const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8')); + savedConfig.teams.should.deep.equal(config.teams); + }); + + it('MM-T4390_3 should disappear on click Close', async () => { + await removeServerView.click('button.close'); + await asyncSleep(1000); + const existing = Boolean(await this.app.windows().find((window) => window.url().includes('removeServer'))); + existing.should.be.false; + }); + + it('MM-T4390_4 should disappear on click background', async () => { + await removeServerView.click('.modal', {position: {x: 20, y: 20}}); + await asyncSleep(1000); + const existing = Boolean(await this.app.windows().find((window) => window.url().includes('removeServer'))); + existing.should.be.false; + }); +}); diff --git a/e2e/specs/browser/settings_test.js b/e2e/specs/settings.test.js similarity index 78% rename from e2e/specs/browser/settings_test.js rename to e2e/specs/settings.test.js index 92f70085..35d53fb8 100644 --- a/e2e/specs/browser/settings_test.js +++ b/e2e/specs/settings.test.js @@ -2,83 +2,19 @@ // Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -// TODO: fix test with new settings window - 'use strict'; const fs = require('fs'); -const {SHOW_SETTINGS_WINDOW} = require('../../../src/common/communication'); +const {SHOW_SETTINGS_WINDOW} = require('../../src/common/communication'); -const env = require('../../modules/environment'); -const {asyncSleep} = require('../../modules/utils'); +const env = require('../modules/environment'); +const {asyncSleep} = require('../modules/utils'); -describe('renderer/settings.html', function desc() { +describe('Settings', function desc() { this.timeout(30000); - const config = { - version: 3, - teams: [{ - name: 'example', - url: env.mattermostURL, - order: 0, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - isOpen: true, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - isOpen: true, - }, - ], - lastActiveTab: 0, - }, { - name: 'github', - url: 'https://github.com/', - order: 1, - tabs: [ - { - name: 'TAB_MESSAGING', - order: 0, - isOpen: true, - }, - { - name: 'TAB_FOCALBOARD', - order: 1, - isOpen: true, - }, - { - name: 'TAB_PLAYBOOKS', - order: 2, - isOpen: true, - }, - ], - lastActiveTab: 0, - }], - showTrayIcon: false, - trayIconTheme: 'light', - minimizeToTray: false, - notifications: { - flashWindow: 0, - bounceIcon: false, - bounceIconType: 'informational', - }, - showUnreadBadge: true, - useSpellChecker: true, - enableHardwareAcceleration: true, - autostart: true, - darkMode: false, - lastActiveTeam: 0, - spellCheckerLocales: [], - }; + const config = env.demoConfig; beforeEach(async () => { env.createTestUserDataDir(); @@ -96,7 +32,7 @@ describe('renderer/settings.html', function desc() { describe('Options', () => { describe('Start app on login', () => { - it('should appear on win32 or linux', async () => { + 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); @@ -111,7 +47,7 @@ describe('renderer/settings.html', function desc() { }); describe('Show icon in menu bar / notification area', () => { - it('should appear on darwin or linux', async () => { + 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); @@ -124,7 +60,7 @@ describe('renderer/settings.html', function desc() { existing.should.equal(expected); }); - describe('Save tray icon setting on mac', () => { + 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); @@ -147,7 +83,7 @@ describe('renderer/settings.html', function desc() { }); }); - describe('Save tray icon theme on linux', () => { + 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); @@ -173,7 +109,7 @@ describe('renderer/settings.html', function desc() { }); describe('Leave app running in notification area when application window is closed', () => { - it('should appear on linux', async () => { + it('MM-T4394 should appear on linux', async () => { const expected = (process.platform === 'linux'); this.app.evaluate(({ipcMain}, showWindow) => { ipcMain.emit(showWindow); @@ -188,7 +124,7 @@ describe('renderer/settings.html', function desc() { }); describe('Flash app window and taskbar icon when a new message is received', () => { - it('should appear on win32 and linux', async () => { + 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); @@ -203,7 +139,7 @@ describe('renderer/settings.html', function desc() { }); describe('Show red badge on taskbar icon to indicate unread messages', () => { - it('should appear on darwin or win32', async () => { + 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); @@ -218,7 +154,7 @@ describe('renderer/settings.html', function desc() { }); describe('Check spelling', () => { - it('should appear and be selectable', async () => { + it('MM-T4397 should appear and be selectable', async () => { this.app.evaluate(({ipcMain}, showWindow) => { ipcMain.emit(showWindow); }, SHOW_SETTINGS_WINDOW); @@ -241,7 +177,7 @@ describe('renderer/settings.html', function desc() { }); describe('Enable GPU hardware acceleration', () => { - it('should save selected option', async () => { + it('MM-T4398 should save selected option', async () => { const ID_INPUT_ENABLE_HARDWARE_ACCELERATION = '#inputEnableHardwareAcceleration'; this.app.evaluate(({ipcMain}, showWindow) => { ipcMain.emit(showWindow); diff --git a/e2e/specs/app_test.js b/e2e/specs/startup/app.test.js similarity index 79% rename from e2e/specs/app_test.js rename to e2e/specs/startup/app.test.js index 0d18393f..4d6a1ab1 100644 --- a/e2e/specs/app_test.js +++ b/e2e/specs/startup/app.test.js @@ -4,9 +4,9 @@ 'use strict'; -const env = require('../modules/environment'); +const env = require('../../modules/environment'); -describe('application', function desc() { +describe('startup/app', function desc() { this.timeout(30000); beforeEach(async () => { @@ -21,19 +21,19 @@ describe('application', function desc() { } }); - it('should show the new server modal when no servers exist', async () => { + it('MM-T4399_1 should show the new server modal when no servers exist', async () => { const newServerModal = this.app.windows().find((window) => window.url().includes('newServer')); const modalTitle = await newServerModal.innerText('#newServerModal .modal-title'); modalTitle.should.equal('Add Server'); }); - it('should show no servers configured in dropdown when no servers exist', async () => { + it('MM-T4399_2 should show no servers configured in dropdown when no servers exist', async () => { const mainWindow = this.app.windows().find((window) => window.url().includes('index')); const dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton'); dropdownButtonText.should.equal('No servers configured'); }); - it('should be stopped when the app instance already exists', (done) => { + it('MM-T4400 should be stopped when the app instance already exists', (done) => { const secondApp = env.getApp(); // In the correct case, 'start().then' is not called. diff --git a/e2e/specs/startup/config.test.js b/e2e/specs/startup/config.test.js new file mode 100644 index 00000000..33a59f85 --- /dev/null +++ b/e2e/specs/startup/config.test.js @@ -0,0 +1,76 @@ +// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +'use strict'; + +const fs = require('fs'); + +const env = require('../../modules/environment'); + +describe('config', function desc() { + this.timeout(30000); + + beforeEach(async () => { + env.createTestUserDataDir(); + env.cleanTestConfig(); + }); + + afterEach(async () => { + if (this.app) { + try { + await this.app.close(); + // eslint-disable-next-line no-empty + } catch (err) {} + } + }); + + describe('MM-T4401 should show servers in dropdown when there is config file', async () => { + const config = env.demoConfig; + + beforeEach(async () => { + fs.writeFileSync(env.configFilePath, JSON.stringify(config)); + this.app = await env.getApp(); + }); + + afterEach(async () => { + if (this.app) { + try { + await this.app.close(); + // eslint-disable-next-line no-empty + } catch (err) {} + } + }); + + it('MM-T4401_1 should show correct server in the dropdown button', async () => { + const mainWindow = this.app.windows().find((window) => window.url().includes('index')); + const dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton'); + dropdownButtonText.should.equal('example'); + }); + + it('MM-T4401_2 should set src of browser view from config file', async () => { + const firstServer = this.app.windows().find((window) => window.url() === config.teams[0].url); + const secondServer = this.app.windows().find((window) => window.url() === config.teams[1].url); + + firstServer.should.not.be.null; + secondServer.should.not.be.null; + }); + }); + + it('MM-T4402 should upgrade v0 config file', async () => { + const Config = require('../../../src/common/config').default; + const newConfig = new Config(env.configFilePath); + const oldConfig = { + url: env.mattermostURL, + }; + fs.writeFileSync(env.configFilePath, JSON.stringify(oldConfig)); + this.app = await env.getApp(); + const mainWindow = this.app.windows().find((window) => window.url().includes('index')); + const dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton:has-text("Primary team")'); + dropdownButtonText.should.equal('Primary team'); + + const str = fs.readFileSync(env.configFilePath, 'utf8'); + const upgradedConfig = JSON.parse(str); + upgradedConfig.version.should.equal(newConfig.defaultData.version); + await this.app.close(); + }); +}); diff --git a/e2e/specs/window_test.js b/e2e/specs/startup/window.test.js similarity index 87% rename from e2e/specs/window_test.js rename to e2e/specs/startup/window.test.js index 0375a50b..92a34430 100644 --- a/e2e/specs/window_test.js +++ b/e2e/specs/startup/window.test.js @@ -5,7 +5,7 @@ const fs = require('fs'); -const env = require('../modules/environment'); +const env = require('../../modules/environment'); describe('window', function desc() { this.timeout(30000); @@ -24,7 +24,7 @@ describe('window', function desc() { } }); - it.skip('should restore window bounds', async () => { + it.skip('MM-T4403_1 should restore window bounds', async () => { // TODO: Still fails in CircleCI // bounds seems to be incorrectly calculated in some environments // - Windows 10: OK @@ -39,7 +39,7 @@ describe('window', function desc() { await this.app.close(); }); - it('should NOT restore window bounds if x is located on outside of viewarea', async () => { + it('MM-T4403_2 should NOT restore window bounds if x is located on outside of viewarea', async () => { // bounds seems to be incorrectly calculated in some environments (e.g. CircleCI) // - Windows 10: OK // - CircleCI: NG @@ -52,7 +52,7 @@ describe('window', function desc() { await this.app.close(); }); - it('should NOT restore window bounds if y is located on outside of viewarea', async () => { + it('MM-T4403_3 should NOT restore window bounds if y is located on outside of viewarea', async () => { // bounds seems to be incorrectly calculated in some environments (e.g. CircleCI) // - Windows 10: OK // - CircleCI: NG diff --git a/webpack.config.test.js b/webpack.config.test.js index d72f1269..208bf116 100644 --- a/webpack.config.test.js +++ b/webpack.config.test.js @@ -16,8 +16,7 @@ const WEBSERVER_PORT = 9001; module.exports = merge(base, { entry: { - test: glob.sync('./src/**/*.test.js'), - e2e: './e2e/specs/index.js', + e2e: glob.sync('./e2e/specs/**/*.test.js'), }, output: { path: path.resolve(__dirname, 'dist/tests'),