[MM-14093] Rename 'team' to 'server' and 'tab' to 'view' in most cases, some additional cleanup (#2711)

* Rename MattermostTeam -> UniqueServer, MattermostTab -> UniqueView

* Rename 'team' to 'server'

* Some further cleanup

* Rename weirdly named function

* Rename 'tab' to 'view' in most instances

* Fix i18n

* PR feedback
This commit is contained in:
Devin Binnie
2023-05-08 09:17:01 -04:00
committed by GitHub
parent 9f75ddcf0f
commit 316beba950
110 changed files with 1698 additions and 1757 deletions

View File

@@ -40,7 +40,7 @@ if (process.platform === 'win32') {
robot.mouseClick();
}
const exampleTeam = {
const exampleServer = {
name: 'example',
url: exampleURL,
order: 0,
@@ -61,7 +61,7 @@ const exampleTeam = {
],
lastActiveTab: 0,
};
const githubTeam = {
const githubServer = {
name: 'github',
url: 'https://github.com/',
order: 1,
@@ -87,7 +87,7 @@ const githubTeam = {
const demoConfig = {
version: 3,
teams: [exampleTeam, githubTeam],
teams: [exampleServer, githubServer],
showTrayIcon: false,
trayIconTheme: 'light',
minimizeToTray: false,
@@ -113,9 +113,9 @@ const demoConfig = {
const demoMattermostConfig = {
...demoConfig,
teams: [{
...exampleTeam,
...exampleServer,
url: mattermostURL,
}, githubTeam],
}, githubServer],
};
const cmdOrCtrl = process.platform === 'darwin' ? 'command' : 'control';
@@ -235,7 +235,7 @@ module.exports = {
return null;
}
const info = await window.testHelper.getViewInfoForTest();
return {viewName: `${info.serverName}___${info.tabType}`, webContentsId: info.webContentsId};
return {viewName: `${info.serverName}___${info.viewType}`, webContentsId: info.webContentsId};
}).then((result) => {
if (result) {
map[result.viewName] = {win, webContentsId: result.webContentsId};

View File

@@ -46,7 +46,7 @@ describe('application', function desc() {
return window.getBrowserViews().find((view) => view.webContents.id === id).webContents.getURL();
}, webContentsId);
isActive.should.equal('https://github.com/test/url');
const dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton');
const dropdownButtonText = await mainWindow.innerText('.ServerDropdownButton');
dropdownButtonText.should.equal('github');
await this.app.close();
});

View File

@@ -98,8 +98,8 @@ describe('focus', function desc() {
it('MM-T1316 should return focus to the message box when closing the settings window', async () => {
const mainView = this.app.windows().find((window) => window.url().includes('index'));
const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown'));
await mainView.click('.TeamDropdownButton');
await dropdownView.click('.TeamDropdown .TeamDropdown__button.addServer');
await mainView.click('.ServerDropdownButton');
await dropdownView.click('.ServerDropdown .ServerDropdown__button.addServer');
const newServerView = await this.app.waitForEvent('window', {
predicate: (window) => window.url().includes('newServer'),
});
@@ -121,15 +121,15 @@ describe('focus', function desc() {
it('MM-T1317 should return focus to the focused box when switching servers', async () => {
const mainView = this.app.windows().find((window) => window.url().includes('index'));
const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown'));
await mainView.click('.TeamDropdownButton');
await dropdownView.click('.TeamDropdown .TeamDropdown__button:has-text("community")');
await mainView.click('.ServerDropdownButton');
await dropdownView.click('.ServerDropdown .ServerDropdown__button:has-text("community")');
// eslint-disable-next-line dot-notation
const secondServer = this.serverMap['community___TAB_MESSAGING'].win;
await secondServer.waitForSelector('#input_loginId');
await secondServer.focus('#input_loginId');
await mainView.click('.TeamDropdownButton');
await dropdownView.click(`.TeamDropdown .TeamDropdown__button:has-text("${config.teams[0].name}")`);
await mainView.click('.ServerDropdownButton');
await dropdownView.click(`.ServerDropdown .ServerDropdown__button:has-text("${config.teams[0].name}")`);
const isTextboxFocused = await firstServer.$eval('#post_textbox', (el) => el === document.activeElement);
isTextboxFocused.should.be.true;
@@ -141,8 +141,8 @@ describe('focus', function desc() {
const textboxString = await firstServer.inputValue('#post_textbox');
textboxString.should.equal('Mattermost');
await mainView.click('.TeamDropdownButton');
await dropdownView.click('.TeamDropdown .TeamDropdown__button:has-text("community")');
await mainView.click('.ServerDropdownButton');
await dropdownView.click('.ServerDropdown .ServerDropdown__button:has-text("community")');
const isLoginFocused = await secondServer.$eval('#input_loginId', (el) => el === document.activeElement);
isLoginFocused.should.be.true;

View File

@@ -32,9 +32,9 @@ describe('menu_bar/dropdown', function desc() {
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown'));
await mainWindow.click('.TeamDropdownButton');
const firstMenuItem = await dropdownView.innerText('.TeamDropdown button.TeamDropdown__button:nth-child(1) span');
const secondMenuItem = await dropdownView.innerText('.TeamDropdown button.TeamDropdown__button:nth-child(2) span');
await mainWindow.click('.ServerDropdownButton');
const firstMenuItem = await dropdownView.innerText('.ServerDropdown button.ServerDropdown__button:nth-child(1) span');
const secondMenuItem = await dropdownView.innerText('.ServerDropdown button.ServerDropdown__button:nth-child(2) span');
firstMenuItem.should.equal(config.teams[0].name);
secondMenuItem.should.equal(config.teams[1].name);
@@ -57,7 +57,7 @@ describe('menu_bar/dropdown', function desc() {
let dropdownHeight = await browserWindow.evaluate((window) => window.getBrowserViews().find((view) => view.webContents.getURL().includes('dropdown')).getBounds().height);
dropdownHeight.should.equal(0);
await mainWindow.click('.TeamDropdownButton');
await mainWindow.click('.ServerDropdownButton');
dropdownHeight = await browserWindow.evaluate((window) => window.getBrowserViews().find((view) => view.webContents.getURL().includes('dropdown')).getBounds().height);
dropdownHeight.should.be.greaterThan(0);
});
@@ -74,8 +74,8 @@ describe('menu_bar/dropdown', function desc() {
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown'));
await mainWindow.click('.TeamDropdownButton');
await dropdownView.click('.TeamDropdown__button.addServer');
await mainWindow.click('.ServerDropdownButton');
await dropdownView.click('.ServerDropdown__button.addServer');
const newServerModal = await this.app.waitForEvent('window', {
predicate: (window) => window.url().includes('newServer'),
@@ -107,8 +107,8 @@ describe('menu_bar/dropdown', function desc() {
});
it('MM-T4408_2 should show the second view after clicking the menu item', async () => {
await mainWindow.click('.TeamDropdownButton');
await dropdownView.click('.TeamDropdown button.TeamDropdown__button:nth-child(2)');
await mainWindow.click('.ServerDropdownButton');
await dropdownView.click('.ServerDropdown button.ServerDropdown__button:nth-child(2)');
const firstViewIsAttached = await browserWindow.evaluate((window, url) => Boolean(window.getBrowserViews().find((view) => view.webContents.getURL() === url)), env.exampleURL);
firstViewIsAttached.should.be.false;

View File

@@ -72,23 +72,23 @@ describe('Menu/window_menu', function desc() {
after(afterFunc);
it('MM-T826_1 should show the second server', async () => {
let dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton');
let dropdownButtonText = await mainWindow.innerText('.ServerDropdownButton');
dropdownButtonText.should.equal('google');
robot.keyTap('2', ['control', process.platform === 'darwin' ? 'command' : 'shift']);
dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton:has-text("github")');
dropdownButtonText = await mainWindow.innerText('.ServerDropdownButton:has-text("github")');
dropdownButtonText.should.equal('github');
});
it('MM-T826_2 should show the third server', async () => {
robot.keyTap('3', ['control', process.platform === 'darwin' ? 'command' : 'shift']);
const dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton:has-text("google")');
const dropdownButtonText = await mainWindow.innerText('.ServerDropdownButton:has-text("google")');
dropdownButtonText.should.equal('google');
});
it('MM-T826_3 should show the first server', async () => {
robot.keyTap('1', ['control', process.platform === 'darwin' ? 'command' : 'shift']);
const dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton:has-text("example")');
const dropdownButtonText = await mainWindow.innerText('.ServerDropdownButton:has-text("example")');
dropdownButtonText.should.equal('example');
});
});

View File

@@ -21,8 +21,8 @@ describe('Add Server Modal', function desc() {
const mainView = this.app.windows().find((window) => window.url().includes('index'));
const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown'));
await mainView.click('.TeamDropdownButton');
await dropdownView.click('.TeamDropdown .TeamDropdown__button.addServer');
await mainView.click('.ServerDropdownButton');
await dropdownView.click('.ServerDropdown .ServerDropdown__button.addServer');
newServerView = await this.app.waitForEvent('window', {
predicate: (window) => window.url().includes('newServer'),
});
@@ -41,7 +41,7 @@ describe('Add Server Modal', function desc() {
let newServerView;
it('MM-T1312 should focus the first text input', async () => {
const isFocused = await newServerView.$eval('#teamUrlInput', (el) => el.isSameNode(document.activeElement));
const isFocused = await newServerView.$eval('#serverUrlInput', (el) => el.isSameNode(document.activeElement));
isFocused.should.be.true;
});
@@ -53,39 +53,39 @@ describe('Add Server Modal', function desc() {
});
describe('MM-T4389 Invalid messages', () => {
it('MM-T4389_1 should not be valid if no team name or URL has been set', async () => {
it('MM-T4389_1 should not be valid if no server name or URL has been set', async () => {
await newServerView.click('#saveNewServerModal');
const existingName = await newServerView.isVisible('#teamNameInput.is-invalid');
const existingUrl = await newServerView.isVisible('#teamUrlInput.is-invalid');
const existingName = await newServerView.isVisible('#serverNameInput.is-invalid');
const existingUrl = await newServerView.isVisible('#serverUrlInput.is-invalid');
existingName.should.be.true;
existingUrl.should.be.true;
});
it('should not be valid if a server with the same name exists', async () => {
await newServerView.type('#teamNameInput', config.teams[0].name);
await newServerView.type('#teamUrlInput', 'http://example.org');
await newServerView.type('#serverNameInput', config.teams[0].name);
await newServerView.type('#serverUrlInput', 'http://example.org');
await newServerView.click('#saveNewServerModal');
const existing = await newServerView.isVisible('#teamNameInput.is-invalid');
const existing = await newServerView.isVisible('#serverNameInput.is-invalid');
existing.should.be.true;
});
it('should not be valid if a server with the same URL exists', async () => {
await newServerView.type('#teamNameInput', 'some-new-server');
await newServerView.type('#teamUrlInput', config.teams[0].url);
await newServerView.type('#serverNameInput', 'some-new-server');
await newServerView.type('#serverUrlInput', config.teams[0].url);
await newServerView.click('#saveNewServerModal');
const existing = await newServerView.isVisible('#teamUrlInput.is-invalid');
const existing = await newServerView.isVisible('#serverUrlInput.is-invalid');
existing.should.be.true;
});
describe('Valid server name', async () => {
beforeEach(async () => {
await newServerView.type('#teamNameInput', 'TestTeam');
await newServerView.type('#serverNameInput', 'TestServer');
await newServerView.click('#saveNewServerModal');
});
it('MM-T4389_2 Name should not be marked invalid, URL should be marked invalid', async () => {
const existingName = await newServerView.isVisible('#teamNameInput.is-invalid');
const existingUrl = await newServerView.isVisible('#teamUrlInput.is-invalid');
const existingName = await newServerView.isVisible('#serverNameInput.is-invalid');
const existingUrl = await newServerView.isVisible('#serverUrlInput.is-invalid');
const disabled = await newServerView.getAttribute('#saveNewServerModal', 'disabled');
existingName.should.be.false;
existingUrl.should.be.true;
@@ -95,13 +95,13 @@ describe('Add Server Modal', function desc() {
describe('Valid server url', () => {
beforeEach(async () => {
await newServerView.type('#teamUrlInput', 'http://example.org');
await newServerView.type('#serverUrlInput', 'http://example.org');
await newServerView.click('#saveNewServerModal');
});
it('MM-T4389_3 URL should not be marked invalid, name should be marked invalid', async () => {
const existingName = await newServerView.isVisible('#teamNameInput.is-invalid');
const existingUrl = await newServerView.isVisible('#teamUrlInput.is-invalid');
const existingName = await newServerView.isVisible('#serverNameInput.is-invalid');
const existingUrl = await newServerView.isVisible('#serverUrlInput.is-invalid');
const disabled = await newServerView.getAttribute('#saveNewServerModal', 'disabled');
existingName.should.be.true;
existingUrl.should.be.false;
@@ -111,16 +111,16 @@ describe('Add Server Modal', function desc() {
});
it('MM-T2826_1 should not be valid if an invalid server address has been set', async () => {
await newServerView.type('#teamUrlInput', 'superInvalid url');
await newServerView.type('#serverUrlInput', 'superInvalid url');
await newServerView.click('#saveNewServerModal');
const existing = await newServerView.isVisible('#teamUrlInput.is-invalid');
const existing = await newServerView.isVisible('#serverUrlInput.is-invalid');
existing.should.be.true;
});
describe('Valid Team Settings', () => {
beforeEach(async () => {
await newServerView.type('#teamUrlInput', 'http://example.org');
await newServerView.type('#teamNameInput', 'TestTeam');
await newServerView.type('#serverUrlInput', 'http://example.org');
await newServerView.type('#serverNameInput', 'TestServer');
});
it('should be possible to click add', async () => {
@@ -128,7 +128,7 @@ describe('Add Server Modal', function desc() {
(disabled === null).should.be.true;
});
it('MM-T2826_2 should add the team to the config file', async () => {
it('MM-T2826_2 should add the server to the config file', async () => {
await newServerView.click('#saveNewServerModal');
await asyncSleep(1000);
const existing = Boolean(await this.app.windows().find((window) => window.url().includes('newServer')));
@@ -136,7 +136,7 @@ describe('Add Server Modal', function desc() {
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
savedConfig.teams.should.deep.contain({
name: 'TestTeam',
name: 'TestServer',
url: 'http://example.org/',
order: 2,
lastActiveTab: 0,

View File

@@ -48,7 +48,7 @@ describe('Configure Server Modal', function desc() {
});
it('MM-T5117 should be valid if display name and URL are set', async () => {
await configureServerModal.type('#input_name', 'TestTeam');
await configureServerModal.type('#input_name', 'TestServer');
await configureServerModal.type('#input_url', 'http://example.org');
const connectButtonDisabled = await configureServerModal.getAttribute('#connectConfigureServer', 'disabled');
@@ -56,7 +56,7 @@ describe('Configure Server Modal', function desc() {
});
it('MM-T5118 should not be valid if an invalid URL has been set', async () => {
await configureServerModal.type('#input_name', 'TestTeam');
await configureServerModal.type('#input_name', 'TestServer');
await configureServerModal.type('#input_url', 'lorem.ipsum.dolor.sit.amet');
await configureServerModal.click('#connectConfigureServer');
@@ -70,8 +70,8 @@ describe('Configure Server Modal', function desc() {
(connectButtonDisabled === '').should.be.true;
});
it('MM-T5119 should add the team to the config file', async () => {
await configureServerModal.type('#input_name', 'TestTeam');
it('MM-T5119 should add the server to the config file', async () => {
await configureServerModal.type('#input_name', 'TestServer');
await configureServerModal.type('#input_url', 'http://example.org');
await configureServerModal.click('#connectConfigureServer');
@@ -84,7 +84,7 @@ describe('Configure Server Modal', function desc() {
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
savedConfig.teams.should.deep.contain({
url: 'http://example.org/',
name: 'TestTeam',
name: 'TestServer',
order: 0,
lastActiveTab: 0,
tabs: [

View File

@@ -64,41 +64,41 @@ describe('server_management/drag_and_drop', function desc() {
await beforeFunc();
mainWindow = this.app.windows().find((window) => window.url().includes('index'));
dropdownView = this.app.windows().find((window) => window.url().includes('dropdown'));
await mainWindow.click('.TeamDropdownButton');
await mainWindow.click('.ServerDropdownButton');
});
after(afterFunc);
it('MM-T2634_1 should appear the original order', async () => {
const firstMenuItem = await dropdownView.waitForSelector('.TeamDropdown button.TeamDropdown__button:nth-child(1) .TeamDropdown__draggable-handle');
const firstMenuItem = await dropdownView.waitForSelector('.ServerDropdown button.ServerDropdown__button:nth-child(1) .ServerDropdown__draggable-handle');
const firstMenuItemText = await firstMenuItem.innerText();
firstMenuItemText.should.equal('example');
const secondMenuItem = await dropdownView.waitForSelector('.TeamDropdown button.TeamDropdown__button:nth-child(2) .TeamDropdown__draggable-handle');
const secondMenuItem = await dropdownView.waitForSelector('.ServerDropdown button.ServerDropdown__button:nth-child(2) .ServerDropdown__draggable-handle');
const secondMenuItemText = await secondMenuItem.innerText();
secondMenuItemText.should.equal('github');
const thirdMenuItem = await dropdownView.waitForSelector('.TeamDropdown button.TeamDropdown__button:nth-child(3) .TeamDropdown__draggable-handle');
const thirdMenuItem = await dropdownView.waitForSelector('.ServerDropdown button.ServerDropdown__button:nth-child(3) .ServerDropdown__draggable-handle');
const thirdMenuItemText = await thirdMenuItem.innerText();
thirdMenuItemText.should.equal('google');
});
it('MM-T2634_2 after dragging the server down, should appear in the new order', async () => {
// Move the first server down, then re-open the dropdown
const initialMenuItem = await dropdownView.waitForSelector('.TeamDropdown button.TeamDropdown__button:nth-child(1) .TeamDropdown__draggable-handle');
const initialMenuItem = await dropdownView.waitForSelector('.ServerDropdown button.ServerDropdown__button:nth-child(1) .ServerDropdown__draggable-handle');
await initialMenuItem.focus();
await dropdownView.keyboard.down(' ');
await dropdownView.keyboard.down('ArrowDown');
await dropdownView.keyboard.down(' ');
await asyncSleep(1000);
await mainWindow.keyboard.press('Escape');
await mainWindow.click('.TeamDropdownButton');
await mainWindow.click('.ServerDropdownButton');
// Verify that the new order persists
const firstMenuItem = await dropdownView.waitForSelector('.TeamDropdown button.TeamDropdown__button:nth-child(1) .TeamDropdown__draggable-handle');
const firstMenuItem = await dropdownView.waitForSelector('.ServerDropdown button.ServerDropdown__button:nth-child(1) .ServerDropdown__draggable-handle');
const firstMenuItemText = await firstMenuItem.innerText();
firstMenuItemText.should.equal('github');
const secondMenuItem = await dropdownView.waitForSelector('.TeamDropdown button.TeamDropdown__button:nth-child(2) .TeamDropdown__draggable-handle');
const secondMenuItem = await dropdownView.waitForSelector('.ServerDropdown button.ServerDropdown__button:nth-child(2) .ServerDropdown__draggable-handle');
const secondMenuItemText = await secondMenuItem.innerText();
secondMenuItemText.should.equal('example');
const thirdMenuItem = await dropdownView.waitForSelector('.TeamDropdown button.TeamDropdown__button:nth-child(3) .TeamDropdown__draggable-handle');
const thirdMenuItem = await dropdownView.waitForSelector('.ServerDropdown button.ServerDropdown__button:nth-child(3) .ServerDropdown__draggable-handle');
const thirdMenuItemText = await thirdMenuItem.innerText();
thirdMenuItemText.should.equal('google');
});
@@ -125,20 +125,20 @@ describe('server_management/drag_and_drop', function desc() {
it('MM-T2635_1 should be in the original order', async () => {
// Verify the original order
const firstTab = await mainWindow.waitForSelector('.TabBar li.teamTabItem:nth-child(1)');
const firstTab = await mainWindow.waitForSelector('.TabBar li.serverTabItem:nth-child(1)');
const firstTabText = await firstTab.innerText();
firstTabText.should.equal('Channels');
const secondTab = await mainWindow.waitForSelector('.TabBar li.teamTabItem:nth-child(2)');
const secondTab = await mainWindow.waitForSelector('.TabBar li.serverTabItem:nth-child(2)');
const secondTabText = await secondTab.innerText();
secondTabText.should.equal('Boards');
const thirdTab = await mainWindow.waitForSelector('.TabBar li.teamTabItem:nth-child(3)');
const thirdTab = await mainWindow.waitForSelector('.TabBar li.serverTabItem:nth-child(3)');
const thirdTabText = await thirdTab.innerText();
thirdTabText.should.equal('Playbooks');
});
it('MM-T2635_2 after moving the tab to the right, the tab should be in the new order', async () => {
// Move the first tab to the right
let firstTab = await mainWindow.waitForSelector('.TabBar li.teamTabItem:nth-child(1)');
let firstTab = await mainWindow.waitForSelector('.TabBar li.serverTabItem:nth-child(1)');
await firstTab.focus();
await mainWindow.keyboard.down(' ');
await mainWindow.keyboard.down('ArrowRight');
@@ -146,13 +146,13 @@ describe('server_management/drag_and_drop', function desc() {
await asyncSleep(1000);
// Verify that the new order is visible
firstTab = await mainWindow.waitForSelector('.TabBar li.teamTabItem:nth-child(1)');
firstTab = await mainWindow.waitForSelector('.TabBar li.serverTabItem:nth-child(1)');
const firstTabText = await firstTab.innerText();
firstTabText.should.equal('Boards');
const secondTab = await mainWindow.waitForSelector('.TabBar li.teamTabItem:nth-child(2)');
const secondTab = await mainWindow.waitForSelector('.TabBar li.serverTabItem:nth-child(2)');
const secondTabText = await secondTab.innerText();
secondTabText.should.equal('Channels');
const thirdTab = await mainWindow.waitForSelector('.TabBar li.teamTabItem:nth-child(3)');
const thirdTab = await mainWindow.waitForSelector('.TabBar li.serverTabItem:nth-child(3)');
const thirdTabText = await thirdTab.innerText();
thirdTabText.should.equal('Playbooks');
});

View File

@@ -21,9 +21,9 @@ describe('EditServerModal', function desc() {
const mainView = this.app.windows().find((window) => window.url().includes('index'));
const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown'));
await mainView.click('.TeamDropdownButton');
await dropdownView.hover('.TeamDropdown .TeamDropdown__button:nth-child(1)');
await dropdownView.click('.TeamDropdown .TeamDropdown__button:nth-child(1) button.TeamDropdown__button-edit');
await mainView.click('.ServerDropdownButton');
await dropdownView.hover('.ServerDropdown .ServerDropdown__button:nth-child(1)');
await dropdownView.click('.ServerDropdown .ServerDropdown__button:nth-child(1) button.ServerDropdown__button-edit');
editServerView = await this.app.waitForEvent('window', {
predicate: (window) => window.url().includes('editServer'),
@@ -39,7 +39,7 @@ describe('EditServerModal', function desc() {
let editServerView;
it('should not edit team when Cancel is pressed', async () => {
it('should not edit server when Cancel is pressed', async () => {
await editServerView.click('#cancelNewServerModal');
await asyncSleep(1000);
const existing = Boolean(await this.app.windows().find((window) => window.url().includes('editServer')));
@@ -69,7 +69,7 @@ describe('EditServerModal', function desc() {
});
});
it('MM-T4391_1 should not edit team when Save is pressed but nothing edited', async () => {
it('MM-T4391_1 should not edit server when Save is pressed but nothing edited', async () => {
await editServerView.click('#saveNewServerModal');
await asyncSleep(1000);
const existing = Boolean(await this.app.windows().find((window) => window.url().includes('editServer')));
@@ -99,27 +99,27 @@ describe('EditServerModal', function desc() {
});
});
it('MM-T2826_3 should not edit team if an invalid server address has been set', async () => {
await editServerView.type('#teamUrlInput', 'superInvalid url');
it('MM-T2826_3 should not edit server if an invalid server address has been set', async () => {
await editServerView.type('#serverUrlInput', 'superInvalid url');
await editServerView.click('#saveNewServerModal');
const existing = await editServerView.isVisible('#teamUrlInput.is-invalid');
const existing = await editServerView.isVisible('#serverUrlInput.is-invalid');
existing.should.be.true;
});
it('should not edit team if another server with the same name or URL exists', async () => {
await editServerView.fill('#teamNameInput', config.teams[1].name);
it('should not edit server if another server with the same name or URL exists', async () => {
await editServerView.fill('#serverNameInput', config.teams[1].name);
await editServerView.click('#saveNewServerModal');
let existing = await editServerView.isVisible('#teamNameInput.is-invalid');
let existing = await editServerView.isVisible('#serverNameInput.is-invalid');
existing.should.be.true;
await editServerView.fill('#teamNameInput', 'NewTestTeam');
await editServerView.fill('#teamUrlInput', config.teams[1].url);
existing = await editServerView.isVisible('#teamUrlInput.is-invalid');
await editServerView.fill('#serverNameInput', 'NewTestServer');
await editServerView.fill('#serverUrlInput', config.teams[1].url);
existing = await editServerView.isVisible('#serverUrlInput.is-invalid');
existing.should.be.true;
});
it('MM-T4391_2 should edit team when Save is pressed and name edited', async () => {
await editServerView.fill('#teamNameInput', 'NewTestTeam');
it('MM-T4391_2 should edit server when Save is pressed and name edited', async () => {
await editServerView.fill('#serverNameInput', 'NewTestServer');
await editServerView.click('#saveNewServerModal');
await asyncSleep(1000);
const existing = Boolean(await this.app.windows().find((window) => window.url().includes('editServer')));
@@ -148,7 +148,7 @@ describe('EditServerModal', function desc() {
lastActiveTab: 0,
});
savedConfig.teams.should.deep.contain({
name: 'NewTestTeam',
name: 'NewTestServer',
url: env.exampleURL,
order: 0,
tabs: [
@@ -170,8 +170,8 @@ describe('EditServerModal', function desc() {
});
});
it('MM-T4391_3 should edit team when Save is pressed and URL edited', async () => {
await editServerView.fill('#teamUrlInput', 'http://google.com');
it('MM-T4391_3 should edit server when Save is pressed and URL edited', async () => {
await editServerView.fill('#serverUrlInput', 'http://google.com');
await editServerView.click('#saveNewServerModal');
await asyncSleep(1000);
const existing = Boolean(await this.app.windows().find((window) => window.url().includes('editServer')));
@@ -222,9 +222,9 @@ describe('EditServerModal', function desc() {
});
});
it('MM-T4391_4 should edit team when Save is pressed and both edited', async () => {
await editServerView.fill('#teamNameInput', 'NewTestTeam');
await editServerView.fill('#teamUrlInput', 'http://google.com');
it('MM-T4391_4 should edit server when Save is pressed and both edited', async () => {
await editServerView.fill('#serverNameInput', 'NewTestServer');
await editServerView.fill('#serverUrlInput', 'http://google.com');
await editServerView.click('#saveNewServerModal');
await asyncSleep(1000);
const existing = Boolean(await this.app.windows().find((window) => window.url().includes('editServer')));
@@ -253,7 +253,7 @@ describe('EditServerModal', function desc() {
lastActiveTab: 0,
});
savedConfig.teams.should.deep.contain({
name: 'NewTestTeam',
name: 'NewTestServer',
url: 'http://google.com/',
order: 0,
tabs: [

View File

@@ -24,8 +24,8 @@ describe('LongServerName', function desc() {
const mainView = this.app.windows().find((window) => window.url().includes('index'));
const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown'));
await mainView.click('.TeamDropdownButton');
await dropdownView.click('.TeamDropdown .TeamDropdown__button.addServer');
await mainView.click('.ServerDropdownButton');
await dropdownView.click('.ServerDropdown .ServerDropdown__button.addServer');
newServerView = await this.app.waitForEvent('window', {
predicate: (window) => window.url().includes('newServer'),
});
@@ -44,8 +44,8 @@ describe('LongServerName', function desc() {
let newServerView;
it('MM-T4050 Long server name', async () => {
await newServerView.type('#teamNameInput', longServerName);
await newServerView.type('#teamUrlInput', longServerUrl);
await newServerView.type('#serverNameInput', longServerName);
await newServerView.type('#serverUrlInput', longServerUrl);
await newServerView.click('#saveNewServerModal');
await asyncSleep(1000);

View File

@@ -21,9 +21,9 @@ describe('RemoveServerModal', function desc() {
const mainView = this.app.windows().find((window) => window.url().includes('index'));
const dropdownView = this.app.windows().find((window) => window.url().includes('dropdown'));
await mainView.click('.TeamDropdownButton');
await dropdownView.hover('.TeamDropdown .TeamDropdown__button:nth-child(1)');
await dropdownView.click('.TeamDropdown .TeamDropdown__button:nth-child(1) button.TeamDropdown__button-remove');
await mainView.click('.ServerDropdownButton');
await dropdownView.hover('.ServerDropdown .ServerDropdown__button:nth-child(1)');
await dropdownView.click('.ServerDropdown .ServerDropdown__button:nth-child(1) button.ServerDropdown__button-remove');
removeServerView = await this.app.waitForEvent('window', {
predicate: (window) => window.url().includes('removeServer'),
@@ -42,7 +42,7 @@ describe('RemoveServerModal', function desc() {
let removeServerView;
it('MM-T4390_1 should remove existing team on click Remove', async () => {
it('MM-T4390_1 should remove existing server on click Remove', async () => {
await removeServerView.click('button:has-text("Remove")');
await asyncSleep(1000);
@@ -55,7 +55,7 @@ describe('RemoveServerModal', function desc() {
savedConfig.teams.should.deep.equal(expectedConfig);
});
it('MM-T4390_2 should NOT remove existing team on click Cancel', async () => {
it('MM-T4390_2 should NOT remove existing server on click Cancel', async () => {
await removeServerView.click('button:has-text("Cancel")');
await asyncSleep(1000);

View File

@@ -44,7 +44,7 @@ describe('config', function desc() {
it('MM-T4401_1 should show correct server in the dropdown button', async () => {
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
const dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton');
const dropdownButtonText = await mainWindow.innerText('.ServerDropdownButton');
dropdownButtonText.should.equal('example');
});
@@ -66,8 +66,8 @@ describe('config', function desc() {
fs.writeFileSync(env.configFilePath, JSON.stringify(oldConfig));
this.app = await env.getApp();
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
const dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton:has-text("Primary team")');
dropdownButtonText.should.equal('Primary team');
const dropdownButtonText = await mainWindow.innerText('.ServerDropdownButton:has-text("Primary server")');
dropdownButtonText.should.equal('Primary server');
const str = fs.readFileSync(env.configFilePath, 'utf8');
const upgradedConfig = JSON.parse(str);