Modify run conditions for nightly e2e job to create test cycle and post in channel. (#2971)
This commit is contained in:
@@ -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');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user