2023-03-07 12:28:51 +00:00
|
|
|
import { device, waitFor, element, by, expect } from 'detox';
|
2022-09-12 14:51:33 +00:00
|
|
|
|
2023-03-07 12:28:51 +00:00
|
|
|
import { login, navigateToLogin, logout, tapBack, tapAndWaitFor } from '../../helpers/app';
|
2022-09-12 14:51:33 +00:00
|
|
|
import data from '../../data';
|
2023-03-07 12:28:51 +00:00
|
|
|
import { createRandomUser, ITestUser } from '../../helpers/data_setup';
|
2020-09-11 17:10:16 +00:00
|
|
|
|
|
|
|
describe('Server history', () => {
|
2023-03-07 12:28:51 +00:00
|
|
|
let user: ITestUser;
|
|
|
|
beforeAll(async () => {
|
|
|
|
user = await createRandomUser();
|
2020-09-11 17:10:16 +00:00
|
|
|
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('Usage', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should login, save server as history and logout', async () => {
|
2020-09-11 17:10:16 +00:00
|
|
|
await navigateToLogin();
|
2023-03-07 12:28:51 +00:00
|
|
|
await login(user.username, user.password);
|
2020-09-11 17:10:16 +00:00
|
|
|
await logout();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('new-server-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(60000);
|
2021-07-02 17:39:39 +00:00
|
|
|
});
|
2020-09-11 17:10:16 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should show servers history', async () => {
|
2020-09-11 17:10:16 +00:00
|
|
|
await element(by.id('new-server-view-input')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id(`server-history-${data.server}`)))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-09-11 17:10:16 +00:00
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should tap on a server history and navigate to login', async () => {
|
|
|
|
await element(by.id(`server-history-${data.server}`)).tap();
|
2021-12-02 13:19:15 +00:00
|
|
|
await waitFor(element(by.id('login-view-email')))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(5000);
|
2023-03-07 12:28:51 +00:00
|
|
|
await expect(element(by.label(user.username).withAncestor(by.id('login-view-email'))));
|
2020-09-11 17:10:16 +00:00
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should delete server from history', async () => {
|
2020-09-11 17:10:16 +00:00
|
|
|
await tapBack();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('workspace-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-09-11 17:10:16 +00:00
|
|
|
await tapBack();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('new-server-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2023-03-07 12:28:51 +00:00
|
|
|
await tapAndWaitFor(element(by.id('new-server-view-input')), element(by.id(`server-history-${data.server}`)), 2000);
|
2021-09-13 20:41:05 +00:00
|
|
|
await element(by.id(`server-history-delete-${data.server}`)).tap();
|
2020-09-11 17:10:16 +00:00
|
|
|
await element(by.id('new-server-view-input')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id(`server-history-${data.server}`)))
|
|
|
|
.toBeNotVisible()
|
|
|
|
.withTimeout(2000);
|
2020-09-11 17:10:16 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|