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

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