2021-03-18 17:02:58 +00:00
|
|
|
const data = require('../../data');
|
2021-12-02 13:19:15 +00:00
|
|
|
const { sleep, navigateToLogin, login, checkServer, platformTypes } = require('../../helpers/app');
|
2021-03-18 17:02:58 +00:00
|
|
|
|
|
|
|
describe('Delete server', () => {
|
2021-12-02 13:19:15 +00:00
|
|
|
let alertButtonType;
|
|
|
|
let textMatcher;
|
2021-09-13 20:41:05 +00:00
|
|
|
before(async () => {
|
2021-03-18 17:02:58 +00:00
|
|
|
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
2021-12-02 13:19:15 +00:00
|
|
|
({ alertButtonType, textMatcher } = platformTypes[device.getPlatform()]);
|
2021-03-18 17:02:58 +00:00
|
|
|
await navigateToLogin();
|
|
|
|
await login(data.users.regular.username, data.users.regular.password);
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should be logged in main server', async () => {
|
2021-03-18 17:02:58 +00:00
|
|
|
await checkServer(data.server);
|
2021-07-02 17:39:39 +00:00
|
|
|
});
|
2021-03-18 17:02:58 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should add server', async () => {
|
2021-03-18 17:02:58 +00:00
|
|
|
await sleep(5000);
|
|
|
|
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-03-18 17:02:58 +00:00
|
|
|
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(10000);
|
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 17:02:58 +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);
|
2021-03-18 17:02:58 +00:00
|
|
|
|
|
|
|
// Register new user
|
2021-04-01 19:27:46 +00:00
|
|
|
await element(by.id('register-view-name')).replaceText(data.registeringUser3.username);
|
|
|
|
await element(by.id('register-view-username')).replaceText(data.registeringUser3.username);
|
|
|
|
await element(by.id('register-view-email')).replaceText(data.registeringUser3.email);
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by.id('register-view-password')).replaceText(data.registeringUser3.password);
|
2021-03-18 17:02:58 +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);
|
2021-03-18 17:02:58 +00:00
|
|
|
|
|
|
|
await checkServer(data.alternateServer);
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should delete server', async () => {
|
2021-03-18 17:02:58 +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}`)).longPress(1500);
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by[textMatcher]('Delete').and(by.type(alertButtonType))).tap();
|
2021-03-18 17:02:58 +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 waitFor(element(by.id(`rooms-list-header-server-${data.server}`)))
|
|
|
|
.toBeNotVisible()
|
|
|
|
.withTimeout(10000);
|
2021-03-18 17:02:58 +00:00
|
|
|
});
|
|
|
|
});
|