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