2023-01-25 19:03:02 +00:00
|
|
|
import { expect } from 'detox';
|
|
|
|
|
|
|
|
import { login, navigateToLogin, logout, tapBack, searchRoom } from '../../helpers/app';
|
2023-02-22 17:46:16 +00:00
|
|
|
import { createRandomUser } from '../../helpers/data_setup';
|
2023-01-25 19:03:02 +00:00
|
|
|
|
|
|
|
describe('Rooms list screen', () => {
|
|
|
|
beforeAll(async () => {
|
2023-02-22 17:46:16 +00:00
|
|
|
const user = await createRandomUser();
|
2023-01-25 19:03:02 +00:00
|
|
|
await device.launchApp({ permissions: { notifications: 'YES' }, newInstance: true, delete: true });
|
|
|
|
await navigateToLogin();
|
2023-02-22 17:46:16 +00:00
|
|
|
await login(user.username, user.password);
|
2023-01-25 19:03:02 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('Render', () => {
|
|
|
|
it('should have rooms list screen', async () => {
|
|
|
|
await expect(element(by.id('rooms-list-view'))).toBeVisible();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should have room item', async () => {
|
|
|
|
await waitFor(element(by.id('rooms-list-view-item-general')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(10000);
|
|
|
|
});
|
|
|
|
|
|
|
|
// Render - Header
|
|
|
|
describe('Header', () => {
|
|
|
|
it('should have create channel button', async () => {
|
|
|
|
await expect(element(by.id('rooms-list-view-create-channel'))).toBeVisible();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should have sidebar button', async () => {
|
|
|
|
await expect(element(by.id('rooms-list-view-sidebar'))).toBeVisible();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('Usage', () => {
|
|
|
|
it('should search room and navigate', async () => {
|
|
|
|
await searchRoom('rocket.cat');
|
|
|
|
await element(by.id('rooms-list-view-item-rocket.cat')).tap();
|
|
|
|
await waitFor(element(by.id('room-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(10000);
|
|
|
|
await waitFor(element(by.id('room-view-title-rocket.cat')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(60000);
|
|
|
|
await tapBack();
|
|
|
|
await waitFor(element(by.id('rooms-list-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(6000);
|
|
|
|
await waitFor(element(by.id('rooms-list-view-item-rocket.cat')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(60000);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should logout', async () => {
|
|
|
|
await logout();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|