Spin server when Tests start (#3316)
This commit is contained in:
@@ -268,23 +268,22 @@ module.exports = {
|
||||
await window.waitForSelector('#saveSetting');
|
||||
|
||||
let username = process.env.MM_TEST_USERNAME;
|
||||
if (!username) {
|
||||
switch (process.platform) {
|
||||
case 'darwin':
|
||||
username = 'success+sysadmin+macos@simulator.amazonses.com';
|
||||
break;
|
||||
case 'linux':
|
||||
username = 'success+sysadmin+linux@simulator.amazonses.com';
|
||||
break;
|
||||
case 'win32':
|
||||
username = 'success+sysadmin+windows@simulator.amazonses.com';
|
||||
break;
|
||||
default:
|
||||
throw new Error('Unsupported platform');
|
||||
}
|
||||
switch (process.platform) {
|
||||
case 'darwin':
|
||||
username = 'success+sysadmin+macos@simulator.amazonses.com';
|
||||
break;
|
||||
case 'linux':
|
||||
username = 'success+sysadmin+linux@simulator.amazonses.com';
|
||||
break;
|
||||
case 'win32':
|
||||
username = 'success+sysadmin+windows@simulator.amazonses.com';
|
||||
break;
|
||||
default:
|
||||
throw new Error('Unsupported platform');
|
||||
}
|
||||
|
||||
await window.type('#input_loginId', username);
|
||||
|
||||
await window.type('#input_password-input', process.env.MM_TEST_PASSWORD);
|
||||
await window.click('#saveSetting');
|
||||
},
|
||||
|
@@ -27,6 +27,7 @@
|
||||
* - TYPE=[type], e.g. "MASTER", "PR", "RELEASE", "CLOUD"
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const generator = require('mochawesome-report-generator');
|
||||
@@ -79,6 +80,9 @@ const saveReport = async () => {
|
||||
const result = await saveArtifacts();
|
||||
if (result && result.success) {
|
||||
console.log('Successfully uploaded artifacts to S3:', result.reportLink);
|
||||
|
||||
// save the report link to a file For CI to use
|
||||
fs.writeFileSync('report-link.txt', result.reportLink);
|
||||
}
|
||||
|
||||
// Create or use an existing test cycle
|
||||
@@ -98,8 +102,6 @@ const saveReport = async () => {
|
||||
if (ZEPHYR_ENABLE === 'true') {
|
||||
await createTestExecutions(jsonReport, testCycle);
|
||||
}
|
||||
|
||||
// chai.expect(Boolean(jsonReport.stats.failures), FAILURE_MESSAGE).to.be.false;
|
||||
};
|
||||
|
||||
saveReport();
|
||||
|
@@ -32,29 +32,28 @@ describe('copylink', function desc() {
|
||||
await env.clearElectronInstances();
|
||||
});
|
||||
|
||||
it('MM-T125 Copy Link can be used from channel LHS', async () => {
|
||||
const firstServer = this.serverMap[`${config.teams[0].name}___TAB_MESSAGING`].win;
|
||||
await env.loginToMattermost(firstServer);
|
||||
await asyncSleep(2000);
|
||||
await firstServer.waitForSelector('#sidebarItem_town-square', {timeout: 5000});
|
||||
await firstServer.click('#sidebarItem_town-square', {button: 'right'});
|
||||
await asyncSleep(2000);
|
||||
switch (process.platform) {
|
||||
case 'linux':
|
||||
robot.keyTap('c');
|
||||
break;
|
||||
case 'win32':
|
||||
robot.keyTap('down');
|
||||
robot.keyTap('down');
|
||||
break;
|
||||
case 'darwin':
|
||||
robot.keyTap('c');
|
||||
break;
|
||||
}
|
||||
robot.keyTap('enter');
|
||||
await firstServer.click('#sidebarItem_town-square');
|
||||
await firstServer.click('#post_textbox');
|
||||
const clipboardText = clipboard.readText();
|
||||
clipboardText.should.contain('/channels/town-square');
|
||||
});
|
||||
if (process.platform !== 'linux') {
|
||||
it('MM-T125 Copy Link can be used from channel LHS', async () => {
|
||||
const firstServer = this.serverMap[`${config.teams[0].name}___TAB_MESSAGING`].win;
|
||||
await env.loginToMattermost(firstServer);
|
||||
await asyncSleep(2000);
|
||||
await firstServer.waitForSelector('#sidebarItem_town-square', {timeout: 5000});
|
||||
await firstServer.click('#sidebarItem_town-square', {button: 'right'});
|
||||
await asyncSleep(2000);
|
||||
switch (process.platform) {
|
||||
case 'win32':
|
||||
robot.keyTap('down');
|
||||
robot.keyTap('down');
|
||||
break;
|
||||
case 'darwin':
|
||||
robot.keyTap('c');
|
||||
break;
|
||||
}
|
||||
robot.keyTap('enter');
|
||||
await firstServer.click('#sidebarItem_town-square');
|
||||
await firstServer.click('#post_textbox');
|
||||
const clipboardText = clipboard.readText();
|
||||
clipboardText.should.contain('/channels/town-square');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@@ -34,16 +34,27 @@ describe('history_menu', function desc() {
|
||||
await env.loginToMattermost(firstServer);
|
||||
await firstServer.waitForSelector('#sidebarItem_off-topic');
|
||||
|
||||
// click on Off topic channel
|
||||
// Click on Off-Topic channel
|
||||
await firstServer.click('#sidebarItem_off-topic');
|
||||
|
||||
// click on town square channel
|
||||
// Click on Town Square channel
|
||||
await firstServer.click('#sidebarItem_town-square');
|
||||
await firstServer.locator('[aria-label="Back"]').click();
|
||||
let channelHeaderText = await firstServer.$eval('#channelHeaderTitle', (el) => el.firstChild.innerHTML);
|
||||
|
||||
// Wait for navigation
|
||||
await firstServer.waitForSelector('#channelHeaderTitle');
|
||||
|
||||
// Get channel header text
|
||||
let channelHeaderText = await firstServer.$eval('#channelHeaderTitle', (el) => el.textContent.trim());
|
||||
channelHeaderText.should.equal('Off-Topic');
|
||||
|
||||
await firstServer.locator('[aria-label="Forward"]').click();
|
||||
channelHeaderText = await firstServer.$eval('#channelHeaderTitle', (el) => el.firstChild.innerHTML);
|
||||
await asyncSleep(3000);
|
||||
|
||||
// Wait for navigation
|
||||
await firstServer.waitForSelector('#channelHeaderTitle');
|
||||
|
||||
channelHeaderText = await firstServer.$eval('#channelHeaderTitle', (el) => el.textContent.trim());
|
||||
channelHeaderText.should.equal('Town Square');
|
||||
});
|
||||
});
|
||||
|
@@ -187,31 +187,33 @@ describe('menu/view', function desc() {
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T820 should open Developer Tools For Application Wrapper for main window', async () => {
|
||||
const mainWindow = this.app.windows().find((window) => window.url().includes('index.html'));
|
||||
const browserWindow = await this.app.browserWindow(mainWindow);
|
||||
if (process.platform !== 'linux') {
|
||||
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);
|
||||
|
||||
let isDevToolsOpen = await browserWindow.evaluate((window) => {
|
||||
return window.webContents.isDevToolsOpened();
|
||||
let isDevToolsOpen = await browserWindow.evaluate((window) => {
|
||||
return window.webContents.isDevToolsOpened();
|
||||
});
|
||||
isDevToolsOpen.should.be.false;
|
||||
|
||||
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;
|
||||
});
|
||||
isDevToolsOpen.should.be.false;
|
||||
|
||||
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;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@@ -147,39 +147,42 @@ describe('Menu/window_menu', function desc() {
|
||||
await afterFunc();
|
||||
});
|
||||
|
||||
it('MM-T824 should be minimized when keyboard shortcuts are pressed', async () => {
|
||||
await beforeFunc();
|
||||
if (process.platform !== 'linux') {
|
||||
it('MM-T824 should be minimized when keyboard shortcuts are pressed', async () => {
|
||||
await beforeFunc();
|
||||
|
||||
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||
const browserWindow = await this.app.browserWindow(mainWindow);
|
||||
if (process.platform === 'darwin') {
|
||||
robot.keyTap('m', [env.cmdOrCtrl]);
|
||||
} else {
|
||||
await mainWindow.click('button.three-dot-menu');
|
||||
robot.keyTap('w');
|
||||
robot.keyTap('m');
|
||||
robot.keyTap('enter');
|
||||
}
|
||||
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||
const browserWindow = await this.app.browserWindow(mainWindow);
|
||||
if (process.platform === 'darwin') {
|
||||
robot.keyTap('m', [env.cmdOrCtrl]);
|
||||
} else {
|
||||
await mainWindow.click('button.three-dot-menu');
|
||||
robot.keyTap('w');
|
||||
robot.keyTap('m');
|
||||
robot.keyTap('enter');
|
||||
}
|
||||
|
||||
await asyncSleep(2000);
|
||||
const isMinimized = await browserWindow.evaluate((window) => window.isMinimized());
|
||||
isMinimized.should.be.true;
|
||||
await asyncSleep(2000);
|
||||
const isMinimized = await browserWindow.evaluate((window) => window.isMinimized());
|
||||
isMinimized.should.be.true;
|
||||
|
||||
await afterFunc();
|
||||
});
|
||||
await afterFunc();
|
||||
});
|
||||
}
|
||||
if (process.platform !== 'linux') {
|
||||
it('MM-T825 should be hidden when keyboard shortcuts are pressed', async () => {
|
||||
await beforeFunc();
|
||||
|
||||
it('MM-T825 should be hidden when keyboard shortcuts are pressed', async () => {
|
||||
await beforeFunc();
|
||||
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||
const browserWindow = await this.app.browserWindow(mainWindow);
|
||||
robot.keyTap('w', [env.cmdOrCtrl]);
|
||||
await asyncSleep(2000);
|
||||
const isVisible = await browserWindow.evaluate((window) => window.isVisible());
|
||||
isVisible.should.be.false;
|
||||
const isDestroyed = await browserWindow.evaluate((window) => window.isDestroyed());
|
||||
isDestroyed.should.be.false;
|
||||
|
||||
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
||||
const browserWindow = await this.app.browserWindow(mainWindow);
|
||||
robot.keyTap('w', [env.cmdOrCtrl]);
|
||||
await asyncSleep(2000);
|
||||
const isVisible = await browserWindow.evaluate((window) => window.isVisible());
|
||||
isVisible.should.be.false;
|
||||
const isDestroyed = await browserWindow.evaluate((window) => window.isDestroyed());
|
||||
isDestroyed.should.be.false;
|
||||
|
||||
await afterFunc();
|
||||
});
|
||||
await afterFunc();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@@ -37,13 +37,15 @@ describe('header', function desc() {
|
||||
await env.clearElectronInstances();
|
||||
});
|
||||
|
||||
it('MM-T2637_1 should maximize on double-clicking the header', async () => {
|
||||
const headerBounds = await header.boundingBox();
|
||||
await header.dblclick({position: {x: headerBounds.width / 2, y: headerBounds.y / 2}});
|
||||
await asyncSleep(1000);
|
||||
const isMaximized = await browserWindow.evaluate((window) => window.isMaximized());
|
||||
isMaximized.should.be.equal(true);
|
||||
});
|
||||
if (process.platform !== 'linux') {
|
||||
it('MM-T2637_1 should maximize on double-clicking the header', async () => {
|
||||
const headerBounds = await header.boundingBox();
|
||||
await header.dblclick({position: {x: headerBounds.width / 2, y: headerBounds.y / 2}});
|
||||
await asyncSleep(1000);
|
||||
const isMaximized = await browserWindow.evaluate((window) => window.isMaximized());
|
||||
isMaximized.should.be.equal(true);
|
||||
});
|
||||
}
|
||||
|
||||
it('MM-T2637_2 should restore on double-clicking the header when maximized', async () => {
|
||||
const maximizedHeaderBounds = await header.boundingBox();
|
||||
|
@@ -24,53 +24,13 @@ function analyzeFlakyTests() {
|
||||
// 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};
|
||||
return {newFailedTests, os};
|
||||
} catch (error) {
|
||||
console.error('Error analyzing failures:', error);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
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${newFailedTests.map((test) => `- ${test}`).join('\n')}`;
|
||||
commentBody += `
|
||||
${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 += `
|
||||
${fixedTestMessage}
|
||||
`;
|
||||
}
|
||||
|
||||
return commentBody;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
analyzeFlakyTests,
|
||||
};
|
||||
|
Reference in New Issue
Block a user