[MM-46535] Fix E2E tests for reporting purposes (#2236)
This commit is contained in:
@@ -7,27 +7,29 @@ const fs = require('fs');
|
||||
const env = require('../../modules/environment');
|
||||
const {asyncSleep} = require('../../modules/utils');
|
||||
|
||||
const config = env.demoConfig;
|
||||
|
||||
describe('menu_bar/dropdown', function desc() {
|
||||
this.timeout(30000);
|
||||
|
||||
const config = env.demoConfig;
|
||||
|
||||
beforeEach(async () => {
|
||||
const beforeFunc = async () => {
|
||||
env.createTestUserDataDir();
|
||||
env.cleanTestConfig();
|
||||
fs.writeFileSync(env.configFilePath, JSON.stringify(config));
|
||||
await asyncSleep(1000);
|
||||
this.app = await env.getApp();
|
||||
});
|
||||
};
|
||||
|
||||
afterEach(async () => {
|
||||
const afterFunc = async () => {
|
||||
if (this.app) {
|
||||
await this.app.close();
|
||||
}
|
||||
await env.clearElectronInstances();
|
||||
});
|
||||
};
|
||||
|
||||
this.timeout(30000);
|
||||
|
||||
it('MM-T4405 should set name of menu item from config file', async () => {
|
||||
await beforeFunc();
|
||||
|
||||
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');
|
||||
@@ -36,25 +38,40 @@ describe('menu_bar/dropdown', function desc() {
|
||||
|
||||
firstMenuItem.should.equal(config.teams[0].name);
|
||||
secondMenuItem.should.equal(config.teams[1].name);
|
||||
|
||||
await afterFunc();
|
||||
});
|
||||
|
||||
it('MM-T4406 should only show dropdown when button is clicked', async () => {
|
||||
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||
const browserWindow = await this.app.browserWindow(mainWindow);
|
||||
describe('MM-T4406 should only show dropdown when button is clicked', async () => {
|
||||
let mainWindow;
|
||||
let browserWindow;
|
||||
|
||||
let dropdownHeight = await browserWindow.evaluate((window) => window.getBrowserViews().find((view) => view.webContents.getURL().includes('dropdown')).getBounds().height);
|
||||
dropdownHeight.should.equal(0);
|
||||
before(async () => {
|
||||
await beforeFunc();
|
||||
mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||
browserWindow = await this.app.browserWindow(mainWindow);
|
||||
});
|
||||
after(afterFunc);
|
||||
|
||||
await mainWindow.click('.TeamDropdownButton');
|
||||
dropdownHeight = await browserWindow.evaluate((window) => window.getBrowserViews().find((view) => view.webContents.getURL().includes('dropdown')).getBounds().height);
|
||||
dropdownHeight.should.be.greaterThan(0);
|
||||
it('MM-T4406_1 should show the dropdown', async () => {
|
||||
let dropdownHeight = await browserWindow.evaluate((window) => window.getBrowserViews().find((view) => view.webContents.getURL().includes('dropdown')).getBounds().height);
|
||||
dropdownHeight.should.equal(0);
|
||||
|
||||
await mainWindow.click('.TabBar');
|
||||
dropdownHeight = await browserWindow.evaluate((window) => window.getBrowserViews().find((view) => view.webContents.getURL().includes('dropdown')).getBounds().height);
|
||||
dropdownHeight.should.equal(0);
|
||||
await mainWindow.click('.TeamDropdownButton');
|
||||
dropdownHeight = await browserWindow.evaluate((window) => window.getBrowserViews().find((view) => view.webContents.getURL().includes('dropdown')).getBounds().height);
|
||||
dropdownHeight.should.be.greaterThan(0);
|
||||
});
|
||||
|
||||
it('MM-T4406_2 should hide the dropdown', async () => {
|
||||
await mainWindow.click('.TabBar');
|
||||
const dropdownHeight = await browserWindow.evaluate((window) => window.getBrowserViews().find((view) => view.webContents.getURL().includes('dropdown')).getBounds().height);
|
||||
dropdownHeight.should.equal(0);
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T4407 should open the new server prompt after clicking the add button', async () => {
|
||||
await beforeFunc();
|
||||
|
||||
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');
|
||||
@@ -65,24 +82,38 @@ describe('menu_bar/dropdown', function desc() {
|
||||
});
|
||||
const modalTitle = await newServerModal.innerText('#newServerModal .modal-title');
|
||||
modalTitle.should.equal('Add Server');
|
||||
|
||||
await afterFunc();
|
||||
});
|
||||
|
||||
it('MM-T4408 should show only the selected team', async () => {
|
||||
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||
const browserWindow = await this.app.browserWindow(mainWindow);
|
||||
describe('MM-T4408 Switch Servers', async () => {
|
||||
let mainWindow;
|
||||
let browserWindow;
|
||||
let dropdownView;
|
||||
|
||||
let firstViewIsAttached = await browserWindow.evaluate((window, url) => Boolean(window.getBrowserViews().find((view) => view.webContents.getURL() === url)), env.exampleURL);
|
||||
firstViewIsAttached.should.be.true;
|
||||
let secondViewIsAttached = await browserWindow.evaluate((window) => Boolean(window.getBrowserViews().find((view) => view.webContents.getURL() === 'https://github.com/')));
|
||||
secondViewIsAttached.should.be.false;
|
||||
before(async () => {
|
||||
await beforeFunc();
|
||||
mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||
browserWindow = await this.app.browserWindow(mainWindow);
|
||||
dropdownView = this.app.windows().find((window) => window.url().includes('dropdown'));
|
||||
});
|
||||
after(afterFunc);
|
||||
|
||||
const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown'));
|
||||
await mainWindow.click('.TeamDropdownButton');
|
||||
await dropdownView.click('.TeamDropdown button.TeamDropdown__button:nth-child(2)');
|
||||
it('MM-T4408_1 should show the first view', async () => {
|
||||
const firstViewIsAttached = await browserWindow.evaluate((window, url) => Boolean(window.getBrowserViews().find((view) => view.webContents.getURL() === url)), env.exampleURL);
|
||||
firstViewIsAttached.should.be.true;
|
||||
const secondViewIsAttached = await browserWindow.evaluate((window) => Boolean(window.getBrowserViews().find((view) => view.webContents.getURL() === 'https://github.com/')));
|
||||
secondViewIsAttached.should.be.false;
|
||||
});
|
||||
|
||||
firstViewIsAttached = await browserWindow.evaluate((window, url) => Boolean(window.getBrowserViews().find((view) => view.webContents.getURL() === url)), env.exampleURL);
|
||||
firstViewIsAttached.should.be.false;
|
||||
secondViewIsAttached = await browserWindow.evaluate((window) => Boolean(window.getBrowserViews().find((view) => view.webContents.getURL() === 'https://github.com/')));
|
||||
secondViewIsAttached.should.be.true;
|
||||
it('MM-T4408_2 should show the second view after clicking the menu item', async () => {
|
||||
await mainWindow.click('.TeamDropdownButton');
|
||||
await dropdownView.click('.TeamDropdown button.TeamDropdown__button:nth-child(2)');
|
||||
|
||||
const firstViewIsAttached = await browserWindow.evaluate((window, url) => Boolean(window.getBrowserViews().find((view) => view.webContents.getURL() === url)), env.exampleURL);
|
||||
firstViewIsAttached.should.be.false;
|
||||
const secondViewIsAttached = await browserWindow.evaluate((window) => Boolean(window.getBrowserViews().find((view) => view.webContents.getURL() === 'https://github.com/')));
|
||||
secondViewIsAttached.should.be.true;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -124,7 +124,7 @@ describe('menu/view', function desc() {
|
||||
});
|
||||
|
||||
describe('MM-T818 Zoom in from the menu bar', () => {
|
||||
it('MM-T818 Zoom in when CmdOrCtrl+Plus is pressed', async () => {
|
||||
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'));
|
||||
@@ -140,7 +140,7 @@ describe('menu/view', function desc() {
|
||||
zoomLevel.should.be.greaterThan(1);
|
||||
});
|
||||
|
||||
it('MM-T818_1 Zoom in when CmdOrCtrl+Shift+Plus is pressed', async () => {
|
||||
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'));
|
||||
@@ -163,8 +163,8 @@ describe('menu/view', function desc() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('MM-T818 Zoom out from the menu bar', () => {
|
||||
it('MM-T819 Zoom out when CmdOrCtrl+Minus is pressed', async () => {
|
||||
describe('MM-T819 Zoom out from the menu bar', () => {
|
||||
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'));
|
||||
@@ -180,7 +180,7 @@ describe('menu/view', function desc() {
|
||||
zoomLevel.should.be.lessThan(1);
|
||||
});
|
||||
|
||||
it('MM-T819_1 Zoom out when CmdOrCtrl+Shift+Minus is pressed', async () => {
|
||||
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'));
|
||||
|
@@ -10,8 +10,6 @@ const env = require('../../modules/environment');
|
||||
const {asyncSleep} = require('../../modules/utils');
|
||||
|
||||
describe('Menu/window_menu', function desc() {
|
||||
this.timeout(30000);
|
||||
|
||||
const config = {
|
||||
...env.demoConfig,
|
||||
teams: [
|
||||
@@ -44,62 +42,90 @@ describe('Menu/window_menu', function desc() {
|
||||
alwaysMinimize: true,
|
||||
};
|
||||
|
||||
beforeEach(async () => {
|
||||
const beforeFunc = async () => {
|
||||
env.cleanDataDir();
|
||||
env.createTestUserDataDir();
|
||||
env.cleanTestConfig();
|
||||
fs.writeFileSync(env.configFilePath, JSON.stringify(config));
|
||||
await asyncSleep(1000);
|
||||
this.app = await env.getApp();
|
||||
});
|
||||
};
|
||||
|
||||
afterEach(async () => {
|
||||
const afterFunc = async () => {
|
||||
if (this.app) {
|
||||
await this.app.close();
|
||||
}
|
||||
await env.clearElectronInstances();
|
||||
});
|
||||
};
|
||||
|
||||
it('MM-T826 should switch to servers when keyboard shortcuts are pressed', async () => {
|
||||
await env.getServerMap(this.app);
|
||||
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||
this.timeout(30000);
|
||||
|
||||
let dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton');
|
||||
dropdownButtonText.should.equal('example');
|
||||
describe('MM-T826 should switch to servers when keyboard shortcuts are pressed', async () => {
|
||||
let mainWindow;
|
||||
|
||||
robot.keyTap('2', ['control', process.platform === 'darwin' ? 'command' : 'shift']);
|
||||
dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton:has-text("github")');
|
||||
dropdownButtonText.should.equal('github');
|
||||
before(async () => {
|
||||
await beforeFunc();
|
||||
await env.getServerMap(this.app);
|
||||
mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||
});
|
||||
after(afterFunc);
|
||||
|
||||
robot.keyTap('3', ['control', process.platform === 'darwin' ? 'command' : 'shift']);
|
||||
dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton:has-text("google")');
|
||||
dropdownButtonText.should.equal('google');
|
||||
it('MM-T826_1 should show the second server', async () => {
|
||||
let dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton');
|
||||
dropdownButtonText.should.equal('example');
|
||||
|
||||
robot.keyTap('1', ['control', process.platform === 'darwin' ? 'command' : 'shift']);
|
||||
dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton:has-text("example")');
|
||||
dropdownButtonText.should.equal('example');
|
||||
robot.keyTap('2', ['control', process.platform === 'darwin' ? 'command' : 'shift']);
|
||||
dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton:has-text("github")');
|
||||
dropdownButtonText.should.equal('github');
|
||||
});
|
||||
|
||||
it('MM-T826_2 should show the third server', async () => {
|
||||
robot.keyTap('3', ['control', process.platform === 'darwin' ? 'command' : 'shift']);
|
||||
const dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton:has-text("google")');
|
||||
dropdownButtonText.should.equal('google');
|
||||
});
|
||||
|
||||
it('MM-T826_3 should show the first server', async () => {
|
||||
robot.keyTap('1', ['control', process.platform === 'darwin' ? 'command' : 'shift']);
|
||||
const dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton:has-text("example")');
|
||||
dropdownButtonText.should.equal('example');
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T4385 select tab from menu', async () => {
|
||||
const mainView = this.app.windows().find((window) => window.url().includes('index'));
|
||||
let mainView;
|
||||
|
||||
let tabViewButton = await mainView.innerText('.active');
|
||||
tabViewButton.should.equal('Channels');
|
||||
before(async () => {
|
||||
await beforeFunc();
|
||||
mainView = this.app.windows().find((window) => window.url().includes('index'));
|
||||
});
|
||||
after(afterFunc);
|
||||
|
||||
robot.keyTap('2', [env.cmdOrCtrl]);
|
||||
tabViewButton = await mainView.innerText('.active');
|
||||
tabViewButton.should.equal('Boards');
|
||||
it('MM-T4385_1 should show the second tab', async () => {
|
||||
let tabViewButton = await mainView.innerText('.active');
|
||||
tabViewButton.should.equal('Channels');
|
||||
|
||||
robot.keyTap('3', [env.cmdOrCtrl]);
|
||||
tabViewButton = await mainView.innerText('.active');
|
||||
tabViewButton.should.equal('Playbooks');
|
||||
robot.keyTap('2', [env.cmdOrCtrl]);
|
||||
tabViewButton = await mainView.innerText('.active');
|
||||
tabViewButton.should.equal('Boards');
|
||||
});
|
||||
|
||||
robot.keyTap('1', [env.cmdOrCtrl]);
|
||||
tabViewButton = await mainView.innerText('.active');
|
||||
tabViewButton.should.equal('Channels');
|
||||
it('MM-T4385_2 should show the third tab', async () => {
|
||||
robot.keyTap('3', [env.cmdOrCtrl]);
|
||||
const tabViewButton = await mainView.innerText('.active');
|
||||
tabViewButton.should.equal('Playbooks');
|
||||
});
|
||||
|
||||
it('MM-T4385_3 should show the first tab', async () => {
|
||||
robot.keyTap('1', [env.cmdOrCtrl]);
|
||||
const tabViewButton = await mainView.innerText('.active');
|
||||
tabViewButton.should.equal('Channels');
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T827 select next/previous tab', async () => {
|
||||
await beforeFunc();
|
||||
|
||||
const mainView = this.app.windows().find((window) => window.url().includes('index'));
|
||||
|
||||
let tabViewButton = await mainView.innerText('.active');
|
||||
@@ -112,9 +138,13 @@ describe('Menu/window_menu', function desc() {
|
||||
robot.keyTap('tab', ['shift', 'control']);
|
||||
tabViewButton = await mainView.innerText('.active');
|
||||
tabViewButton.should.equal('Channels');
|
||||
|
||||
await afterFunc();
|
||||
});
|
||||
|
||||
it('MM-T824 should be minimized when keyboard shortcuts are pressed', async () => {
|
||||
await beforeFunc();
|
||||
|
||||
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||
const browserWindow = await this.app.browserWindow(mainWindow);
|
||||
if (process.platform === 'darwin') {
|
||||
@@ -129,9 +159,13 @@ describe('Menu/window_menu', function desc() {
|
||||
await asyncSleep(2000);
|
||||
const isMinimized = await browserWindow.evaluate((window) => window.isMinimized());
|
||||
isMinimized.should.be.true;
|
||||
|
||||
await afterFunc();
|
||||
});
|
||||
|
||||
it('MM-T825 should be hidden when keyboard shortcuts are pressed', async () => {
|
||||
await beforeFunc();
|
||||
|
||||
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||
const browserWindow = await this.app.browserWindow(mainWindow);
|
||||
robot.keyTap('w', [env.cmdOrCtrl]);
|
||||
@@ -140,5 +174,7 @@ describe('Menu/window_menu', function desc() {
|
||||
isVisible.should.be.false;
|
||||
const isDestroyed = await browserWindow.evaluate((window) => window.isDestroyed());
|
||||
isDestroyed.should.be.false;
|
||||
|
||||
await afterFunc();
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user