[MM-46535] Fix E2E tests for reporting purposes (#2236)
This commit is contained in:
@@ -7,7 +7,7 @@ const fs = require('fs');
|
|||||||
const env = require('../../modules/environment');
|
const env = require('../../modules/environment');
|
||||||
const {asyncSleep} = require('../../modules/utils');
|
const {asyncSleep} = require('../../modules/utils');
|
||||||
|
|
||||||
describe('back_button', function desc() {
|
describe('MM-T2633 Back button should behave as expected', function desc() {
|
||||||
this.timeout(30000);
|
this.timeout(30000);
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
@@ -39,7 +39,11 @@ describe('back_button', function desc() {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(async () => {
|
let mainWindow;
|
||||||
|
let firstServer;
|
||||||
|
let backButton;
|
||||||
|
|
||||||
|
before(async () => {
|
||||||
env.cleanDataDir();
|
env.cleanDataDir();
|
||||||
env.createTestUserDataDir();
|
env.createTestUserDataDir();
|
||||||
env.cleanTestConfig();
|
env.cleanTestConfig();
|
||||||
@@ -47,49 +51,57 @@ describe('back_button', function desc() {
|
|||||||
await asyncSleep(1000);
|
await asyncSleep(1000);
|
||||||
this.app = await env.getApp();
|
this.app = await env.getApp();
|
||||||
this.serverMap = await env.getServerMap(this.app);
|
this.serverMap = await env.getServerMap(this.app);
|
||||||
|
|
||||||
|
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'});
|
||||||
|
firstServer = this.serverMap[`${config.teams[0].name}___TAB_MESSAGING`].win;
|
||||||
|
await firstServer.click('a:has-text("OneLogin")');
|
||||||
|
backButton = await mainWindow.waitForSelector('button:has-text("Back")');
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
after(async () => {
|
||||||
if (this.app) {
|
if (this.app) {
|
||||||
await this.app.close();
|
await this.app.close();
|
||||||
}
|
}
|
||||||
await env.clearElectronInstances();
|
await env.clearElectronInstances();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('MM-T2633 Back button should behave as expected', async () => {
|
it('MM-T2633_1 after clicking OneLogin, back button should appear', 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 firstServer.click('a:has-text("OneLogin")');
|
|
||||||
let backButton = await mainWindow.waitForSelector('button:has-text("Back")');
|
|
||||||
backButton.should.not.be.null;
|
backButton.should.not.be.null;
|
||||||
let poweredByOneLogin = await firstServer.waitForSelector('a:has-text("Powered by OneLogin")');
|
const poweredByOneLogin = await firstServer.waitForSelector('a:has-text("Powered by OneLogin")');
|
||||||
poweredByOneLogin.should.not.be.null;
|
poweredByOneLogin.should.not.be.null;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('MM-T2633_2 after clicking Back, should be back on the login screen', async () => {
|
||||||
await backButton.click();
|
await backButton.click();
|
||||||
let loginPrompt = await firstServer.waitForSelector('#input_loginId');
|
const loginPrompt = await firstServer.waitForSelector('#input_loginId');
|
||||||
loginPrompt.should.not.be.null;
|
loginPrompt.should.not.be.null;
|
||||||
await mainWindow.waitForSelector('button:has-text("Back")', {state: 'hidden'});
|
await mainWindow.waitForSelector('button:has-text("Back")', {state: 'hidden'});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('MM-T2633_3 on the OneLogin screen, should still allow links to be clicked and still show the Back button', async () => {
|
||||||
let isNewWindow = false;
|
let isNewWindow = false;
|
||||||
this.app.on('window', () => {
|
this.app.on('window', () => {
|
||||||
isNewWindow = true;
|
isNewWindow = true;
|
||||||
});
|
});
|
||||||
const oneLoginUrl = firstServer.url();
|
const oneLoginUrl = firstServer.url();
|
||||||
await firstServer.click('a:has-text("OneLogin")');
|
await firstServer.click('a:has-text("OneLogin")');
|
||||||
poweredByOneLogin = await firstServer.waitForSelector('a:has-text("Powered by OneLogin")');
|
const poweredByOneLogin = await firstServer.waitForSelector('a:has-text("Powered by OneLogin")');
|
||||||
poweredByOneLogin.click();
|
poweredByOneLogin.click();
|
||||||
backButton = await mainWindow.waitForSelector('button:has-text("Back")');
|
backButton = await mainWindow.waitForSelector('button:has-text("Back")');
|
||||||
backButton.should.not.be.null;
|
backButton.should.not.be.null;
|
||||||
const frameUrl = firstServer.url();
|
const frameUrl = firstServer.url();
|
||||||
frameUrl.should.not.equal(oneLoginUrl);
|
frameUrl.should.not.equal(oneLoginUrl);
|
||||||
isNewWindow.should.be.false;
|
isNewWindow.should.be.false;
|
||||||
|
await firstServer.waitForSelector('a:has-text("Powered by OneLogin")', {state: 'hidden'});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('MM-T2633_4 after click Back twice, user should be on the main login screen again', async () => {
|
||||||
await backButton.click();
|
await backButton.click();
|
||||||
|
await firstServer.waitForURL('https://mattermost.onelogin.com/**');
|
||||||
await backButton.click();
|
await backButton.click();
|
||||||
loginPrompt = await firstServer.waitForSelector('#input_loginId');
|
const loginPrompt = await firstServer.waitForSelector('#input_loginId');
|
||||||
loginPrompt.should.not.be.null;
|
loginPrompt.should.not.be.null;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -7,27 +7,29 @@ const fs = require('fs');
|
|||||||
const env = require('../../modules/environment');
|
const env = require('../../modules/environment');
|
||||||
const {asyncSleep} = require('../../modules/utils');
|
const {asyncSleep} = require('../../modules/utils');
|
||||||
|
|
||||||
|
const config = env.demoConfig;
|
||||||
|
|
||||||
describe('menu_bar/dropdown', function desc() {
|
describe('menu_bar/dropdown', function desc() {
|
||||||
this.timeout(30000);
|
const beforeFunc = async () => {
|
||||||
|
|
||||||
const config = env.demoConfig;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
env.createTestUserDataDir();
|
env.createTestUserDataDir();
|
||||||
env.cleanTestConfig();
|
env.cleanTestConfig();
|
||||||
fs.writeFileSync(env.configFilePath, JSON.stringify(config));
|
fs.writeFileSync(env.configFilePath, JSON.stringify(config));
|
||||||
await asyncSleep(1000);
|
await asyncSleep(1000);
|
||||||
this.app = await env.getApp();
|
this.app = await env.getApp();
|
||||||
});
|
};
|
||||||
|
|
||||||
afterEach(async () => {
|
const afterFunc = async () => {
|
||||||
if (this.app) {
|
if (this.app) {
|
||||||
await this.app.close();
|
await this.app.close();
|
||||||
}
|
}
|
||||||
await env.clearElectronInstances();
|
await env.clearElectronInstances();
|
||||||
});
|
};
|
||||||
|
|
||||||
|
this.timeout(30000);
|
||||||
|
|
||||||
it('MM-T4405 should set name of menu item from config file', async () => {
|
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 mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||||
const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown'));
|
const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown'));
|
||||||
await mainWindow.click('.TeamDropdownButton');
|
await mainWindow.click('.TeamDropdownButton');
|
||||||
@@ -36,25 +38,40 @@ describe('menu_bar/dropdown', function desc() {
|
|||||||
|
|
||||||
firstMenuItem.should.equal(config.teams[0].name);
|
firstMenuItem.should.equal(config.teams[0].name);
|
||||||
secondMenuItem.should.equal(config.teams[1].name);
|
secondMenuItem.should.equal(config.teams[1].name);
|
||||||
|
|
||||||
|
await afterFunc();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('MM-T4406 should only show dropdown when button is clicked', async () => {
|
describe('MM-T4406 should only show dropdown when button is clicked', async () => {
|
||||||
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
let mainWindow;
|
||||||
const browserWindow = await this.app.browserWindow(mainWindow);
|
let browserWindow;
|
||||||
|
|
||||||
let dropdownHeight = await browserWindow.evaluate((window) => window.getBrowserViews().find((view) => view.webContents.getURL().includes('dropdown')).getBounds().height);
|
before(async () => {
|
||||||
dropdownHeight.should.equal(0);
|
await beforeFunc();
|
||||||
|
mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||||
|
browserWindow = await this.app.browserWindow(mainWindow);
|
||||||
|
});
|
||||||
|
after(afterFunc);
|
||||||
|
|
||||||
await mainWindow.click('.TeamDropdownButton');
|
it('MM-T4406_1 should show the dropdown', async () => {
|
||||||
dropdownHeight = await browserWindow.evaluate((window) => window.getBrowserViews().find((view) => view.webContents.getURL().includes('dropdown')).getBounds().height);
|
let dropdownHeight = await browserWindow.evaluate((window) => window.getBrowserViews().find((view) => view.webContents.getURL().includes('dropdown')).getBounds().height);
|
||||||
dropdownHeight.should.be.greaterThan(0);
|
dropdownHeight.should.equal(0);
|
||||||
|
|
||||||
await mainWindow.click('.TabBar');
|
await mainWindow.click('.TeamDropdownButton');
|
||||||
dropdownHeight = await browserWindow.evaluate((window) => window.getBrowserViews().find((view) => view.webContents.getURL().includes('dropdown')).getBounds().height);
|
dropdownHeight = await browserWindow.evaluate((window) => window.getBrowserViews().find((view) => view.webContents.getURL().includes('dropdown')).getBounds().height);
|
||||||
dropdownHeight.should.equal(0);
|
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 () => {
|
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 mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||||
const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown'));
|
const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown'));
|
||||||
await mainWindow.click('.TeamDropdownButton');
|
await mainWindow.click('.TeamDropdownButton');
|
||||||
@@ -65,24 +82,38 @@ describe('menu_bar/dropdown', function desc() {
|
|||||||
});
|
});
|
||||||
const modalTitle = await newServerModal.innerText('#newServerModal .modal-title');
|
const modalTitle = await newServerModal.innerText('#newServerModal .modal-title');
|
||||||
modalTitle.should.equal('Add Server');
|
modalTitle.should.equal('Add Server');
|
||||||
|
|
||||||
|
await afterFunc();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('MM-T4408 should show only the selected team', async () => {
|
describe('MM-T4408 Switch Servers', async () => {
|
||||||
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
let mainWindow;
|
||||||
const browserWindow = await this.app.browserWindow(mainWindow);
|
let browserWindow;
|
||||||
|
let dropdownView;
|
||||||
|
|
||||||
let firstViewIsAttached = await browserWindow.evaluate((window, url) => Boolean(window.getBrowserViews().find((view) => view.webContents.getURL() === url)), env.exampleURL);
|
before(async () => {
|
||||||
firstViewIsAttached.should.be.true;
|
await beforeFunc();
|
||||||
let secondViewIsAttached = await browserWindow.evaluate((window) => Boolean(window.getBrowserViews().find((view) => view.webContents.getURL() === 'https://github.com/')));
|
mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||||
secondViewIsAttached.should.be.false;
|
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'));
|
it('MM-T4408_1 should show the first view', async () => {
|
||||||
await mainWindow.click('.TeamDropdownButton');
|
const firstViewIsAttached = await browserWindow.evaluate((window, url) => Boolean(window.getBrowserViews().find((view) => view.webContents.getURL() === url)), env.exampleURL);
|
||||||
await dropdownView.click('.TeamDropdown button.TeamDropdown__button:nth-child(2)');
|
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);
|
it('MM-T4408_2 should show the second view after clicking the menu item', async () => {
|
||||||
firstViewIsAttached.should.be.false;
|
await mainWindow.click('.TeamDropdownButton');
|
||||||
secondViewIsAttached = await browserWindow.evaluate((window) => Boolean(window.getBrowserViews().find((view) => view.webContents.getURL() === 'https://github.com/')));
|
await dropdownView.click('.TeamDropdown button.TeamDropdown__button:nth-child(2)');
|
||||||
secondViewIsAttached.should.be.true;
|
|
||||||
|
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', () => {
|
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 mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||||
const browserWindow = await this.app.browserWindow(mainWindow);
|
const browserWindow = await this.app.browserWindow(mainWindow);
|
||||||
const loadingScreen = this.app.windows().find((window) => window.url().includes('loadingScreen'));
|
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);
|
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 mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||||
const browserWindow = await this.app.browserWindow(mainWindow);
|
const browserWindow = await this.app.browserWindow(mainWindow);
|
||||||
const loadingScreen = this.app.windows().find((window) => window.url().includes('loadingScreen'));
|
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', () => {
|
describe('MM-T819 Zoom out from the menu bar', () => {
|
||||||
it('MM-T819 Zoom out when CmdOrCtrl+Minus is pressed', async () => {
|
it('MM-T819_1 Zoom out when CmdOrCtrl+Minus is pressed', async () => {
|
||||||
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||||
const browserWindow = await this.app.browserWindow(mainWindow);
|
const browserWindow = await this.app.browserWindow(mainWindow);
|
||||||
const loadingScreen = this.app.windows().find((window) => window.url().includes('loadingScreen'));
|
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);
|
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 mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||||
const browserWindow = await this.app.browserWindow(mainWindow);
|
const browserWindow = await this.app.browserWindow(mainWindow);
|
||||||
const loadingScreen = this.app.windows().find((window) => window.url().includes('loadingScreen'));
|
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');
|
const {asyncSleep} = require('../../modules/utils');
|
||||||
|
|
||||||
describe('Menu/window_menu', function desc() {
|
describe('Menu/window_menu', function desc() {
|
||||||
this.timeout(30000);
|
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
...env.demoConfig,
|
...env.demoConfig,
|
||||||
teams: [
|
teams: [
|
||||||
@@ -44,62 +42,90 @@ describe('Menu/window_menu', function desc() {
|
|||||||
alwaysMinimize: true,
|
alwaysMinimize: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(async () => {
|
const beforeFunc = async () => {
|
||||||
env.cleanDataDir();
|
env.cleanDataDir();
|
||||||
env.createTestUserDataDir();
|
env.createTestUserDataDir();
|
||||||
env.cleanTestConfig();
|
env.cleanTestConfig();
|
||||||
fs.writeFileSync(env.configFilePath, JSON.stringify(config));
|
fs.writeFileSync(env.configFilePath, JSON.stringify(config));
|
||||||
await asyncSleep(1000);
|
await asyncSleep(1000);
|
||||||
this.app = await env.getApp();
|
this.app = await env.getApp();
|
||||||
});
|
};
|
||||||
|
|
||||||
afterEach(async () => {
|
const afterFunc = async () => {
|
||||||
if (this.app) {
|
if (this.app) {
|
||||||
await this.app.close();
|
await this.app.close();
|
||||||
}
|
}
|
||||||
await env.clearElectronInstances();
|
await env.clearElectronInstances();
|
||||||
});
|
};
|
||||||
|
|
||||||
it('MM-T826 should switch to servers when keyboard shortcuts are pressed', async () => {
|
this.timeout(30000);
|
||||||
await env.getServerMap(this.app);
|
|
||||||
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
|
||||||
|
|
||||||
let dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton');
|
describe('MM-T826 should switch to servers when keyboard shortcuts are pressed', async () => {
|
||||||
dropdownButtonText.should.equal('example');
|
let mainWindow;
|
||||||
|
|
||||||
robot.keyTap('2', ['control', process.platform === 'darwin' ? 'command' : 'shift']);
|
before(async () => {
|
||||||
dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton:has-text("github")');
|
await beforeFunc();
|
||||||
dropdownButtonText.should.equal('github');
|
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']);
|
it('MM-T826_1 should show the second server', async () => {
|
||||||
dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton:has-text("google")');
|
let dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton');
|
||||||
dropdownButtonText.should.equal('google');
|
dropdownButtonText.should.equal('example');
|
||||||
|
|
||||||
robot.keyTap('1', ['control', process.platform === 'darwin' ? 'command' : 'shift']);
|
robot.keyTap('2', ['control', process.platform === 'darwin' ? 'command' : 'shift']);
|
||||||
dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton:has-text("example")');
|
dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton:has-text("github")');
|
||||||
dropdownButtonText.should.equal('example');
|
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 () => {
|
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');
|
before(async () => {
|
||||||
tabViewButton.should.equal('Channels');
|
await beforeFunc();
|
||||||
|
mainView = this.app.windows().find((window) => window.url().includes('index'));
|
||||||
|
});
|
||||||
|
after(afterFunc);
|
||||||
|
|
||||||
robot.keyTap('2', [env.cmdOrCtrl]);
|
it('MM-T4385_1 should show the second tab', async () => {
|
||||||
tabViewButton = await mainView.innerText('.active');
|
let tabViewButton = await mainView.innerText('.active');
|
||||||
tabViewButton.should.equal('Boards');
|
tabViewButton.should.equal('Channels');
|
||||||
|
|
||||||
robot.keyTap('3', [env.cmdOrCtrl]);
|
robot.keyTap('2', [env.cmdOrCtrl]);
|
||||||
tabViewButton = await mainView.innerText('.active');
|
tabViewButton = await mainView.innerText('.active');
|
||||||
tabViewButton.should.equal('Playbooks');
|
tabViewButton.should.equal('Boards');
|
||||||
|
});
|
||||||
|
|
||||||
robot.keyTap('1', [env.cmdOrCtrl]);
|
it('MM-T4385_2 should show the third tab', async () => {
|
||||||
tabViewButton = await mainView.innerText('.active');
|
robot.keyTap('3', [env.cmdOrCtrl]);
|
||||||
tabViewButton.should.equal('Channels');
|
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 () => {
|
it('MM-T827 select next/previous tab', async () => {
|
||||||
|
await beforeFunc();
|
||||||
|
|
||||||
const mainView = this.app.windows().find((window) => window.url().includes('index'));
|
const mainView = this.app.windows().find((window) => window.url().includes('index'));
|
||||||
|
|
||||||
let tabViewButton = await mainView.innerText('.active');
|
let tabViewButton = await mainView.innerText('.active');
|
||||||
@@ -112,9 +138,13 @@ describe('Menu/window_menu', function desc() {
|
|||||||
robot.keyTap('tab', ['shift', 'control']);
|
robot.keyTap('tab', ['shift', 'control']);
|
||||||
tabViewButton = await mainView.innerText('.active');
|
tabViewButton = await mainView.innerText('.active');
|
||||||
tabViewButton.should.equal('Channels');
|
tabViewButton.should.equal('Channels');
|
||||||
|
|
||||||
|
await afterFunc();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('MM-T824 should be minimized when keyboard shortcuts are pressed', async () => {
|
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 mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||||
const browserWindow = await this.app.browserWindow(mainWindow);
|
const browserWindow = await this.app.browserWindow(mainWindow);
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
@@ -129,9 +159,13 @@ describe('Menu/window_menu', function desc() {
|
|||||||
await asyncSleep(2000);
|
await asyncSleep(2000);
|
||||||
const isMinimized = await browserWindow.evaluate((window) => window.isMinimized());
|
const isMinimized = await browserWindow.evaluate((window) => window.isMinimized());
|
||||||
isMinimized.should.be.true;
|
isMinimized.should.be.true;
|
||||||
|
|
||||||
|
await afterFunc();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('MM-T825 should be hidden when keyboard shortcuts are pressed', async () => {
|
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 mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||||
const browserWindow = await this.app.browserWindow(mainWindow);
|
const browserWindow = await this.app.browserWindow(mainWindow);
|
||||||
robot.keyTap('w', [env.cmdOrCtrl]);
|
robot.keyTap('w', [env.cmdOrCtrl]);
|
||||||
@@ -140,5 +174,7 @@ describe('Menu/window_menu', function desc() {
|
|||||||
isVisible.should.be.false;
|
isVisible.should.be.false;
|
||||||
const isDestroyed = await browserWindow.evaluate((window) => window.isDestroyed());
|
const isDestroyed = await browserWindow.evaluate((window) => window.isDestroyed());
|
||||||
isDestroyed.should.be.false;
|
isDestroyed.should.be.false;
|
||||||
|
|
||||||
|
await afterFunc();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -53,16 +53,12 @@ describe('Add Server Modal', function desc() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('MM-T4389 Invalid messages', () => {
|
describe('MM-T4389 Invalid messages', () => {
|
||||||
it('MM-T4389_1 should not be valid if no team name has been set', async () => {
|
it('MM-T4389_1 should not be valid if no team name or URL has been set', async () => {
|
||||||
await newServerView.click('#saveNewServerModal');
|
await newServerView.click('#saveNewServerModal');
|
||||||
const existing = await newServerView.isVisible('#teamNameInput.is-invalid');
|
const existingName = await newServerView.isVisible('#teamNameInput.is-invalid');
|
||||||
existing.should.be.true;
|
const existingUrl = await newServerView.isVisible('#teamUrlInput.is-invalid');
|
||||||
});
|
existingName.should.be.true;
|
||||||
|
existingUrl.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;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not be valid if a server with the same name exists', async () => {
|
it('should not be valid if a server with the same name exists', async () => {
|
||||||
@@ -87,13 +83,12 @@ describe('Add Server Modal', function desc() {
|
|||||||
await newServerView.click('#saveNewServerModal');
|
await newServerView.click('#saveNewServerModal');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('MM-T4389_3 should not be marked invalid', async () => {
|
it('MM-T4389_2 Name should not be marked invalid, URL should be marked invalid', async () => {
|
||||||
const existing = await newServerView.isVisible('#teamNameInput.is-invalid');
|
const existingName = await newServerView.isVisible('#teamNameInput.is-invalid');
|
||||||
existing.should.be.false;
|
const existingUrl = await newServerView.isVisible('#teamUrlInput.is-invalid');
|
||||||
});
|
|
||||||
|
|
||||||
it('MM-T4389_4 should not be possible to click save', async () => {
|
|
||||||
const disabled = await newServerView.getAttribute('#saveNewServerModal', 'disabled');
|
const disabled = await newServerView.getAttribute('#saveNewServerModal', 'disabled');
|
||||||
|
existingName.should.be.false;
|
||||||
|
existingUrl.should.be.true;
|
||||||
(disabled === '').should.be.true;
|
(disabled === '').should.be.true;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -104,13 +99,12 @@ describe('Add Server Modal', function desc() {
|
|||||||
await newServerView.click('#saveNewServerModal');
|
await newServerView.click('#saveNewServerModal');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('MM-T4389_5 should be valid', async () => {
|
it('MM-T4389_3 URL should not be marked invalid, name should be marked invalid', async () => {
|
||||||
const existing = await newServerView.isVisible('#teamUrlInput.is-invalid');
|
const existingName = await newServerView.isVisible('#teamNameInput.is-invalid');
|
||||||
existing.should.be.false;
|
const existingUrl = await newServerView.isVisible('#teamUrlInput.is-invalid');
|
||||||
});
|
|
||||||
|
|
||||||
it('MM-T4389_6 should not be possible to click save', async () => {
|
|
||||||
const disabled = await newServerView.getAttribute('#saveNewServerModal', 'disabled');
|
const disabled = await newServerView.getAttribute('#saveNewServerModal', 'disabled');
|
||||||
|
existingName.should.be.true;
|
||||||
|
existingUrl.should.be.false;
|
||||||
(disabled === '').should.be.true;
|
(disabled === '').should.be.true;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -8,8 +8,6 @@ const env = require('../../modules/environment');
|
|||||||
const {asyncSleep} = require('../../modules/utils');
|
const {asyncSleep} = require('../../modules/utils');
|
||||||
|
|
||||||
describe('server_management/drag_and_drop', function desc() {
|
describe('server_management/drag_and_drop', function desc() {
|
||||||
this.timeout(30000);
|
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
...env.demoConfig,
|
...env.demoConfig,
|
||||||
teams: [
|
teams: [
|
||||||
@@ -40,107 +38,134 @@ describe('server_management/drag_and_drop', function desc() {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(async () => {
|
const beforeFunc = async () => {
|
||||||
env.createTestUserDataDir();
|
env.createTestUserDataDir();
|
||||||
env.cleanTestConfig();
|
env.cleanTestConfig();
|
||||||
fs.writeFileSync(env.configFilePath, JSON.stringify(config));
|
fs.writeFileSync(env.configFilePath, JSON.stringify(config));
|
||||||
await asyncSleep(1000);
|
await asyncSleep(1000);
|
||||||
this.app = await env.getApp();
|
this.app = await env.getApp();
|
||||||
});
|
};
|
||||||
|
|
||||||
afterEach(async () => {
|
const afterFunc = async () => {
|
||||||
if (this.app) {
|
if (this.app) {
|
||||||
await this.app.close();
|
await this.app.close();
|
||||||
}
|
}
|
||||||
await env.clearElectronInstances();
|
await env.clearElectronInstances();
|
||||||
|
};
|
||||||
|
|
||||||
|
this.timeout(30000);
|
||||||
|
|
||||||
|
describe('MM-T2634 should be able to drag and drop servers in the dropdown menu', async () => {
|
||||||
|
let mainWindow;
|
||||||
|
let dropdownView;
|
||||||
|
|
||||||
|
before(async () => {
|
||||||
|
await beforeFunc();
|
||||||
|
mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||||
|
dropdownView = this.app.windows().find((window) => window.url().includes('dropdown'));
|
||||||
|
await mainWindow.click('.TeamDropdownButton');
|
||||||
|
});
|
||||||
|
after(afterFunc);
|
||||||
|
|
||||||
|
it('MM-T2634_1 should appear the original order', async () => {
|
||||||
|
const firstMenuItem = await dropdownView.waitForSelector('.TeamDropdown button.TeamDropdown__button:nth-child(1) .TeamDropdown__draggable-handle');
|
||||||
|
const firstMenuItemText = await firstMenuItem.innerText();
|
||||||
|
firstMenuItemText.should.equal('example');
|
||||||
|
const secondMenuItem = await dropdownView.waitForSelector('.TeamDropdown button.TeamDropdown__button:nth-child(2) .TeamDropdown__draggable-handle');
|
||||||
|
const secondMenuItemText = await secondMenuItem.innerText();
|
||||||
|
secondMenuItemText.should.equal('github');
|
||||||
|
const thirdMenuItem = await dropdownView.waitForSelector('.TeamDropdown button.TeamDropdown__button:nth-child(3) .TeamDropdown__draggable-handle');
|
||||||
|
const thirdMenuItemText = await thirdMenuItem.innerText();
|
||||||
|
thirdMenuItemText.should.equal('google');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('MM-T2634_2 after dragging the server down, should appear in the new order', async () => {
|
||||||
|
// Move the first server down, then re-open the dropdown
|
||||||
|
const initialMenuItem = await dropdownView.waitForSelector('.TeamDropdown button.TeamDropdown__button:nth-child(1) .TeamDropdown__draggable-handle');
|
||||||
|
await initialMenuItem.focus();
|
||||||
|
await dropdownView.keyboard.down(' ');
|
||||||
|
await dropdownView.keyboard.down('ArrowDown');
|
||||||
|
await dropdownView.keyboard.down(' ');
|
||||||
|
await asyncSleep(1000);
|
||||||
|
await mainWindow.keyboard.press('Escape');
|
||||||
|
await mainWindow.click('.TeamDropdownButton');
|
||||||
|
|
||||||
|
// Verify that the new order persists
|
||||||
|
const firstMenuItem = await dropdownView.waitForSelector('.TeamDropdown button.TeamDropdown__button:nth-child(1) .TeamDropdown__draggable-handle');
|
||||||
|
const firstMenuItemText = await firstMenuItem.innerText();
|
||||||
|
firstMenuItemText.should.equal('github');
|
||||||
|
const secondMenuItem = await dropdownView.waitForSelector('.TeamDropdown button.TeamDropdown__button:nth-child(2) .TeamDropdown__draggable-handle');
|
||||||
|
const secondMenuItemText = await secondMenuItem.innerText();
|
||||||
|
secondMenuItemText.should.equal('example');
|
||||||
|
const thirdMenuItem = await dropdownView.waitForSelector('.TeamDropdown button.TeamDropdown__button:nth-child(3) .TeamDropdown__draggable-handle');
|
||||||
|
const thirdMenuItemText = await thirdMenuItem.innerText();
|
||||||
|
thirdMenuItemText.should.equal('google');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('MM-T2634_3 should update the config file', () => {
|
||||||
|
// Verify config is updated
|
||||||
|
const newConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf-8'));
|
||||||
|
const order0 = newConfig.teams.find((team) => team.name === 'github');
|
||||||
|
order0.order.should.equal(0);
|
||||||
|
const order1 = newConfig.teams.find((team) => team.name === 'example');
|
||||||
|
order1.order.should.equal(1);
|
||||||
|
const order2 = newConfig.teams.find((team) => team.name === 'google');
|
||||||
|
order2.order.should.equal(2);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('MM-T2634 should be able to drag and drop servers in the dropdown menu', async () => {
|
describe('MM-T2635 should be able to drag and drop tabs', async () => {
|
||||||
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
let mainWindow;
|
||||||
const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown'));
|
before(async () => {
|
||||||
await mainWindow.click('.TeamDropdownButton');
|
await beforeFunc();
|
||||||
|
mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||||
|
});
|
||||||
|
after(afterFunc);
|
||||||
|
|
||||||
// Verify the original order
|
it('MM-T2635_1 should be in the original order', async () => {
|
||||||
let firstMenuItem = await dropdownView.waitForSelector('.TeamDropdown button.TeamDropdown__button:nth-child(1) .TeamDropdown__draggable-handle');
|
// Verify the original order
|
||||||
let firstMenuItemText = await firstMenuItem.innerText();
|
const firstTab = await mainWindow.waitForSelector('.TabBar li.teamTabItem:nth-child(1)');
|
||||||
firstMenuItemText.should.equal('example');
|
const firstTabText = await firstTab.innerText();
|
||||||
let secondMenuItem = await dropdownView.waitForSelector('.TeamDropdown button.TeamDropdown__button:nth-child(2) .TeamDropdown__draggable-handle');
|
firstTabText.should.equal('Channels');
|
||||||
let secondMenuItemText = await secondMenuItem.innerText();
|
const secondTab = await mainWindow.waitForSelector('.TabBar li.teamTabItem:nth-child(2)');
|
||||||
secondMenuItemText.should.equal('github');
|
const secondTabText = await secondTab.innerText();
|
||||||
let thirdMenuItem = await dropdownView.waitForSelector('.TeamDropdown button.TeamDropdown__button:nth-child(3) .TeamDropdown__draggable-handle');
|
secondTabText.should.equal('Boards');
|
||||||
let thirdMenuItemText = await thirdMenuItem.innerText();
|
const thirdTab = await mainWindow.waitForSelector('.TabBar li.teamTabItem:nth-child(3)');
|
||||||
thirdMenuItemText.should.equal('google');
|
const thirdTabText = await thirdTab.innerText();
|
||||||
|
thirdTabText.should.equal('Playbooks');
|
||||||
|
});
|
||||||
|
|
||||||
// Move the first server down, then re-open the dropdown
|
it('MM-T2635_2 after moving the tab to the right, the tab should be in the new order', async () => {
|
||||||
await firstMenuItem.focus();
|
// Move the first tab to the right
|
||||||
await dropdownView.keyboard.down(' ');
|
let firstTab = await mainWindow.waitForSelector('.TabBar li.teamTabItem:nth-child(1)');
|
||||||
await dropdownView.keyboard.down('ArrowDown');
|
await firstTab.focus();
|
||||||
await dropdownView.keyboard.down(' ');
|
await mainWindow.keyboard.down(' ');
|
||||||
await asyncSleep(1000);
|
await mainWindow.keyboard.down('ArrowRight');
|
||||||
await mainWindow.keyboard.press('Escape');
|
await mainWindow.keyboard.down(' ');
|
||||||
await mainWindow.click('.TeamDropdownButton');
|
await asyncSleep(1000);
|
||||||
|
|
||||||
// Verify that the new order persists
|
// Verify that the new order is visible
|
||||||
firstMenuItem = await dropdownView.waitForSelector('.TeamDropdown button.TeamDropdown__button:nth-child(1) .TeamDropdown__draggable-handle');
|
firstTab = await mainWindow.waitForSelector('.TabBar li.teamTabItem:nth-child(1)');
|
||||||
firstMenuItemText = await firstMenuItem.innerText();
|
const firstTabText = await firstTab.innerText();
|
||||||
firstMenuItemText.should.equal('github');
|
firstTabText.should.equal('Boards');
|
||||||
secondMenuItem = await dropdownView.waitForSelector('.TeamDropdown button.TeamDropdown__button:nth-child(2) .TeamDropdown__draggable-handle');
|
const secondTab = await mainWindow.waitForSelector('.TabBar li.teamTabItem:nth-child(2)');
|
||||||
secondMenuItemText = await secondMenuItem.innerText();
|
const secondTabText = await secondTab.innerText();
|
||||||
secondMenuItemText.should.equal('example');
|
secondTabText.should.equal('Channels');
|
||||||
thirdMenuItem = await dropdownView.waitForSelector('.TeamDropdown button.TeamDropdown__button:nth-child(3) .TeamDropdown__draggable-handle');
|
const thirdTab = await mainWindow.waitForSelector('.TabBar li.teamTabItem:nth-child(3)');
|
||||||
thirdMenuItemText = await thirdMenuItem.innerText();
|
const thirdTabText = await thirdTab.innerText();
|
||||||
thirdMenuItemText.should.equal('google');
|
thirdTabText.should.equal('Playbooks');
|
||||||
|
});
|
||||||
|
|
||||||
// Verify config is updated
|
it('MM-T2635_3 should update the config file', () => {
|
||||||
const newConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf-8'));
|
// Verify config is updated
|
||||||
const order0 = newConfig.teams.find((team) => team.name === 'github');
|
const newConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf-8'));
|
||||||
order0.order.should.equal(0);
|
const firstTeam = newConfig.teams.find((team) => team.name === 'example');
|
||||||
const order1 = newConfig.teams.find((team) => team.name === 'example');
|
const order0 = firstTeam.tabs.find((tab) => tab.name === 'TAB_FOCALBOARD');
|
||||||
order1.order.should.equal(1);
|
order0.order.should.equal(0);
|
||||||
const order2 = newConfig.teams.find((team) => team.name === 'google');
|
const order1 = firstTeam.tabs.find((tab) => tab.name === 'TAB_MESSAGING');
|
||||||
order2.order.should.equal(2);
|
order1.order.should.equal(1);
|
||||||
});
|
const order2 = firstTeam.tabs.find((tab) => tab.name === 'TAB_PLAYBOOKS');
|
||||||
|
order2.order.should.equal(2);
|
||||||
it('MM-T2635 should be able to drag and drop tabs', async () => {
|
});
|
||||||
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
|
||||||
|
|
||||||
// Verify the original order
|
|
||||||
let firstTab = await mainWindow.waitForSelector('.TabBar li.teamTabItem:nth-child(1)');
|
|
||||||
let firstTabText = await firstTab.innerText();
|
|
||||||
firstTabText.should.equal('Channels');
|
|
||||||
let secondTab = await mainWindow.waitForSelector('.TabBar li.teamTabItem:nth-child(2)');
|
|
||||||
let secondTabText = await secondTab.innerText();
|
|
||||||
secondTabText.should.equal('Boards');
|
|
||||||
let thirdTab = await mainWindow.waitForSelector('.TabBar li.teamTabItem:nth-child(3)');
|
|
||||||
let thirdTabText = await thirdTab.innerText();
|
|
||||||
thirdTabText.should.equal('Playbooks');
|
|
||||||
|
|
||||||
// Move the first tab to the right
|
|
||||||
await firstTab.focus();
|
|
||||||
await mainWindow.keyboard.down(' ');
|
|
||||||
await mainWindow.keyboard.down('ArrowRight');
|
|
||||||
await mainWindow.keyboard.down(' ');
|
|
||||||
await asyncSleep(1000);
|
|
||||||
|
|
||||||
// Verify that the new order is visible
|
|
||||||
firstTab = await mainWindow.waitForSelector('.TabBar li.teamTabItem:nth-child(1)');
|
|
||||||
firstTabText = await firstTab.innerText();
|
|
||||||
firstTabText.should.equal('Boards');
|
|
||||||
secondTab = await mainWindow.waitForSelector('.TabBar li.teamTabItem:nth-child(2)');
|
|
||||||
secondTabText = await secondTab.innerText();
|
|
||||||
secondTabText.should.equal('Channels');
|
|
||||||
thirdTab = await mainWindow.waitForSelector('.TabBar li.teamTabItem:nth-child(3)');
|
|
||||||
thirdTabText = await thirdTab.innerText();
|
|
||||||
thirdTabText.should.equal('Playbooks');
|
|
||||||
|
|
||||||
// Verify config is updated
|
|
||||||
const newConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf-8'));
|
|
||||||
const firstTeam = newConfig.teams.find((team) => team.name === 'example');
|
|
||||||
const order0 = firstTeam.tabs.find((tab) => tab.name === 'TAB_FOCALBOARD');
|
|
||||||
order0.order.should.equal(0);
|
|
||||||
const order1 = firstTeam.tabs.find((tab) => tab.name === 'TAB_MESSAGING');
|
|
||||||
order1.order.should.equal(1);
|
|
||||||
const order2 = firstTeam.tabs.find((tab) => tab.name === 'TAB_PLAYBOOKS');
|
|
||||||
order2.order.should.equal(2);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -11,38 +11,47 @@ const {asyncSleep} = require('../../modules/utils');
|
|||||||
describe('header', function desc() {
|
describe('header', function desc() {
|
||||||
this.timeout(30000);
|
this.timeout(30000);
|
||||||
|
|
||||||
beforeEach(async () => {
|
describe('MM-T2637 Double-Clicking on the header should minimize/maximize the app', async () => {
|
||||||
env.createTestUserDataDir();
|
let header;
|
||||||
env.cleanTestConfig();
|
let browserWindow;
|
||||||
});
|
let initialBounds;
|
||||||
|
|
||||||
afterEach(async () => {
|
before(async () => {
|
||||||
if (this.app) {
|
env.createTestUserDataDir();
|
||||||
try {
|
env.cleanTestConfig();
|
||||||
await this.app.close();
|
initialBounds = {x: 0, y: 0, width: 800, height: 400, maximized: false};
|
||||||
// eslint-disable-next-line no-empty
|
fs.writeFileSync(env.boundsInfoPath, JSON.stringify(initialBounds));
|
||||||
} catch (err) {}
|
this.app = await env.getApp();
|
||||||
}
|
const mainWindow = await this.app.windows().find((window) => window.url().includes('index'));
|
||||||
await env.clearElectronInstances();
|
browserWindow = await this.app.browserWindow(mainWindow);
|
||||||
});
|
header = await mainWindow.locator('div.topBar');
|
||||||
|
});
|
||||||
|
|
||||||
it('MM-T2637 Double-Clicking on the header should minimize/maximize the app', async () => {
|
after(async () => {
|
||||||
const initialBounds = {x: 0, y: 0, width: 800, height: 400, maximized: false};
|
if (this.app) {
|
||||||
fs.writeFileSync(env.boundsInfoPath, JSON.stringify(initialBounds));
|
try {
|
||||||
this.app = await env.getApp();
|
await this.app.close();
|
||||||
const mainWindow = await this.app.windows().find((window) => window.url().includes('index'));
|
// eslint-disable-next-line no-empty
|
||||||
const browserWindow = await this.app.browserWindow(mainWindow);
|
} catch (err) {}
|
||||||
const header = await mainWindow.locator('div.topBar');
|
}
|
||||||
const headerBounds = await header.boundingBox();
|
await env.clearElectronInstances();
|
||||||
await header.dblclick({position: {x: headerBounds.width / 2, y: headerBounds.y / 2}});
|
});
|
||||||
await asyncSleep(1000);
|
|
||||||
const isMaximized = await browserWindow.evaluate((window) => window.isMaximized());
|
it('MM-T2637_1 should maximize on double-clicking the header', async () => {
|
||||||
isMaximized.should.be.equal(true);
|
const headerBounds = await header.boundingBox();
|
||||||
const maximizedHeaderBounds = await header.boundingBox();
|
await header.dblclick({position: {x: headerBounds.width / 2, y: headerBounds.y / 2}});
|
||||||
await header.dblclick({position: {x: maximizedHeaderBounds.width / 2, y: maximizedHeaderBounds.y / 2}});
|
await asyncSleep(1000);
|
||||||
await asyncSleep(1000);
|
const isMaximized = await browserWindow.evaluate((window) => window.isMaximized());
|
||||||
const revertedBounds = await browserWindow.evaluate((window) => window.getContentBounds());
|
isMaximized.should.be.equal(true);
|
||||||
revertedBounds.height.should.be.equal(initialBounds.height);
|
});
|
||||||
revertedBounds.width.should.be.equal(initialBounds.width);
|
|
||||||
|
it('MM-T2637_2 should restore on double-clicking the header when maximized', async () => {
|
||||||
|
const maximizedHeaderBounds = await header.boundingBox();
|
||||||
|
await header.dblclick({position: {x: maximizedHeaderBounds.width / 2, y: maximizedHeaderBounds.y / 2}});
|
||||||
|
await asyncSleep(1000);
|
||||||
|
const revertedBounds = await browserWindow.evaluate((window) => window.getContentBounds());
|
||||||
|
revertedBounds.height.should.be.equal(initialBounds.height);
|
||||||
|
revertedBounds.width.should.be.equal(initialBounds.width);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -43,58 +43,35 @@ describe('LongServerName', function desc() {
|
|||||||
|
|
||||||
let newServerView;
|
let newServerView;
|
||||||
|
|
||||||
describe('MM-T4050 Long server name', () => {
|
it('MM-T4050 Long server name', async () => {
|
||||||
beforeEach(async () => {
|
await newServerView.type('#teamNameInput', longServerName);
|
||||||
await newServerView.type('#teamNameInput', longServerName);
|
await newServerView.type('#teamUrlInput', longServerUrl);
|
||||||
await newServerView.type('#teamUrlInput', longServerUrl);
|
await newServerView.click('#saveNewServerModal');
|
||||||
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 mainView = this.app.windows().find((window) => window.url().includes('index'));
|
||||||
|
const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown'));
|
||||||
|
|
||||||
|
const isServerTabExists = Boolean(await mainView.locator(`text=${longServerName}`));
|
||||||
|
const isServerAddedDropdown = Boolean(await dropdownView.locator(`text=${longServerName}`));
|
||||||
|
isServerTabExists.should.be.true;
|
||||||
|
isServerAddedDropdown.should.be.true;
|
||||||
|
|
||||||
|
const serverNameLocator = await mainView.locator(`text=${longServerName}`);
|
||||||
|
|
||||||
|
const isTruncated = await serverNameLocator.evaluate((element) => {
|
||||||
|
return element.offsetWidth < element.scrollWidth;
|
||||||
});
|
});
|
||||||
|
isTruncated.should.be.true;
|
||||||
|
|
||||||
it('MM-T4050_1 should add new server tab', async () => {
|
const isWithinMaxWidth = await serverNameLocator.evaluate((element) => {
|
||||||
await asyncSleep(1000);
|
const width = parseFloat(window.getComputedStyle(element).getPropertyValue('width'));
|
||||||
const existing = Boolean(await this.app.windows().find((window) => window.url().includes('newServer')));
|
|
||||||
existing.should.be.false;
|
|
||||||
|
|
||||||
const mainView = this.app.windows().find((window) => window.url().includes('index'));
|
return width <= 400;
|
||||||
const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown'));
|
|
||||||
|
|
||||||
const isServerTabExists = Boolean(await mainView.locator(`text=${longServerName}`));
|
|
||||||
const isServerAddedDropdown = Boolean(await dropdownView.locator(`text=${longServerName}`));
|
|
||||||
|
|
||||||
isServerTabExists.should.be.true;
|
|
||||||
isServerAddedDropdown.should.be.true;
|
|
||||||
});
|
|
||||||
|
|
||||||
it('MM-T4050_2 should truncate server name', async () => {
|
|
||||||
await asyncSleep(1000);
|
|
||||||
const existing = Boolean(await this.app.windows().find((window) => window.url().includes('newServer')));
|
|
||||||
existing.should.be.false;
|
|
||||||
|
|
||||||
const mainView = this.app.windows().find((window) => window.url().includes('index'));
|
|
||||||
const serverNameLocator = await mainView.locator(`text=${longServerName}`);
|
|
||||||
|
|
||||||
const isTruncated = await serverNameLocator.evaluate((element) => {
|
|
||||||
return element.offsetWidth < element.scrollWidth;
|
|
||||||
});
|
|
||||||
|
|
||||||
isTruncated.should.be.true;
|
|
||||||
});
|
|
||||||
|
|
||||||
it('MM-T4050_3 should display server tab with max width of 400px', async () => {
|
|
||||||
await asyncSleep(1000);
|
|
||||||
const existing = Boolean(await this.app.windows().find((window) => window.url().includes('newServer')));
|
|
||||||
existing.should.be.false;
|
|
||||||
|
|
||||||
const mainView = this.app.windows().find((window) => window.url().includes('index'));
|
|
||||||
const serverNameLocator = await mainView.locator('.TeamDropdownButton');
|
|
||||||
|
|
||||||
const isWithinMaxWidth = await serverNameLocator.evaluate((element) => {
|
|
||||||
const width = parseFloat(window.getComputedStyle(element).getPropertyValue('width'));
|
|
||||||
|
|
||||||
return width <= 400;
|
|
||||||
});
|
|
||||||
|
|
||||||
isWithinMaxWidth.should.be.true;
|
|
||||||
});
|
});
|
||||||
|
isWithinMaxWidth.should.be.true;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -63,8 +63,8 @@ describe('Settings', function desc() {
|
|||||||
existing.should.equal(expected);
|
existing.should.equal(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('MM-T4393_2 Save tray icon setting on mac', () => {
|
describe('Save tray icon setting on mac', () => {
|
||||||
env.shouldTest(it, env.isOneOf(['darwin', 'linux']))('should be saved when it\'s selected', async () => {
|
env.shouldTest(it, env.isOneOf(['darwin', 'linux']))('MM-T4393_2 should be saved when it\'s selected', async () => {
|
||||||
this.app.evaluate(({ipcMain}, showWindow) => {
|
this.app.evaluate(({ipcMain}, showWindow) => {
|
||||||
ipcMain.emit(showWindow);
|
ipcMain.emit(showWindow);
|
||||||
}, SHOW_SETTINGS_WINDOW);
|
}, SHOW_SETTINGS_WINDOW);
|
||||||
@@ -88,8 +88,8 @@ describe('Settings', function desc() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('MM-T4393_3 Save tray icon theme on linux', () => {
|
describe('Save tray icon theme on linux', () => {
|
||||||
env.shouldTest(it, process.platform === 'linux')('should be saved when it\'s selected', async () => {
|
env.shouldTest(it, process.platform === 'linux')('MM-T4393_3 should be saved when it\'s selected', async () => {
|
||||||
this.app.evaluate(({ipcMain}, showWindow) => {
|
this.app.evaluate(({ipcMain}, showWindow) => {
|
||||||
ipcMain.emit(showWindow);
|
ipcMain.emit(showWindow);
|
||||||
}, SHOW_SETTINGS_WINDOW);
|
}, SHOW_SETTINGS_WINDOW);
|
||||||
|
Reference in New Issue
Block a user