verdnatura-chat/e2e/tests/onboarding/06-roomslist.spec.ts

61 lines
1.8 KiB
TypeScript
Raw Permalink Normal View History

2023-03-07 12:28:51 +00:00
import { device, waitFor, element, by, expect } from 'detox';
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();
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);
});
describe('Render', () => {
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
it('should have room item', async () => {
await waitFor(element(by.id('rooms-list-view-item-general')))
.toExist()
.withTimeout(10000);
2018-05-23 13:39:18 +00:00
});
2018-05-23 13:39:18 +00:00
// Render - Header
describe('Header', () => {
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();
});
it('should have sidebar button', async () => {
2018-05-23 13:39:18 +00:00
await expect(element(by.id('rooms-list-view-sidebar'))).toBeVisible();
});
});
});
describe('Usage', () => {
it('should search room and navigate', async () => {
await searchRoom('rocket.cat');
2018-05-23 13:39:18 +00:00
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);
2018-05-23 13:39:18 +00:00
});
it('should logout', async () => {
await logout();
});
2018-05-23 13:39:18 +00:00
});
});