diff --git a/e2e/modules/environment.js b/e2e/modules/environment.js index ab8fe22dc89..adfb58af424 100644 --- a/e2e/modules/environment.js +++ b/e2e/modules/environment.js @@ -243,19 +243,21 @@ module.exports = { async getServerMap(app) { const map = {}; - await Promise.all(app.windows().map(async (win) => { - return win.evaluate(async () => { - if (!window.testHelper) { - return null; - } - const info = await window.testHelper.getViewInfoForTest(); - return {viewName: `${info.serverName}___${info.viewType}`, webContentsId: info.webContentsId}; - }).then((result) => { - if (result) { - map[result.viewName] = {win, webContentsId: result.webContentsId}; - } - }); - })); + await Promise.all(app.windows(). + filter((win) => !win.url().includes('mattermost-desktop://')). + map(async (win) => { + return win.evaluate(async () => { + if (!window.testHelper) { + return null; + } + const info = await window.testHelper.getViewInfoForTest(); + return {viewName: `${info.serverName}___${info.viewType}`, webContentsId: info.webContentsId}; + }).then((result) => { + if (result) { + map[result.viewName] = {win, webContentsId: result.webContentsId}; + } + }); + })); return map; }, diff --git a/e2e/specs/downloads/downloads_manager.test.js b/e2e/specs/downloads/downloads_manager.test.js index b50a78b7b76..471f1de2972 100644 --- a/e2e/specs/downloads/downloads_manager.test.js +++ b/e2e/specs/downloads/downloads_manager.test.js @@ -50,13 +50,11 @@ describe('downloads/downloads_manager', function desc() { await asyncSleep(1000); this.app = await env.getApp(); this.serverMap = await env.getServerMap(this.app); - const loadingScreen = this.app.windows().find((window) => window.url().includes('loadingScreen')); - await loadingScreen.waitForSelector('.LoadingScreen', {state: 'hidden'}); firstServer = this.serverMap[`${config.teams[0].name}___TAB_MESSAGING`].win; await env.loginToMattermost(firstServer); const textbox = await firstServer.waitForSelector('#post_textbox'); - const fileInput = await firstServer.waitForSelector('input[type="file"]'); + const fileInput = await firstServer.waitForSelector('input#fileUploadInput'); await fileInput.setInputFiles({ name: filename, mimeType: 'text/plain', diff --git a/e2e/specs/focus.test.js b/e2e/specs/focus.test.js index 1515c2e96bb..9e58d773cbe 100644 --- a/e2e/specs/focus.test.js +++ b/e2e/specs/focus.test.js @@ -44,7 +44,6 @@ describe('focus', function desc() { }; let firstServer; - let loadingScreen; beforeEach(async () => { env.cleanDataDir(); @@ -54,9 +53,6 @@ describe('focus', function desc() { await asyncSleep(1000); this.app = await env.getApp(); this.serverMap = await env.getServerMap(this.app); - - loadingScreen = this.app.windows().find((window) => window.url().includes('loadingScreen')); - await loadingScreen.waitForSelector('.LoadingScreen', {state: 'hidden'}); firstServer = this.serverMap[`${config.teams[0].name}___TAB_MESSAGING`].win; await env.loginToMattermost(firstServer); const textbox = await firstServer.waitForSelector('#post_textbox'); diff --git a/e2e/specs/mattermost/copy_link.test.js b/e2e/specs/mattermost/copy_link.test.js index ed7eb36ae7e..6d2ee3245a1 100644 --- a/e2e/specs/mattermost/copy_link.test.js +++ b/e2e/specs/mattermost/copy_link.test.js @@ -33,8 +33,6 @@ describe('copylink', function desc() { }); it('MM-T125 Copy Link can be used from channel LHS', 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('#sidebarItem_town-square'); diff --git a/e2e/specs/menu_bar/edit_menu.test.js b/e2e/specs/menu_bar/edit_menu.test.js index 39b6c6a69b0..0e7d278a6d5 100644 --- a/e2e/specs/menu_bar/edit_menu.test.js +++ b/e2e/specs/menu_bar/edit_menu.test.js @@ -23,9 +23,6 @@ describe('edit_menu', function desc() { await asyncSleep(1000); this.app = await env.getApp(); this.serverMap = await env.getServerMap(this.app); - - const loadingScreen = this.app.windows().find((window) => window.url().includes('loadingScreen')); - await loadingScreen.waitForSelector('.LoadingScreen', {state: 'hidden'}); firstServer = this.serverMap[`${config.teams[0].name}___TAB_MESSAGING`].win; await env.loginToMattermost(firstServer); }); diff --git a/e2e/specs/menu_bar/full_screen.test.js b/e2e/specs/menu_bar/full_screen.test.js index 19895fcb989..0528f1eddb3 100644 --- a/e2e/specs/menu_bar/full_screen.test.js +++ b/e2e/specs/menu_bar/full_screen.test.js @@ -36,8 +36,6 @@ describe('menu/view', function desc() { if (process.platform !== 'darwin') { it('MM-T816 Toggle Full Screen in the Menu Bar', async () => { const mainWindow = this.app.windows().find((window) => window.url().includes('index')); - 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('#post_textbox'); diff --git a/e2e/specs/menu_bar/history_menu.test.js b/e2e/specs/menu_bar/history_menu.test.js index 625a1bb3b82..9c76f17b169 100644 --- a/e2e/specs/menu_bar/history_menu.test.js +++ b/e2e/specs/menu_bar/history_menu.test.js @@ -30,8 +30,6 @@ describe('history_menu', function desc() { }); it('Click back and forward from history', 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('#sidebarItem_off-topic'); diff --git a/e2e/specs/menu_bar/view_menu.test.js b/e2e/specs/menu_bar/view_menu.test.js index 10f0681ca52..bea52ed4e6e 100644 --- a/e2e/specs/menu_bar/view_menu.test.js +++ b/e2e/specs/menu_bar/view_menu.test.js @@ -56,8 +56,6 @@ describe('menu/view', function desc() { }); it('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'); @@ -73,8 +71,6 @@ describe('menu/view', function desc() { it('MM-T817 Actual Size Zoom in the menu bar', async () => { const mainWindow = this.app.windows().find((window) => window.url().includes('index')); const browserWindow = await this.app.browserWindow(mainWindow); - 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; const firstServerId = this.serverMap[`${config.teams[0].name}___TAB_MESSAGING`].webContentsId; await env.loginToMattermost(firstServer); @@ -95,8 +91,6 @@ describe('menu/view', function desc() { it('MM-T818_1 Zoom in when CmdOrCtrl+Plus is pressed', async () => { const mainWindow = this.app.windows().find((window) => window.url().includes('index')); const browserWindow = await this.app.browserWindow(mainWindow); - 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; const firstServerId = this.serverMap[`${config.teams[0].name}___TAB_MESSAGING`].webContentsId; await env.loginToMattermost(firstServer); @@ -111,8 +105,6 @@ describe('menu/view', function desc() { it('MM-T818_2 Zoom in when CmdOrCtrl+Shift+Plus is pressed', async () => { const mainWindow = this.app.windows().find((window) => window.url().includes('index')); const browserWindow = await this.app.browserWindow(mainWindow); - 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; const firstServerId = this.serverMap[`${config.teams[0].name}___TAB_MESSAGING`].webContentsId; await env.loginToMattermost(firstServer); @@ -135,8 +127,6 @@ describe('menu/view', function desc() { it('MM-T819_1 Zoom out when CmdOrCtrl+Minus is pressed', async () => { const mainWindow = this.app.windows().find((window) => window.url().includes('index')); const browserWindow = await this.app.browserWindow(mainWindow); - 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; const firstServerId = this.serverMap[`${config.teams[0].name}___TAB_MESSAGING`].webContentsId; await env.loginToMattermost(firstServer); @@ -151,8 +141,6 @@ describe('menu/view', function desc() { it('MM-T819_2 Zoom out when CmdOrCtrl+Shift+Minus is pressed', async () => { const mainWindow = this.app.windows().find((window) => window.url().includes('index')); const browserWindow = await this.app.browserWindow(mainWindow); - 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; const firstServerId = this.serverMap[`${config.teams[0].name}___TAB_MESSAGING`].webContentsId; await env.loginToMattermost(firstServer); @@ -179,9 +167,6 @@ describe('menu/view', function desc() { const mainWindow = this.app.windows().find((window) => window.url().includes('index')); 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 () => { @@ -204,8 +189,6 @@ describe('menu/view', function desc() { it('MM-T820 should open Developer Tools For Application Wrapper for main window', async () => { const mainWindow = this.app.windows().find((window) => window.url().includes('index.html')); const browserWindow = await this.app.browserWindow(mainWindow); - const loadingScreen = this.app.windows().find((window) => window.url().includes('loadingScreen')); - await loadingScreen.waitForSelector('.LoadingScreen', {state: 'hidden'}); let isDevToolsOpen = await browserWindow.evaluate((window) => { return window.webContents.isDevToolsOpened(); diff --git a/e2e/specs/notification_trigger/notification_badge_in_dock.test.js b/e2e/specs/notification_trigger/notification_badge_in_dock.test.js index ce0069163df..8a6c2db68bc 100644 --- a/e2e/specs/notification_trigger/notification_badge_in_dock.test.js +++ b/e2e/specs/notification_trigger/notification_badge_in_dock.test.js @@ -23,8 +23,6 @@ describe('Trigger Notification From desktop', function desc() { this.app = await env.getApp(); this.serverMap = await env.getServerMap(this.app); - const loadingScreen = this.app.windows().find((window) => window.url().includes('loadingScreen')); - await loadingScreen.waitForSelector('.LoadingScreen', {state: 'hidden'}); firstServer = this.serverMap[`${config.teams[0].name}___TAB_MESSAGING`].win; await env.loginToMattermost(firstServer); const textbox = await firstServer.waitForSelector('#post_textbox'); diff --git a/e2e/specs/popup.test.js b/e2e/specs/popup.test.js index 76ac63de94f..f476fdfea49 100644 --- a/e2e/specs/popup.test.js +++ b/e2e/specs/popup.test.js @@ -24,9 +24,6 @@ describe('popup', function desc() { await asyncSleep(1000); this.app = await env.getApp(); this.serverMap = await env.getServerMap(this.app); - - const loadingScreen = this.app.windows().find((window) => window.url().includes('loadingScreen')); - await loadingScreen.waitForSelector('.LoadingScreen', {state: 'hidden'}); firstServer = this.serverMap[`${config.teams[0].name}___TAB_MESSAGING`].win; await env.loginToMattermost(firstServer); diff --git a/e2e/specs/relative_url/relative_url.test.js b/e2e/specs/relative_url/relative_url.test.js index f509f3983fe..86b5af69d69 100644 --- a/e2e/specs/relative_url/relative_url.test.js +++ b/e2e/specs/relative_url/relative_url.test.js @@ -32,8 +32,6 @@ describe('copylink', function desc() { }); it('MM-T1308 Check that external links dont open in the app', 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('#post_textbox'); diff --git a/src/main/views/loadingScreen.ts b/src/main/views/loadingScreen.ts index 1c152fe234f..53adb2b04fd 100644 --- a/src/main/views/loadingScreen.ts +++ b/src/main/views/loadingScreen.ts @@ -90,6 +90,7 @@ export class LoadingScreen { if (process.env.NODE_ENV === 'test') { app.emit('e2e-app-loaded'); + MainWindow.get()?.focus(); } };