2018-05-23 13:39:18 +00:00
|
|
|
const {
|
|
|
|
device, expect, element, by, waitFor
|
|
|
|
} = require('detox');
|
|
|
|
const { takeScreenshot } = require('./helpers/screenshot');
|
2018-07-10 13:40:32 +00:00
|
|
|
const { login, navigateToLogin, tapBack } = require('./helpers/app');
|
2018-05-23 13:39:18 +00:00
|
|
|
const data = require('./data');
|
|
|
|
|
|
|
|
describe('Rooms list screen', () => {
|
|
|
|
describe('Render', async() => {
|
|
|
|
it('should have rooms list screen', async() => {
|
|
|
|
await expect(element(by.id('rooms-list-view'))).toBeVisible();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should have rooms list', async() => {
|
|
|
|
await expect(element(by.id('rooms-list-view-list'))).toBeVisible();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should have room item', async() => {
|
|
|
|
await expect(element(by.id('rooms-list-view-item-general'))).toExist();
|
|
|
|
});
|
|
|
|
|
|
|
|
// Render - Header
|
|
|
|
describe('Header', async() => {
|
|
|
|
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();
|
2018-07-10 13:40:32 +00:00
|
|
|
// 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
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
after(async() => {
|
|
|
|
takeScreenshot();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('Usage', async() => {
|
|
|
|
it('should search room and navigate', async() => {
|
|
|
|
await element(by.id('rooms-list-view-list')).swipe('down');
|
|
|
|
await waitFor(element(by.id('rooms-list-view-search'))).toBeVisible().withTimeout(2000);
|
|
|
|
await expect(element(by.id('rooms-list-view-search'))).toBeVisible();
|
|
|
|
await element(by.id('rooms-list-view-search')).replaceText('rocket.cat');
|
2018-05-29 17:09:20 +00:00
|
|
|
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();
|
2018-07-10 13:40:32 +00:00
|
|
|
await waitFor(element(by.text('rocket.cat'))).toBeVisible().withTimeout(60000);
|
|
|
|
await expect(element(by.text('rocket.cat'))).toBeVisible();
|
|
|
|
await tapBack('Messages');
|
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();
|
2018-05-29 17:09:20 +00:00
|
|
|
await element(by.id('rooms-list-view-search')).replaceText('');
|
|
|
|
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
|
|
|
|
describe('Sidebar', async() => {
|
|
|
|
it('should navigate to add server', async() => {
|
2018-08-31 16:46:33 +00:00
|
|
|
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();
|
2018-05-23 13:39:18 +00:00
|
|
|
await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(2000);
|
|
|
|
await expect(element(by.id('new-server-view'))).toBeVisible();
|
2018-08-10 17:26:36 +00:00
|
|
|
await element(by.text('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() => {
|
|
|
|
await element(by.id('rooms-list-view-sidebar')).tap();
|
|
|
|
await waitFor(element(by.id('sidebar'))).toBeVisible().withTimeout(2000);
|
2018-06-05 01:17:02 +00:00
|
|
|
await waitFor(element(by.id('sidebar-logout'))).toBeVisible().withTimeout(2000);
|
2018-05-23 13:39:18 +00:00
|
|
|
await element(by.id('sidebar-logout')).tap();
|
2018-08-10 17:26:36 +00:00
|
|
|
await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(60000);
|
|
|
|
await expect(element(by.id('onboarding-view'))).toBeVisible();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(async() => {
|
|
|
|
takeScreenshot();
|
|
|
|
});
|
2018-08-10 17:26:36 +00:00
|
|
|
|
|
|
|
after(async() => {
|
|
|
|
await navigateToLogin();
|
|
|
|
await login();
|
2018-08-31 16:46:33 +00:00
|
|
|
});
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
});
|