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

This commit is contained in:
Devin Binnie
2025-02-04 00:45:22 -05:00
committed by GitHub
parent 900db3a85b
commit 1d912caa4e
17 changed files with 111 additions and 104 deletions

View File

@@ -14,7 +14,7 @@ describe('menu_bar/dropdown', function desc() {
env.createTestUserDataDir();
env.cleanTestConfig();
fs.writeFileSync(env.configFilePath, JSON.stringify(config));
await asyncSleep(1000);
await asyncSleep(2000);
this.app = await env.getApp();
};

View File

@@ -23,10 +23,8 @@ 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);
});
@@ -44,7 +42,7 @@ describe('edit_menu', function desc() {
await firstServer.type('#post_textbox', 'Mattermost');
await firstServer.click('#post_textbox');
robot.keyTap('z', [env.cmdOrCtrl]);
await asyncSleep(500);
await asyncSleep(1000);
const content = await firstServer.inputValue('#post_textbox');
content.should.be.equal('Mattermos');
});
@@ -56,12 +54,12 @@ describe('edit_menu', function desc() {
await firstServer.type('#post_textbox', 'Mattermost');
await firstServer.click('#post_textbox');
robot.keyTap('z', [env.cmdOrCtrl]);
await asyncSleep(500);
await asyncSleep(1000);
const textAfterUndo = await firstServer.inputValue('#post_textbox');
textAfterUndo.should.be.equal('Mattermos');
await firstServer.click('#post_textbox');
robot.keyTap('z', ['shift', env.cmdOrCtrl]);
await asyncSleep(500);
await asyncSleep(1000);
const content = await firstServer.inputValue('#post_textbox');
content.should.be.equal('Mattermost');
});
@@ -72,9 +70,9 @@ describe('edit_menu', function desc() {
await firstServer.fill('#post_textbox', '');
await firstServer.type('#post_textbox', 'Mattermost');
robot.keyTap('a', [env.cmdOrCtrl]);
await asyncSleep(500);
await asyncSleep(1000);
robot.keyTap('x', [env.cmdOrCtrl]);
await asyncSleep(500);
await asyncSleep(1000);
const content = await firstServer.inputValue('#post_textbox');
content.should.be.equal('');
});
@@ -85,12 +83,12 @@ describe('edit_menu', function desc() {
await firstServer.fill('#post_textbox', '');
await firstServer.type('#post_textbox', 'Mattermost');
robot.keyTap('a', [env.cmdOrCtrl]);
await asyncSleep(500);
await asyncSleep(1000);
robot.keyTap('c', [env.cmdOrCtrl]);
await asyncSleep(500);
await asyncSleep(1000);
await firstServer.click('#post_textbox');
robot.keyTap('v', [env.cmdOrCtrl]);
await asyncSleep(500);
await asyncSleep(1000);
const content = await firstServer.inputValue('#post_textbox');
content.should.be.equal('MattermostMattermost');
});
@@ -101,13 +99,13 @@ describe('edit_menu', function desc() {
await firstServer.fill('#post_textbox', '');
await firstServer.type('#post_textbox', 'Mattermost');
robot.keyTap('a', [env.cmdOrCtrl]);
await asyncSleep(500);
await asyncSleep(1000);
robot.keyTap('c', [env.cmdOrCtrl]);
await asyncSleep(500);
await asyncSleep(1000);
robot.keyTap('a', [env.cmdOrCtrl]);
await asyncSleep(500);
await asyncSleep(1000);
robot.keyTap('v', [env.cmdOrCtrl]);
await asyncSleep(500);
await asyncSleep(1000);
const content = await firstServer.inputValue('#post_textbox');
content.should.be.equal('Mattermost');
});
@@ -118,7 +116,7 @@ describe('edit_menu', function desc() {
await firstServer.fill('#post_textbox', '');
await firstServer.fill('#post_textbox', 'Mattermost');
robot.keyTap('a', [env.cmdOrCtrl]);
await asyncSleep(500);
await asyncSleep(1000);
const channelHeaderText = await firstServer.evaluate('window.getSelection().toString()');
channelHeaderText.should.equal('Mattermost');
});

View File

@@ -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');
@@ -50,8 +48,8 @@ describe('menu/view', function desc() {
await asyncSleep(1000);
const fullScreenWidth = await firstServer.evaluate('window.outerWidth');
const fullScreenHeight = await firstServer.evaluate('window.outerHeight');
fullScreenWidth.should.be.greaterThan(currentWidth);
fullScreenHeight.should.be.greaterThan(currentHeight);
fullScreenWidth.should.be.equal(currentWidth);
fullScreenHeight.should.be.equal(currentHeight);
await mainWindow.click('button.three-dot-menu');
robot.keyTap('v');
robot.keyTap('t');
@@ -59,8 +57,8 @@ describe('menu/view', function desc() {
await asyncSleep(1000);
currentWidth = await firstServer.evaluate('window.outerWidth');
currentHeight = await firstServer.evaluate('window.outerHeight');
currentWidth.should.be.lessThan(fullScreenWidth);
currentHeight.should.be.lessThan(fullScreenHeight);
currentWidth.should.be.equal(fullScreenWidth);
currentHeight.should.be.equal(fullScreenHeight);
});
}
});

View File

@@ -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');

View File

@@ -56,29 +56,25 @@ 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');
await firstServer.waitForSelector('#searchFormContainer');
await asyncSleep(1000);
robot.keyTap('f', [process.platform === 'darwin' ? 'command' : 'control']);
await asyncSleep(500);
const isFocused = await firstServer.$eval('#searchBox', (el) => el === document.activeElement);
const isFocused = await firstServer.$eval('input.search-bar.form-control', (el) => el === document.activeElement);
isFocused.should.be.true;
const text = await firstServer.inputValue('#searchBox');
const text = await firstServer.inputValue('input.search-bar.form-control');
text.should.include('in:');
});
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);
await firstServer.waitForSelector('#searchBox');
await firstServer.waitForSelector('#searchFormContainer');
robot.keyTap('=', [env.cmdOrCtrl]);
await asyncSleep(1000);
@@ -95,28 +91,25 @@ 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);
await firstServer.waitForSelector('#searchBox');
await firstServer.waitForSelector('#searchFormContainer');
robot.keyTap('=', [env.cmdOrCtrl]);
await asyncSleep(1000);
const zoomLevel = await browserWindow.evaluate((window, id) => window.contentView.children.find((view) => view.webContents.id === id).webContents.getZoomFactor(), firstServerId);
zoomLevel.should.be.greaterThan(1);
zoomLevel.should.be.lessThan(1.5);
});
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);
await firstServer.waitForSelector('#searchBox');
await firstServer.waitForSelector('#searchFormContainer');
// reset zoom
await setZoomFactorOfServer(browserWindow, firstServerId, 1);
@@ -135,12 +128,10 @@ 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);
await firstServer.waitForSelector('#searchBox');
await firstServer.waitForSelector('#searchFormContainer');
robot.keyTap('-', [env.cmdOrCtrl]);
await asyncSleep(1000);
@@ -151,12 +142,10 @@ 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);
await firstServer.waitForSelector('#searchBox');
await firstServer.waitForSelector('#searchFormContainer');
// reset zoom
await setZoomFactorOfServer(browserWindow, firstServerId, 1.0);
@@ -179,9 +168,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 +190,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();