Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MM-62094] E2E: Don't including loading screen or other windows in server map, remove check for loading screen finish #3252

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions e2e/modules/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},

Expand Down
4 changes: 1 addition & 3 deletions e2e/specs/downloads/downloads_manager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 0 additions & 4 deletions e2e/specs/focus.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ describe('focus', function desc() {
};

let firstServer;
let loadingScreen;

beforeEach(async () => {
env.cleanDataDir();
Expand All @@ -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');
Expand Down
2 changes: 0 additions & 2 deletions e2e/specs/mattermost/copy_link.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
3 changes: 0 additions & 3 deletions e2e/specs/menu_bar/edit_menu.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down
2 changes: 0 additions & 2 deletions e2e/specs/menu_bar/full_screen.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 0 additions & 2 deletions e2e/specs/menu_bar/history_menu.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
17 changes: 0 additions & 17 deletions e2e/specs/menu_bar/view_menu.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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 () => {
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
3 changes: 0 additions & 3 deletions e2e/specs/popup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 0 additions & 2 deletions e2e/specs/relative_url/relative_url.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
1 change: 1 addition & 0 deletions src/main/views/loadingScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export class LoadingScreen {

if (process.env.NODE_ENV === 'test') {
app.emit('e2e-app-loaded');
MainWindow.get()?.focus();
}
};

Expand Down
Loading