2020-05-20 16:33:40 +00:00
|
|
|
const data = require('../../data');
|
2021-12-02 13:19:15 +00:00
|
|
|
const { navigateToLogin, login, checkServer, platformTypes } = require('../../helpers/app');
|
2019-09-16 20:26:32 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
const reopenAndCheckServer = async server => {
|
2021-12-02 13:19:15 +00:00
|
|
|
await device.launchApp({ permissions: { notifications: 'YES' }, newInstance: true });
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view')))
|
|
|
|
.toBeVisible()
|
2021-09-23 14:17:53 +00:00
|
|
|
.withTimeout(10000);
|
2021-03-18 13:18:33 +00:00
|
|
|
await checkServer(server);
|
2021-07-02 17:39:39 +00:00
|
|
|
};
|
2021-03-18 13:18:33 +00:00
|
|
|
|
2018-05-23 13:39:18 +00:00
|
|
|
describe('Change server', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
before(async () => {
|
2020-07-22 16:32:21 +00:00
|
|
|
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
2020-07-15 16:28:34 +00:00
|
|
|
await navigateToLogin();
|
|
|
|
await login(data.users.regular.username, data.users.regular.password);
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(10000);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
2021-09-23 14:17:53 +00:00
|
|
|
it('should open the dropdown button, have the server add button and create workspace button', async () => {
|
2020-03-03 20:27:38 +00:00
|
|
|
await element(by.id('rooms-list-header-server-dropdown-button')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-header-server-dropdown')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(5000);
|
2021-09-23 14:17:53 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-header-server-add')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(5000);
|
|
|
|
await waitFor(element(by.id('rooms-list-header-create-workspace-button')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(5000);
|
|
|
|
});
|
2020-05-20 16:33:40 +00:00
|
|
|
|
2021-09-23 14:17:53 +00:00
|
|
|
it('should login to server, add new server, close the app, open the app and show previous logged server', async () => {
|
|
|
|
await element(by.id('rooms-list-header-server-add')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('new-server-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(6000);
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by.id('new-server-view-input')).replaceText(`${data.alternateServer}`);
|
|
|
|
await element(by.id('new-server-view-input')).tapReturnKey();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('workspace-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(10000);
|
2021-03-18 13:18:33 +00:00
|
|
|
await reopenAndCheckServer(data.server);
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should add server and create new user', async () => {
|
2021-03-18 13:18:33 +00:00
|
|
|
await element(by.id('rooms-list-header-server-dropdown-button')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-header-server-dropdown')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(5000);
|
|
|
|
await element(by.id(`rooms-list-header-server-${data.alternateServer}`)).tap();
|
|
|
|
await waitFor(element(by.id('workspace-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(60000);
|
2020-05-20 16:33:40 +00:00
|
|
|
await element(by.id('workspace-view-register')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('register-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-07-22 16:32:21 +00:00
|
|
|
|
2018-05-23 13:39:18 +00:00
|
|
|
// Register new user
|
2021-04-01 19:27:46 +00:00
|
|
|
await element(by.id('register-view-name')).replaceText(data.registeringUser2.username);
|
|
|
|
await element(by.id('register-view-username')).replaceText(data.registeringUser2.username);
|
|
|
|
await element(by.id('register-view-email')).replaceText(data.registeringUser2.email);
|
|
|
|
await element(by.id('register-view-password')).replaceText(data.registeringUser2.password);
|
2018-05-23 13:39:18 +00:00
|
|
|
await element(by.id('register-view-submit')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(60000);
|
2020-05-20 16:33:40 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id(`rooms-list-view-item-${data.groups.private.name}`)))
|
|
|
|
.toBeNotVisible()
|
|
|
|
.withTimeout(60000);
|
2020-05-20 16:33:40 +00:00
|
|
|
await checkServer(data.alternateServer);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should reopen the app and show alternate server', async () => {
|
2021-03-18 13:18:33 +00:00
|
|
|
await reopenAndCheckServer(data.alternateServer);
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should change back to main server', async () => {
|
2020-03-03 20:27:38 +00:00
|
|
|
await element(by.id('rooms-list-header-server-dropdown-button')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-header-server-dropdown')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(5000);
|
|
|
|
await element(by.id(`rooms-list-header-server-${data.server}`)).tap();
|
|
|
|
await waitFor(element(by.id('rooms-list-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(10000);
|
|
|
|
await waitFor(element(by.id(`rooms-list-view-item-${data.groups.private.name}`)))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(60000);
|
2020-05-20 16:33:40 +00:00
|
|
|
await checkServer(data.server);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
2021-03-18 13:18:33 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should reopen the app and show main server', async () => {
|
2021-03-18 13:18:33 +00:00
|
|
|
await reopenAndCheckServer(data.server);
|
2021-07-02 17:39:39 +00:00
|
|
|
});
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|