verdnatura-chat/e2e/06-roomslist.spec.js

82 lines
3.4 KiB
JavaScript
Raw Normal View History

2018-05-23 13:39:18 +00:00
const {
device, expect, element, by, waitFor
} = require('detox');
2020-03-03 20:27:38 +00:00
const { login, logout, navigateToLogin, tapBack, sleep } = require('./helpers/app');
2018-05-23 13:39:18 +00:00
const data = require('./data');
2020-05-14 16:01:13 +00:00
describe.skip('Rooms list screen', () => {
2020-05-14 15:55:03 +00:00
describe('Render', () => {
2018-05-23 13:39:18 +00:00
it('should have rooms list screen', async() => {
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
2020-03-03 20:27:38 +00:00
// it('should have rooms list', async() => {
// await expect(element(by.id('rooms-list-view-list'))).toBeVisible();
// });
2018-05-23 13:39:18 +00:00
2020-03-03 20:27:38 +00:00
it('should have room item', async() => {
await expect(element(by.id('rooms-list-view-item-general')).atIndex(0)).toExist();
2018-05-23 13:39:18 +00:00
});
// Render - Header
2020-05-14 15:55:03 +00:00
describe('Header', () => {
2018-05-23 13:39:18 +00:00
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();
// await expect(element(by.id('rooms-list-view-sidebar'))).toHaveLabel(`Connected to ${ data.server }. Tap to view servers list.`);
2018-05-23 13:39:18 +00:00
});
});
});
2020-05-14 15:55:03 +00:00
describe('Usage', () => {
2018-05-23 13:39:18 +00:00
it('should search room and navigate', async() => {
2020-03-03 20:27:38 +00:00
await element(by.type('UIScrollView')).atIndex(1).scrollTo('top');
await waitFor(element(by.id('rooms-list-view-search'))).toExist().withTimeout(2000);
2020-03-03 20:27:38 +00:00
await element(by.id('rooms-list-view-search')).typeText('rocket.cat');
2019-01-29 19:52:56 +00:00
await sleep(2000);
await waitFor(element(by.id('rooms-list-view-item-rocket.cat'))).toBeVisible().withTimeout(60000);
2018-05-23 13:39:18 +00:00
await expect(element(by.id('rooms-list-view-item-rocket.cat'))).toBeVisible();
await element(by.id('rooms-list-view-item-rocket.cat')).tap();
await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(10000);
await expect(element(by.id('room-view'))).toBeVisible();
2020-03-03 20:27:38 +00:00
await waitFor(element(by.id('room-view-title-rocket.cat'))).toBeVisible().withTimeout(60000);
await expect(element(by.id('room-view-title-rocket.cat'))).toBeVisible();
await tapBack();
2018-05-23 13:39:18 +00:00
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(2000);
await expect(element(by.id('rooms-list-view'))).toBeVisible();
2020-03-03 20:27:38 +00:00
// await element(by.id('rooms-list-view-search')).typeText('');
2019-01-29 19:52:56 +00:00
await sleep(2000);
await waitFor(element(by.id('rooms-list-view-item-rocket.cat'))).toExist().withTimeout(60000);
await expect(element(by.id('rooms-list-view-item-rocket.cat'))).toExist();
2018-05-23 13:39:18 +00:00
});
// Usage - Sidebar
2020-05-14 15:55:03 +00:00
describe('SidebarView', () => {
2018-05-23 13:39:18 +00:00
it('should navigate to add server', async() => {
await element(by.id('rooms-list-header-server-dropdown-button')).tap();
await waitFor(element(by.id('rooms-list-header-server-dropdown'))).toBeVisible().withTimeout(2000);
await expect(element(by.id('rooms-list-header-server-dropdown'))).toBeVisible();
await expect(element(by.id('rooms-list-header-server-add'))).toBeVisible();
await element(by.id('rooms-list-header-server-add')).tap();
2020-05-14 15:55:03 +00:00
await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(2000);
await expect(element(by.id('new-server-view'))).toBeVisible();
await element(by.id('new-server-view-close')).tap();
2018-05-23 13:39:18 +00:00
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(2000);
await expect(element(by.id('rooms-list-view'))).toBeVisible();
});
it('should logout', async() => {
2020-03-03 20:27:38 +00:00
await logout();
2018-05-23 13:39:18 +00:00
});
});
2020-05-14 15:55:03 +00:00
// afterAll(async() => {
// await navigateToLogin();
// await login();
// });
2018-05-23 13:39:18 +00:00
});
});