2020-05-20 16:33:40 +00:00
|
|
|
const data = require('../../data');
|
2021-03-31 21:01:20 +00:00
|
|
|
const { navigateToLogin, login, checkServer } = require('../../helpers/app');
|
2019-09-16 20:26:32 +00:00
|
|
|
|
2021-03-18 13:18:33 +00:00
|
|
|
const reopenAndCheckServer = async(server) => {
|
|
|
|
await device.launchApp({ permissions: { notifications: 'YES' } });
|
2021-09-15 16:44:53 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().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', () => {
|
|
|
|
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);
|
2018-08-10 17:26:36 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(10000);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
2021-09-15 16:44: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();
|
|
|
|
await waitFor(element(by.id('rooms-list-header-server-dropdown'))).toBeVisible().withTimeout(5000);
|
2021-09-15 16:44: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-15 16:44: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-03-18 13:18:33 +00:00
|
|
|
await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(6000);
|
2021-07-02 17:39:39 +00:00
|
|
|
await element(by.id('new-server-view-input')).typeText(`${ data.alternateServer }\n`);
|
2021-04-19 14:31:43 +00:00
|
|
|
await waitFor(element(by.id('workspace-view'))).toBeVisible().withTimeout(10000);
|
2021-03-18 13:18:33 +00:00
|
|
|
await reopenAndCheckServer(data.server);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should add server and create new user', async() => {
|
|
|
|
await element(by.id('rooms-list-header-server-dropdown-button')).tap();
|
|
|
|
await waitFor(element(by.id('rooms-list-header-server-dropdown'))).toBeVisible().withTimeout(5000);
|
|
|
|
await element(by.id(`rooms-list-header-server-${ data.alternateServer }`)).tap();
|
2020-05-20 16:33:40 +00:00
|
|
|
await waitFor(element(by.id('workspace-view'))).toBeVisible().withTimeout(60000);
|
|
|
|
await element(by.id('workspace-view-register')).tap();
|
2018-05-23 13:39:18 +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();
|
|
|
|
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(60000);
|
2020-05-20 16:33:40 +00:00
|
|
|
|
2021-03-18 13:18:33 +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-03-18 13:18:33 +00:00
|
|
|
it('should reopen the app and show alternate server', async() => {
|
|
|
|
await reopenAndCheckServer(data.alternateServer);
|
|
|
|
});
|
|
|
|
|
|
|
|
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();
|
|
|
|
await waitFor(element(by.id('rooms-list-header-server-dropdown'))).toBeVisible().withTimeout(5000);
|
2018-08-31 16:46:33 +00:00
|
|
|
await element(by.id(`rooms-list-header-server-${ data.server }`)).tap();
|
2018-05-23 13:39:18 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(10000);
|
2021-03-18 13:18:33 +00:00
|
|
|
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
|
|
|
|
|
|
|
it('should reopen the app and show main server', async() => {
|
|
|
|
await reopenAndCheckServer(data.server);
|
2021-07-02 17:39:39 +00:00
|
|
|
});
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|