Modify run conditions for nightly e2e job to create test cycle and post in channel. (#2971)
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
// See LICENSE.txt for license information.
|
||||
'use strict';
|
||||
|
||||
const {execSync} = require('child_process');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
@@ -180,6 +181,7 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
cleanDataDirAsync() {
|
||||
return rmDirAsync(userDataDir);
|
||||
},
|
||||
@@ -189,6 +191,21 @@ module.exports = {
|
||||
fs.mkdirSync(userDataDir);
|
||||
}
|
||||
},
|
||||
|
||||
clipboard(textToCopy) {
|
||||
switch (process.platform) {
|
||||
case 'linux':
|
||||
execSync(`echo "${textToCopy}" | xsel --clipboard`);
|
||||
break;
|
||||
case 'win32':
|
||||
execSync(`echo ${textToCopy} | clip`);
|
||||
break;
|
||||
case 'darwin':
|
||||
execSync(`pbcopy <<< ${textToCopy}`);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
async createTestUserDataDirAsync() {
|
||||
await mkDirAsync(userDataDir);
|
||||
},
|
||||
|
@@ -71,7 +71,8 @@ const saveReport = async () => {
|
||||
);
|
||||
|
||||
// Generate short summary, write to file and then send report via webhook
|
||||
const summary = generateShortSummary(jsonReport);
|
||||
const {stats, statsFieldValue} = generateShortSummary(jsonReport);
|
||||
const summary = {stats, statsFieldValue};
|
||||
console.log(summary);
|
||||
writeJsonToFile(summary, 'summary.json', MOCHAWESOME_REPORT_DIR);
|
||||
|
||||
|
@@ -43,7 +43,10 @@ describe('focus', function desc() {
|
||||
],
|
||||
};
|
||||
|
||||
beforeEach(async () => {
|
||||
let firstServer;
|
||||
let loadingScreen;
|
||||
|
||||
before(async () => {
|
||||
env.cleanDataDir();
|
||||
env.createTestUserDataDir();
|
||||
env.cleanTestConfig();
|
||||
@@ -51,9 +54,16 @@ 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');
|
||||
textbox.focus();
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
after(async () => {
|
||||
if (this.app) {
|
||||
await this.app.close();
|
||||
}
|
||||
@@ -61,17 +71,6 @@ describe('focus', function desc() {
|
||||
});
|
||||
|
||||
describe('Focus textbox tests', () => {
|
||||
let firstServer;
|
||||
|
||||
beforeEach(async () => {
|
||||
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');
|
||||
textbox.focus();
|
||||
});
|
||||
|
||||
it('MM-T1315 should return focus to the message box when closing the settings window', async () => {
|
||||
this.app.evaluate(({ipcMain}, showWindow) => {
|
||||
ipcMain.emit(showWindow);
|
||||
@@ -85,6 +84,8 @@ describe('focus', function desc() {
|
||||
const isTextboxFocused = await firstServer.$eval('#post_textbox', (el) => el === document.activeElement);
|
||||
isTextboxFocused.should.be.true;
|
||||
|
||||
await firstServer.fill('#post_textbox', '');
|
||||
|
||||
// Make sure you can just start typing and it'll go in the post textbox
|
||||
await asyncSleep(500);
|
||||
robot.typeString('Mattermost');
|
||||
@@ -108,6 +109,8 @@ describe('focus', function desc() {
|
||||
const isTextboxFocused = await firstServer.$eval('#post_textbox', (el) => el === document.activeElement);
|
||||
isTextboxFocused.should.be.true;
|
||||
|
||||
await firstServer.fill('#post_textbox', '');
|
||||
|
||||
// Make sure you can just start typing and it'll go in the post textbox
|
||||
await asyncSleep(500);
|
||||
robot.typeString('Mattermost');
|
||||
@@ -132,6 +135,8 @@ describe('focus', function desc() {
|
||||
const isTextboxFocused = await firstServer.$eval('#post_textbox', (el) => el === document.activeElement);
|
||||
isTextboxFocused.should.be.true;
|
||||
|
||||
await firstServer.fill('#post_textbox', '');
|
||||
|
||||
// Make sure you can just start typing and it'll go in the post textbox
|
||||
await asyncSleep(500);
|
||||
robot.typeString('Mattermost');
|
||||
|
@@ -13,8 +13,9 @@ describe('edit_menu', function desc() {
|
||||
this.timeout(40000);
|
||||
|
||||
const config = env.demoMattermostConfig;
|
||||
let firstServer;
|
||||
|
||||
beforeEach(async () => {
|
||||
before(async () => {
|
||||
env.cleanDataDir();
|
||||
env.createTestUserDataDir();
|
||||
env.cleanTestConfig();
|
||||
@@ -22,9 +23,14 @@ 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);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
after(async () => {
|
||||
if (this.app) {
|
||||
await this.app.close();
|
||||
}
|
||||
@@ -32,13 +38,9 @@ describe('edit_menu', function desc() {
|
||||
});
|
||||
|
||||
it('MM-T807 Undo in the Menu Bar', 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);
|
||||
|
||||
// click on sint channel
|
||||
await firstServer.click('#post_textbox');
|
||||
await firstServer.fill('#post_textbox', '');
|
||||
await firstServer.type('#post_textbox', 'Mattermost');
|
||||
await firstServer.click('#post_textbox');
|
||||
robot.keyTap('z', [env.cmdOrCtrl]);
|
||||
@@ -48,13 +50,9 @@ describe('edit_menu', function desc() {
|
||||
});
|
||||
|
||||
it('MM-T808 Redo in the Menu Bar', 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);
|
||||
|
||||
// click on sint channel
|
||||
await firstServer.click('#post_textbox');
|
||||
await firstServer.fill('#post_textbox', '');
|
||||
await firstServer.type('#post_textbox', 'Mattermost');
|
||||
await firstServer.click('#post_textbox');
|
||||
robot.keyTap('z', [env.cmdOrCtrl]);
|
||||
@@ -69,13 +67,9 @@ describe('edit_menu', function desc() {
|
||||
});
|
||||
|
||||
it('MM-T809 Cut in the Menu Bar', 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);
|
||||
|
||||
// click on sint channel
|
||||
await firstServer.click('#post_textbox');
|
||||
await firstServer.fill('#post_textbox', '');
|
||||
await firstServer.type('#post_textbox', 'Mattermost');
|
||||
robot.keyTap('a', [env.cmdOrCtrl]);
|
||||
await asyncSleep(500);
|
||||
@@ -86,13 +80,9 @@ describe('edit_menu', function desc() {
|
||||
});
|
||||
|
||||
it('MM-T810 Copy in the Menu Bar', 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);
|
||||
|
||||
// click on sint channel
|
||||
await firstServer.click('#post_textbox');
|
||||
await firstServer.fill('#post_textbox', '');
|
||||
await firstServer.type('#post_textbox', 'Mattermost');
|
||||
robot.keyTap('a', [env.cmdOrCtrl]);
|
||||
await asyncSleep(500);
|
||||
@@ -106,13 +96,9 @@ describe('edit_menu', function desc() {
|
||||
});
|
||||
|
||||
it('MM-T811 Paste in the Menu Bar', 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);
|
||||
|
||||
// click on sint channel
|
||||
await firstServer.click('#post_textbox');
|
||||
await firstServer.fill('#post_textbox', '');
|
||||
await firstServer.type('#post_textbox', 'Mattermost');
|
||||
robot.keyTap('a', [env.cmdOrCtrl]);
|
||||
await asyncSleep(500);
|
||||
@@ -127,13 +113,9 @@ describe('edit_menu', function desc() {
|
||||
});
|
||||
|
||||
it('MM-T812 Select All in the Menu Bar', 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);
|
||||
|
||||
// click on sint channel
|
||||
await firstServer.click('#post_textbox');
|
||||
await firstServer.fill('#post_textbox', '');
|
||||
await firstServer.fill('#post_textbox', 'Mattermost');
|
||||
robot.keyTap('a', [env.cmdOrCtrl]);
|
||||
await asyncSleep(500);
|
||||
|
@@ -201,7 +201,7 @@ describe('menu/view', function desc() {
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T820 should open Developer Tools For Application Wrapper for main window', async () => {
|
||||
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'));
|
||||
@@ -212,46 +212,22 @@ describe('menu/view', function desc() {
|
||||
});
|
||||
isDevToolsOpen.should.be.false;
|
||||
|
||||
robot.keyTap('alt');
|
||||
robot.keyTap('enter');
|
||||
robot.keyTap('v');
|
||||
robot.keyTap('d');
|
||||
robot.keyTap('enter');
|
||||
await asyncSleep(1000);
|
||||
if (process.platform === 'darwin') {
|
||||
// Press Command + Option + I
|
||||
robot.keyTap('i', ['command', 'alt']);
|
||||
await asyncSleep(3000);
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
robot.keyToggle('shift', 'down');
|
||||
robot.keyToggle('control', 'down');
|
||||
robot.keyTap('i');
|
||||
}
|
||||
|
||||
await asyncSleep(1000);
|
||||
isDevToolsOpen = await browserWindow.evaluate((window) => {
|
||||
return window.webContents.isDevToolsOpened();
|
||||
});
|
||||
isDevToolsOpen.should.be.true;
|
||||
});
|
||||
|
||||
// TODO: Missing shortcut for macOS
|
||||
if (process.platform !== 'darwin') {
|
||||
it('MM-T821 should open Developer Tools For Current Server for the active tab', async () => {
|
||||
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||
const browserWindow = await this.app.browserWindow(mainWindow);
|
||||
const 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'});
|
||||
|
||||
let isDevToolsOpen = await browserWindow.evaluate((window, id) => {
|
||||
return window.getBrowserViews().find((view) => view.webContents.id === id).webContents.isDevToolsOpened();
|
||||
}, webContentsId);
|
||||
isDevToolsOpen.should.be.false;
|
||||
|
||||
// Open Developer Tools for Current Server
|
||||
robot.keyTap('alt');
|
||||
robot.keyTap('enter');
|
||||
robot.keyTap('v');
|
||||
robot.keyTap('d');
|
||||
robot.keyTap('d');
|
||||
robot.keyTap('enter');
|
||||
await asyncSleep(1000);
|
||||
|
||||
isDevToolsOpen = await browserWindow.evaluate((window, id) => {
|
||||
return window.getBrowserViews().find((view) => view.webContents.id === id).webContents.isDevToolsOpened();
|
||||
}, webContentsId);
|
||||
isDevToolsOpen.should.be.true;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@@ -44,7 +44,6 @@ describe('Menu/window_menu', function desc() {
|
||||
};
|
||||
|
||||
const beforeFunc = async () => {
|
||||
env.cleanDataDir();
|
||||
env.createTestUserDataDir();
|
||||
env.cleanTestConfig();
|
||||
fs.writeFileSync(env.configFilePath, JSON.stringify(config));
|
||||
|
@@ -13,8 +13,10 @@ describe('popup', function desc() {
|
||||
this.timeout(40000);
|
||||
|
||||
const config = env.demoMattermostConfig;
|
||||
let popupWindow;
|
||||
let firstServer;
|
||||
|
||||
beforeEach(async () => {
|
||||
before(async () => {
|
||||
env.cleanDataDir();
|
||||
env.createTestUserDataDir();
|
||||
env.cleanTestConfig();
|
||||
@@ -22,9 +24,28 @@ 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);
|
||||
|
||||
await firstServer.click('#post_textbox');
|
||||
await firstServer.fill('#post_textbox', '');
|
||||
await firstServer.type('#post_textbox', '/github connect ');
|
||||
await firstServer.click('button[data-testid="SendMessageButton"]');
|
||||
|
||||
const githubLink = await firstServer.waitForSelector('a.theme.markdown__link:has-text("GitHub account")');
|
||||
githubLink.click();
|
||||
popupWindow = await this.app.waitForEvent('window');
|
||||
|
||||
const loginField = await popupWindow.waitForSelector('#login_field');
|
||||
await loginField.focus();
|
||||
robot.typeString('Mattermost');
|
||||
await asyncSleep(3000);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
after(async () => {
|
||||
if (this.app) {
|
||||
await this.app.close();
|
||||
}
|
||||
@@ -32,80 +53,48 @@ describe('popup', function desc() {
|
||||
});
|
||||
|
||||
// NOTE: These tests requires that the test server have the GitHub plugin configured
|
||||
describe('MM-T2827 Keyboard shortcuts in popup windows', () => {
|
||||
let popupWindow;
|
||||
it('MM-T2827_1 should be able to select all in popup windows', async () => {
|
||||
robot.keyTap('a', env.cmdOrCtrl);
|
||||
await asyncSleep(1000);
|
||||
|
||||
beforeEach(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_suscipit-4');
|
||||
await firstServer.click('#sidebarItem_suscipit-4');
|
||||
await firstServer.click('#post_textbox');
|
||||
await firstServer.type('#post_textbox', '/github connect ');
|
||||
await firstServer.click('button[data-testid="SendMessageButton"]');
|
||||
|
||||
const githubLink = await firstServer.waitForSelector('a.theme.markdown__link:has-text("GitHub account")');
|
||||
githubLink.click();
|
||||
popupWindow = await this.app.waitForEvent('window');
|
||||
const loginField = await popupWindow.waitForSelector('#login_field');
|
||||
await loginField.focus();
|
||||
await loginField.type('mattermost');
|
||||
const selectedText = await popupWindow.evaluate(() => {
|
||||
const box = document.querySelectorAll('#login_field')[0];
|
||||
return box.value.substring(box.selectionStart,
|
||||
box.selectionEnd);
|
||||
});
|
||||
await asyncSleep(3000);
|
||||
selectedText.should.equal('Mattermost');
|
||||
});
|
||||
|
||||
it('MM-T2827_1 should be able to select all in popup windows', async () => {
|
||||
robot.keyTap('a', [process.platform === 'darwin' ? 'command' : 'control']);
|
||||
const selectedText = await popupWindow.evaluate(() => {
|
||||
const box = document.querySelectorAll('#login_field')[0];
|
||||
return box.value.substring(box.selectionStart,
|
||||
box.selectionEnd);
|
||||
});
|
||||
selectedText.should.equal('mattermost');
|
||||
});
|
||||
it('MM-T2827_2 should be able to cut and paste in popup windows', async () => {
|
||||
await asyncSleep(1000);
|
||||
const textbox = await popupWindow.waitForSelector('#login_field');
|
||||
|
||||
it('MM-T2827_2 should be able to cut and paste in popup windows', async () => {
|
||||
const textbox = await popupWindow.waitForSelector('#login_field');
|
||||
await textbox.selectText({force: true});
|
||||
robot.keyTap('x', env.cmdOrCtrl);
|
||||
let textValue = await textbox.inputValue();
|
||||
textValue.should.equal('');
|
||||
|
||||
await textbox.selectText({force: true});
|
||||
robot.keyTap('x', [process.platform === 'darwin' ? 'command' : 'control']);
|
||||
let textValue = await textbox.inputValue();
|
||||
textValue.should.equal('');
|
||||
await textbox.focus();
|
||||
robot.keyTap('v', env.cmdOrCtrl);
|
||||
textValue = await textbox.inputValue();
|
||||
textValue.should.equal('Mattermost');
|
||||
});
|
||||
|
||||
await textbox.focus();
|
||||
robot.keyTap('v', [process.platform === 'darwin' ? 'command' : 'control']);
|
||||
textValue = await textbox.inputValue();
|
||||
textValue.should.equal('mattermost');
|
||||
});
|
||||
it('MM-T2827_3 should be able to copy and paste in popup windows', async () => {
|
||||
await asyncSleep(1000);
|
||||
const textbox = await popupWindow.waitForSelector('#login_field');
|
||||
|
||||
it('MM-T2827_3 should be able to copy and paste in popup windows', async () => {
|
||||
const textbox = await popupWindow.waitForSelector('#login_field');
|
||||
|
||||
await textbox.selectText({force: true});
|
||||
robot.keyTap('c', [process.platform === 'darwin' ? 'command' : 'control']);
|
||||
await textbox.focus();
|
||||
await textbox.type('other-text');
|
||||
robot.keyTap('v', [process.platform === 'darwin' ? 'command' : 'control']);
|
||||
const textValue = await textbox.inputValue();
|
||||
textValue.should.equal('other-textmattermost');
|
||||
});
|
||||
await textbox.selectText({force: true});
|
||||
robot.keyTap('c', env.cmdOrCtrl);
|
||||
await textbox.focus();
|
||||
await textbox.type('other-text');
|
||||
robot.keyTap('v', env.cmdOrCtrl);
|
||||
const textValue = await textbox.inputValue();
|
||||
textValue.should.equal('other-textMattermost');
|
||||
});
|
||||
|
||||
it('MM-T1659 should not be able to go Back or Forward in the popup window', 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_suscipit-4');
|
||||
await firstServer.click('#sidebarItem_suscipit-4');
|
||||
await firstServer.click('#post_textbox');
|
||||
await firstServer.type('#post_textbox', '/github connect ');
|
||||
await firstServer.click('button[data-testid="SendMessageButton"]');
|
||||
|
||||
const githubLink = await firstServer.waitForSelector('a.theme.markdown__link:has-text("GitHub account")');
|
||||
githubLink.click();
|
||||
const popupWindow = await this.app.waitForEvent('window');
|
||||
await popupWindow.bringToFront();
|
||||
const currentURL = popupWindow.url();
|
||||
|
||||
// Try and go back
|
||||
|
@@ -13,6 +13,7 @@ describe('LongServerName', function desc() {
|
||||
const config = env.demoConfig;
|
||||
const longServerName = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus quis malesuada dolor, vel scelerisque sem';
|
||||
const longServerUrl = 'https://example.org';
|
||||
let newServerView;
|
||||
|
||||
beforeEach(async () => {
|
||||
env.createTestUserDataDir();
|
||||
@@ -31,7 +32,7 @@ describe('LongServerName', function desc() {
|
||||
});
|
||||
|
||||
// wait for autofocus to finish
|
||||
await asyncSleep(500);
|
||||
await asyncSleep(1000);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -41,26 +42,24 @@ describe('LongServerName', function desc() {
|
||||
await env.clearElectronInstances();
|
||||
});
|
||||
|
||||
let newServerView;
|
||||
|
||||
it('MM-T4050 Long server name', async () => {
|
||||
await newServerView.type('#serverNameInput', longServerName);
|
||||
await newServerView.type('#serverUrlInput', longServerUrl);
|
||||
await newServerView.click('#saveNewServerModal');
|
||||
|
||||
await asyncSleep(1000);
|
||||
const existing = Boolean(await this.app.windows().find((window) => window.url().includes('newServer')));
|
||||
const existing = Boolean(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}`));
|
||||
const isServerTabExists = Boolean(mainView.locator(`text=${longServerName}`));
|
||||
const isServerAddedDropdown = Boolean(dropdownView.locator(`text=${longServerName}`));
|
||||
isServerTabExists.should.be.true;
|
||||
isServerAddedDropdown.should.be.true;
|
||||
|
||||
const serverNameLocator = await mainView.locator(`text=${longServerName}`);
|
||||
const serverNameLocator = mainView.locator(`text=${longServerName}`);
|
||||
|
||||
const isTruncated = await serverNameLocator.evaluate((element) => {
|
||||
return element.offsetWidth < element.scrollWidth;
|
||||
|
@@ -14,16 +14,28 @@ const {asyncSleep} = require('../../modules/utils');
|
||||
describe('settings/keyboard_shortcuts', function desc() {
|
||||
this.timeout(30000);
|
||||
const config = env.demoConfig;
|
||||
let settingsWindow;
|
||||
|
||||
beforeEach(async () => {
|
||||
before(async () => {
|
||||
env.createTestUserDataDir();
|
||||
env.cleanTestConfig();
|
||||
fs.writeFileSync(env.configFilePath, JSON.stringify(config));
|
||||
await asyncSleep(1000);
|
||||
this.app = await env.getApp();
|
||||
|
||||
this.app.evaluate(({ipcMain}, showWindow) => {
|
||||
ipcMain.emit(showWindow);
|
||||
}, SHOW_SETTINGS_WINDOW);
|
||||
settingsWindow = await this.app.waitForEvent('window', {
|
||||
predicate: (window) => window.url().includes('settings'),
|
||||
});
|
||||
await settingsWindow.waitForSelector('.settingsPage.container');
|
||||
|
||||
const textbox = await settingsWindow.waitForSelector('#inputSpellCheckerLocalesDropdown');
|
||||
await textbox.scrollIntoViewIfNeeded();
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
after(async () => {
|
||||
if (this.app) {
|
||||
await this.app.close();
|
||||
}
|
||||
@@ -31,57 +43,57 @@ describe('settings/keyboard_shortcuts', function desc() {
|
||||
});
|
||||
|
||||
describe('MM-T1288 Manipulating Text', () => {
|
||||
let settingsWindow;
|
||||
|
||||
beforeEach(async () => {
|
||||
this.app.evaluate(({ipcMain}, showWindow) => {
|
||||
ipcMain.emit(showWindow);
|
||||
}, SHOW_SETTINGS_WINDOW);
|
||||
settingsWindow = await this.app.waitForEvent('window', {
|
||||
predicate: (window) => window.url().includes('settings'),
|
||||
});
|
||||
await settingsWindow.waitForSelector('.settingsPage.container');
|
||||
|
||||
const textbox = await settingsWindow.waitForSelector('#inputSpellCheckerLocalesDropdown');
|
||||
await textbox.scrollIntoViewIfNeeded();
|
||||
await textbox.type('mattermost');
|
||||
});
|
||||
|
||||
it('MM-T1288_1 should be able to select all in the settings window', async () => {
|
||||
it('MM-T1288_1 should be able to select and deselect language in the settings window', async () => {
|
||||
let textboxString;
|
||||
await settingsWindow.click('#inputSpellCheckerLocalesDropdown');
|
||||
robot.keyTap('a', [process.platform === 'darwin' ? 'command' : 'control']);
|
||||
const selectedText = await settingsWindow.evaluate(() => {
|
||||
const box = document.querySelectorAll('#inputSpellCheckerLocalesDropdown')[0];
|
||||
return box.value.substring(box.selectionStart,
|
||||
box.selectionEnd);
|
||||
});
|
||||
selectedText.should.equal('mattermost');
|
||||
await settingsWindow.type('#inputSpellCheckerLocalesDropdown', 'Afrikaans');
|
||||
robot.keyTap('tab');
|
||||
|
||||
await settingsWindow.isVisible('#appOptionsSaveIndicator');
|
||||
|
||||
textboxString = await settingsWindow.innerText('div.SettingsPage__spellCheckerLocalesDropdown__multi-value__label');
|
||||
textboxString.should.equal('Afrikaans');
|
||||
|
||||
await settingsWindow.isVisible('#appOptionsSaveIndicator');
|
||||
|
||||
await settingsWindow.click('[aria-label="Remove Afrikaans"]');
|
||||
|
||||
await settingsWindow.isVisible('#appOptionsSaveIndicator');
|
||||
|
||||
textboxString = await settingsWindow.inputValue('#inputSpellCheckerLocalesDropdown');
|
||||
textboxString.should.equal('');
|
||||
});
|
||||
|
||||
it('MM-T1288_2 should be able to cut and paste in the settings window', async () => {
|
||||
const textToCopy = 'Afrikaans';
|
||||
env.clipboard(textToCopy);
|
||||
|
||||
const textbox = await settingsWindow.waitForSelector('#inputSpellCheckerLocalesDropdown');
|
||||
|
||||
await textbox.selectText({force: true});
|
||||
robot.keyTap('x', [process.platform === 'darwin' ? 'command' : 'control']);
|
||||
robot.keyTap('x', [env.cmdOrCtrl]);
|
||||
let textValue = await textbox.getAttribute('value');
|
||||
textValue.should.equal('');
|
||||
|
||||
await textbox.focus();
|
||||
robot.keyTap('v', [process.platform === 'darwin' ? 'command' : 'control']);
|
||||
robot.keyTap('v', [env.cmdOrCtrl]);
|
||||
textValue = await textbox.getAttribute('value');
|
||||
textValue.should.equal('mattermost');
|
||||
textValue.trim().should.equal('Afrikaans');
|
||||
});
|
||||
|
||||
it('MM-T1288_3 should be able to copy and paste in the settings window', async () => {
|
||||
const textToCopy = 'Afrikaans';
|
||||
env.clipboard(textToCopy);
|
||||
|
||||
const textbox = await settingsWindow.waitForSelector('#inputSpellCheckerLocalesDropdown');
|
||||
|
||||
await textbox.selectText({force: true});
|
||||
robot.keyTap('c', [process.platform === 'darwin' ? 'command' : 'control']);
|
||||
robot.keyTap('c', [env.cmdOrCtrl]);
|
||||
await textbox.focus();
|
||||
await textbox.type('other-text');
|
||||
robot.keyTap('v', [process.platform === 'darwin' ? 'command' : 'control']);
|
||||
robot.keyTap('v', [env.cmdOrCtrl]);
|
||||
const textValue = await textbox.getAttribute('value');
|
||||
textValue.should.equal('other-textmattermost');
|
||||
textValue.trim().should.equal('other-textAfrikaans');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
81
e2e/utils/analyze-flaky-test.js
Normal file
81
e2e/utils/analyze-flaky-test.js
Normal file
@@ -0,0 +1,81 @@
|
||||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
/* eslint-disable no-console */
|
||||
const path = require('path');
|
||||
|
||||
const {MOCHAWESOME_REPORT_DIR} = require('./constants');
|
||||
const knownFlakyTests = require('./known_flaky_tests.json');
|
||||
const {
|
||||
generateShortSummary,
|
||||
readJsonFromFile,
|
||||
} = require('./report');
|
||||
|
||||
function analyzeFlakyTests() {
|
||||
const os = process.platform;
|
||||
try {
|
||||
// Import
|
||||
const jsonReport = readJsonFromFile(path.join(MOCHAWESOME_REPORT_DIR, 'mochawesome.json'));
|
||||
|
||||
const {failedFullTitles} = generateShortSummary(jsonReport);
|
||||
|
||||
// Get the list of known flaky tests for the provided operating system
|
||||
const knownFlakyTestsForOS = new Set(knownFlakyTests[os] || []);
|
||||
|
||||
// Filter out the known flaky tests from the failed test titles
|
||||
const newFailedTests = failedFullTitles.filter((test) => !knownFlakyTestsForOS.has(test));
|
||||
|
||||
// Check if any known failed tests are fixed
|
||||
const fixedTests = [...knownFlakyTestsForOS].filter((test) => !failedFullTitles.includes(test));
|
||||
|
||||
const commentBody = generateCommentBodyFunctionalTest(newFailedTests, fixedTests);
|
||||
|
||||
// Print on CI
|
||||
console.log(commentBody);
|
||||
|
||||
return {commentBody, newFailedTests};
|
||||
} catch (error) {
|
||||
console.error('Error analyzing failures:', error);
|
||||
}
|
||||
}
|
||||
|
||||
function generateCommentBodyFunctionalTest(newFailedTests, fixedTests) {
|
||||
const osName = process.env.RUNNER_OS;
|
||||
const build = process.env.BUILD_TAG;
|
||||
|
||||
let commentBody = `
|
||||
## Test Summary for ${osName} on commit ${build}
|
||||
`;
|
||||
|
||||
if (newFailedTests.length === 0 && fixedTests.length === 0) {
|
||||
commentBody += `
|
||||
All stable tests passed on ${osName}.
|
||||
`;
|
||||
return commentBody;
|
||||
}
|
||||
|
||||
if (newFailedTests.length > 0) {
|
||||
const newTestFailure = `New failed tests found on ${osName}:\n\t${newFailedTests.map((test) => `- ${test}`).join('\n\t')}`;
|
||||
commentBody += `
|
||||
### New Failed Tests
|
||||
|
||||
| Test |
|
||||
| --- |
|
||||
${newTestFailure}
|
||||
`;
|
||||
}
|
||||
|
||||
if (fixedTests.length > 0) {
|
||||
const fixedTestMessage = `The following known failed tests have been fixed on ${osName}:\n\t${fixedTests.map((test) => `- ${test}`).join('\n\t')}`;
|
||||
commentBody += `
|
||||
### Fixed Tests
|
||||
|
||||
${fixedTestMessage}
|
||||
`;
|
||||
}
|
||||
|
||||
return commentBody;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
analyzeFlakyTests,
|
||||
};
|
14
e2e/utils/known_flaky_tests.json
Normal file
14
e2e/utils/known_flaky_tests.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"darwin": [
|
||||
"popup MM-T2827_1 should be able to select all in popup windows"
|
||||
],
|
||||
"linux": [
|
||||
"menu/view MM-T820 should open Developer Tools For Application Wrapper for main window",
|
||||
"Menu/window_menu MM-T824 should be minimized when keyboard shortcuts are pressed",
|
||||
"Menu/window_menu MM-T825 should be hidden when keyboard shortcuts are pressed",
|
||||
"header MM-T2637 Double-Clicking on the header should minimize/maximize the app MM-T2637_1 should maximize on double-clicking the header"
|
||||
],
|
||||
"win32": [
|
||||
"application MM-T1304/MM-T1306 should open the app on the requested deep link"
|
||||
]
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
function generateCommentBody(fileContents) {
|
||||
function generateCommentBodyPerformanceTest(fileContents) {
|
||||
const data = JSON.parse(fileContents);
|
||||
|
||||
return `
|
||||
@@ -32,5 +32,5 @@ ${fileContents}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
generateCommentBody,
|
||||
generateCommentBodyPerformanceTest,
|
||||
};
|
||||
|
@@ -76,6 +76,7 @@ function generateShortSummary(report) {
|
||||
return {
|
||||
stats,
|
||||
statsFieldValue,
|
||||
failedFullTitles,
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -5,6 +5,8 @@
|
||||
|
||||
// See reference: https://support.smartbear.com/tm4j-cloud/api-docs/
|
||||
|
||||
const os = require('os');
|
||||
|
||||
const axios = require('axios');
|
||||
const chalk = require('chalk');
|
||||
|
||||
@@ -83,13 +85,50 @@ function saveToEndpoint(url, data) {
|
||||
});
|
||||
}
|
||||
|
||||
async function getZEPHYRFolderID() {
|
||||
const {
|
||||
TYPE,
|
||||
ZEPHYR_FOLDER_ID,
|
||||
ZEPHYR_FOLDER_LINUX_REPORT,
|
||||
ZEPHYR_FOLDER_MACOS_REPORT,
|
||||
ZEPHYR_FOLDER_WIN_REPORT,
|
||||
} = process.env;
|
||||
if (TYPE === 'MASTER') {
|
||||
return ZEPHYR_FOLDER_ID;
|
||||
}
|
||||
const platform = os.platform();
|
||||
|
||||
// Define Zephyr folder IDs for different run types and platforms.
|
||||
// For PR we dont generate reports.
|
||||
// Post Merge to master branch, default folderID will be used.
|
||||
const folderIDs = {
|
||||
RELEASE: {
|
||||
darwin: ZEPHYR_FOLDER_MACOS_REPORT,
|
||||
win32: ZEPHYR_FOLDER_WIN_REPORT,
|
||||
linux: ZEPHYR_FOLDER_LINUX_REPORT,
|
||||
default: ZEPHYR_FOLDER_ID,
|
||||
},
|
||||
NIGHTLY: {
|
||||
darwin: ZEPHYR_FOLDER_MACOS_REPORT,
|
||||
win32: ZEPHYR_FOLDER_WIN_REPORT,
|
||||
linux: ZEPHYR_FOLDER_LINUX_REPORT,
|
||||
default: ZEPHYR_FOLDER_ID,
|
||||
},
|
||||
};
|
||||
|
||||
// Get the folder ID based on the type and platform
|
||||
const typeFolderIDs = folderIDs[TYPE];
|
||||
const folderID = typeFolderIDs?.[platform] ?? typeFolderIDs?.default ?? ZEPHYR_FOLDER_ID;
|
||||
|
||||
return folderID;
|
||||
}
|
||||
|
||||
async function createTestCycle(startDate, endDate) {
|
||||
const {
|
||||
BRANCH,
|
||||
BUILD_ID,
|
||||
JIRA_PROJECT_KEY,
|
||||
ZEPHYR_CYCLE_NAME,
|
||||
ZEPHYR_FOLDER_ID,
|
||||
} = process.env;
|
||||
|
||||
const testCycle = {
|
||||
@@ -99,7 +138,7 @@ async function createTestCycle(startDate, endDate) {
|
||||
plannedStartDate: startDate,
|
||||
plannedEndDate: endDate,
|
||||
statusName: 'Done',
|
||||
folderId: ZEPHYR_FOLDER_ID,
|
||||
folderId: await getZEPHYRFolderID(),
|
||||
};
|
||||
|
||||
const response = await saveToEndpoint('https://api.zephyrscale.smartbear.com/v2/testcycles', testCycle);
|
||||
|
Reference in New Issue
Block a user