2023-03-07 12:28:51 +00:00
|
|
|
import { device, waitFor, element, by, expect } from 'detox';
|
2022-09-12 14:51:33 +00:00
|
|
|
|
|
|
|
import { login, navigateToLogin, logout, tapBack, searchRoom } from '../../helpers/app';
|
2023-03-07 12:28:51 +00:00
|
|
|
import { createRandomUser } from '../../helpers/data_setup';
|
2018-05-23 13:39:18 +00:00
|
|
|
|
|
|
|
describe('Rooms list screen', () => {
|
2023-03-07 12:28:51 +00:00
|
|
|
beforeAll(async () => {
|
|
|
|
const user = await createRandomUser();
|
2020-07-22 16:32:21 +00:00
|
|
|
await device.launchApp({ permissions: { notifications: 'YES' }, newInstance: true, delete: true });
|
|
|
|
await navigateToLogin();
|
2023-03-07 12:28:51 +00:00
|
|
|
await login(user.username, user.password);
|
2020-07-22 16:32:21 +00:00
|
|
|
});
|
|
|
|
|
2020-05-20 16:33:40 +00:00
|
|
|
describe('Render', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have rooms list screen', async () => {
|
2018-05-23 13:39:18 +00:00
|
|
|
await expect(element(by.id('rooms-list-view'))).toBeVisible();
|
2020-03-03 20:27:38 +00:00
|
|
|
});
|
2018-05-23 13:39:18 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have room item', async () => {
|
2021-12-02 13:19:15 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view-item-general')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(10000);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
2021-07-02 17:39:39 +00:00
|
|
|
|
2018-05-23 13:39:18 +00:00
|
|
|
// Render - Header
|
2020-05-20 16:33:40 +00:00
|
|
|
describe('Header', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have create channel button', async () => {
|
2018-05-23 13:39:18 +00:00
|
|
|
await expect(element(by.id('rooms-list-view-create-channel'))).toBeVisible();
|
|
|
|
});
|
2021-07-02 17:39:39 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have sidebar button', async () => {
|
2018-05-23 13:39:18 +00:00
|
|
|
await expect(element(by.id('rooms-list-view-sidebar'))).toBeVisible();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-05-20 16:33:40 +00:00
|
|
|
describe('Usage', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should search room and navigate', async () => {
|
2020-07-06 20:56:28 +00:00
|
|
|
await searchRoom('rocket.cat');
|
2018-05-23 13:39:18 +00:00
|
|
|
await element(by.id('rooms-list-view-item-rocket.cat')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('room-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(10000);
|
|
|
|
await waitFor(element(by.id('room-view-title-rocket.cat')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(60000);
|
2018-10-23 21:39:48 +00:00
|
|
|
await tapBack();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view')))
|
|
|
|
.toBeVisible()
|
2022-05-26 17:10:24 +00:00
|
|
|
.withTimeout(6000);
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view-item-rocket.cat')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(60000);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should logout', async () => {
|
2020-05-20 16:33:40 +00:00
|
|
|
await logout();
|
2018-08-31 16:46:33 +00:00
|
|
|
});
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
});
|