2023-01-25 19:03:02 +00:00
|
|
|
import data from '../../data';
|
|
|
|
import { navigateToLogin, login, tapBack, sleep } from '../../helpers/app';
|
2023-02-22 17:46:16 +00:00
|
|
|
import { createRandomTeam, createRandomUser, ITestUser, sendMessage } from '../../helpers/data_setup';
|
2023-02-22 14:03:29 +00:00
|
|
|
import random from '../../helpers/random';
|
2023-01-25 19:03:02 +00:00
|
|
|
|
|
|
|
async function navigateToRoom(search: string) {
|
|
|
|
await element(by.id('directory-view-search')).replaceText(search);
|
|
|
|
await waitFor(element(by.id(`directory-view-item-${search}`)))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(10000);
|
|
|
|
await sleep(300); // app takes some time to animate
|
|
|
|
await element(by.id(`directory-view-item-${search}`)).tap();
|
|
|
|
await waitFor(element(by.id('room-view')).atIndex(0))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(5000);
|
|
|
|
await waitFor(element(by.id(`room-view-title-${search}`)))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(5000);
|
|
|
|
}
|
|
|
|
|
|
|
|
describe('Join room from directory', () => {
|
2023-02-22 17:46:16 +00:00
|
|
|
let user: ITestUser;
|
|
|
|
let otherUser: ITestUser;
|
2023-02-22 14:03:29 +00:00
|
|
|
let team: string;
|
|
|
|
|
2023-01-25 19:03:02 +00:00
|
|
|
beforeAll(async () => {
|
2023-02-22 14:03:29 +00:00
|
|
|
user = await createRandomUser();
|
|
|
|
otherUser = await createRandomUser();
|
|
|
|
team = await createRandomTeam(user);
|
|
|
|
|
2023-01-25 19:03:02 +00:00
|
|
|
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
|
|
|
await navigateToLogin();
|
2023-02-22 14:03:29 +00:00
|
|
|
await login(user.username, user.password);
|
2023-01-25 19:03:02 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('Usage', () => {
|
2023-02-22 14:03:29 +00:00
|
|
|
const thread = `${random()}thread`;
|
2023-01-25 19:03:02 +00:00
|
|
|
beforeAll(async () => {
|
2023-02-22 14:03:29 +00:00
|
|
|
const result = await sendMessage(user, data.channels.detoxpublic.name, thread);
|
2023-01-25 19:03:02 +00:00
|
|
|
const threadId = result.message._id;
|
2023-02-22 14:03:29 +00:00
|
|
|
await sendMessage(user, result.message.rid, 'insidethread', threadId);
|
2023-01-25 19:03:02 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should tap directory', async () => {
|
|
|
|
await element(by.id('rooms-list-view-directory')).tap();
|
|
|
|
await waitFor(element(by.id('directory-view')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search public channel and navigate', async () => {
|
|
|
|
await navigateToRoom(data.channels.detoxpublic.name);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should navigate to thread messages view and load messages', async () => {
|
|
|
|
await waitFor(element(by.id('room-view-header-threads')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await element(by.id('room-view-header-threads')).tap();
|
2023-02-22 14:03:29 +00:00
|
|
|
await waitFor(element(by.id(`thread-messages-view-${thread}`)))
|
2023-01-25 19:03:02 +00:00
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await tapBack();
|
|
|
|
await waitFor(element(by.id('room-view-header-threads')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search user and navigate', async () => {
|
|
|
|
await tapBack();
|
|
|
|
await element(by.id('rooms-list-view-directory')).tap();
|
|
|
|
await waitFor(element(by.id('directory-view')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await element(by.id('directory-view-dropdown')).tap();
|
|
|
|
await element(by.label('Users')).atIndex(0).tap();
|
|
|
|
await element(by.label('Search by')).atIndex(0).tap();
|
2023-02-22 14:03:29 +00:00
|
|
|
await navigateToRoom(otherUser.username);
|
2023-01-25 19:03:02 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should search team and navigate', async () => {
|
|
|
|
await tapBack();
|
|
|
|
await element(by.id('rooms-list-view-directory')).tap();
|
|
|
|
await waitFor(element(by.id('directory-view')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await element(by.id('directory-view-dropdown')).tap();
|
|
|
|
await element(by.label('Teams')).atIndex(0).tap();
|
|
|
|
await element(by.label('Search by')).atIndex(0).tap();
|
2023-02-22 14:03:29 +00:00
|
|
|
await navigateToRoom(team);
|
2023-01-25 19:03:02 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|