Rocket.Chat.ReactNative/e2e/tests/room/06-createdmgroup.spec.ts

67 lines
2.2 KiB
TypeScript
Raw Permalink Normal View History

2023-03-07 12:28:51 +00:00
import { device, waitFor, element, by } from 'detox';
import { navigateToLogin, login, platformTypes, TTextMatcher } from '../../helpers/app';
2023-03-07 12:28:51 +00:00
import { createRandomUser, ITestUser } from '../../helpers/data_setup';
describe('Group DM', () => {
let textMatcher: TTextMatcher;
2023-03-07 12:28:51 +00:00
let otherUser: ITestUser;
beforeAll(async () => {
const user = await createRandomUser();
otherUser = await createRandomUser();
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
({ textMatcher } = platformTypes[device.getPlatform()]);
await navigateToLogin();
2023-03-07 12:28:51 +00:00
await login(user.username, user.password);
});
describe('Create Group DM', () => {
2023-03-07 12:28:51 +00:00
beforeAll(async () => {
await waitFor(element(by.id('rooms-list-view-create-channel')))
.toExist()
.withTimeout(2000);
await element(by.id('rooms-list-view-create-channel')).tap();
});
describe('Render', () => {
it('should have new message screen', async () => {
await waitFor(element(by.id('new-message-view')))
.toBeVisible()
.withTimeout(2000);
});
it('should have search input', async () => {
await waitFor(element(by.id('new-message-view-search')))
.toBeVisible()
.withTimeout(2000);
});
});
describe('Usage', () => {
it('should navigate to create DM', async () => {
await element(by[textMatcher]('Direct message')).atIndex(0).tap();
});
it('should add users', async () => {
await element(by.id('select-users-view-search')).replaceText('rocket.cat');
await waitFor(element(by.id('select-users-view-item-rocket.cat')))
.toBeVisible()
.withTimeout(10000);
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}`)))
.toBeVisible()
.withTimeout(10000);
2023-03-07 12:28:51 +00:00
await element(by.id(`select-users-view-item-${otherUser.username}`)).tap();
await element(by.id('selected-users-view-submit')).tap();
});
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}`)))
.toExist()
.withTimeout(10000);
});
});
});
});