2023-03-07 12:28:51 +00:00
|
|
|
import { device, waitFor, element, by } from 'detox';
|
|
|
|
|
2022-09-12 14:51:33 +00:00
|
|
|
import { navigateToLogin, login, platformTypes, TTextMatcher } from '../../helpers/app';
|
2023-03-07 12:28:51 +00:00
|
|
|
import { createRandomUser, ITestUser } from '../../helpers/data_setup';
|
2021-03-18 13:29:38 +00:00
|
|
|
|
|
|
|
describe('Group DM', () => {
|
2022-09-12 14:51:33 +00:00
|
|
|
let textMatcher: TTextMatcher;
|
2023-03-07 12:28:51 +00:00
|
|
|
let otherUser: ITestUser;
|
|
|
|
beforeAll(async () => {
|
|
|
|
const user = await createRandomUser();
|
|
|
|
otherUser = await createRandomUser();
|
2021-03-18 13:29:38 +00:00
|
|
|
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
2021-12-02 13:19:15 +00:00
|
|
|
({ textMatcher } = platformTypes[device.getPlatform()]);
|
2021-03-18 13:29:38 +00:00
|
|
|
await navigateToLogin();
|
2023-03-07 12:28:51 +00:00
|
|
|
await login(user.username, user.password);
|
2021-03-18 13:29:38 +00:00
|
|
|
});
|
|
|
|
|
2021-07-02 17:39:39 +00:00
|
|
|
describe('Create Group DM', () => {
|
2023-03-07 12:28:51 +00:00
|
|
|
beforeAll(async () => {
|
2022-08-08 21:02:08 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view-create-channel')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
2021-03-18 13:29:38 +00:00
|
|
|
await element(by.id('rooms-list-view-create-channel')).tap();
|
|
|
|
});
|
|
|
|
|
2021-07-02 17:39:39 +00:00
|
|
|
describe('Render', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have new message screen', async () => {
|
|
|
|
await waitFor(element(by.id('new-message-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2021-03-18 13:29:38 +00:00
|
|
|
});
|
2021-07-02 17:39:39 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have search input', async () => {
|
|
|
|
await waitFor(element(by.id('new-message-view-search')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2021-03-18 13:29:38 +00:00
|
|
|
});
|
2021-07-02 17:39:39 +00:00
|
|
|
});
|
2021-03-18 13:29:38 +00:00
|
|
|
|
2021-07-02 17:39:39 +00:00
|
|
|
describe('Usage', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should navigate to create DM', async () => {
|
2022-08-26 19:16:45 +00:00
|
|
|
await element(by[textMatcher]('Direct message')).atIndex(0).tap();
|
2021-03-18 13:29:38 +00:00
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should add users', async () => {
|
2021-03-18 13:29:38 +00:00
|
|
|
await element(by.id('select-users-view-search')).replaceText('rocket.cat');
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('select-users-view-item-rocket.cat')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(10000);
|
2021-03-18 13:29:38 +00:00
|
|
|
await element(by.id('select-users-view-item-rocket.cat')).tap();
|
2023-03-07 12:28:51 +00:00
|
|
|
await element(by.id('select-users-view-search')).replaceText(otherUser.username);
|
|
|
|
await waitFor(element(by.id(`select-users-view-item-${otherUser.username}`)))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(10000);
|
2023-03-07 12:28:51 +00:00
|
|
|
await element(by.id(`select-users-view-item-${otherUser.username}`)).tap();
|
2021-03-18 13:29:38 +00:00
|
|
|
await element(by.id('selected-users-view-submit')).tap();
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('check Group DM exist', async () => {
|
2023-03-07 12:28:51 +00:00
|
|
|
await waitFor(element(by.id(`room-view-title-rocket.cat, ${otherUser.username}`)))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toExist()
|
|
|
|
.withTimeout(10000);
|
2021-03-18 13:29:38 +00:00
|
|
|
});
|
2021-07-02 17:39:39 +00:00
|
|
|
});
|
2021-03-18 13:29:38 +00:00
|
|
|
});
|
|
|
|
});
|