Modify run conditions for nightly e2e job to create test cycle and post in channel. (#2971)

This commit is contained in:
yasserfaraazkhan
2024-03-19 22:18:29 +05:30
committed by GitHub
parent d3b43b5b64
commit 7c2b4ec502
18 changed files with 480 additions and 268 deletions

View File

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

View File

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

View File

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