first iteration

This commit is contained in:
Diego Mello 2023-02-22 17:54:30 -03:00
parent ae0c55ac21
commit d2aa631b37
7 changed files with 90 additions and 161 deletions

View File

@ -1,35 +1,28 @@
import { expect } from 'detox'; import { expect } from 'detox';
import data from '../../data'; import { navigateToLogin, login, sleep, platformTypes, TTextMatcher, navigateToRoom } from '../../helpers/app';
import { navigateToLogin, login, searchRoom, sleep, platformTypes, TTextMatcher } from '../../helpers/app'; import { createRandomUser, ITestUser, sendMessage } from '../../helpers/data_setup';
import { sendMessage } from '../../helpers/data_setup';
async function navigateToRoom(user: string) {
await searchRoom(`${user}`);
await element(by.id(`rooms-list-view-item-${user}`)).tap();
await waitFor(element(by.id('room-view')))
.toBeVisible()
.withTimeout(5000);
}
describe('Mark as unread', () => { describe('Mark as unread', () => {
const user = data.users.alternate.username; let user: ITestUser;
let otherUser: ITestUser;
let textMatcher: TTextMatcher; let textMatcher: TTextMatcher;
beforeAll(async () => { beforeAll(async () => {
user = await createRandomUser();
otherUser = await createRandomUser();
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true }); await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
({ textMatcher } = platformTypes[device.getPlatform()]); ({ textMatcher } = platformTypes[device.getPlatform()]);
await navigateToLogin(); await navigateToLogin();
await login(data.users.regular.username, data.users.regular.password); await login(user.username, user.password);
await navigateToRoom(user); await navigateToRoom(otherUser.username);
}); });
describe('Usage', () => { describe('Usage', () => {
describe('Mark message as unread', () => { describe('Mark message as unread', () => {
it('should mark message as unread', async () => { it('should mark message as unread', async () => {
const message = `${data.random}message-mark-as-unread`; const message = 'message-mark-as-unread';
const channelName = `@${data.users.regular.username}`; await sendMessage(otherUser, `@${user.username}`, message);
await sendMessage(data.users.alternate, channelName, message);
await waitFor(element(by[textMatcher](message)).atIndex(0)) await waitFor(element(by[textMatcher](message)).atIndex(0))
.toExist() .toExist()
.withTimeout(30000); .withTimeout(30000);
@ -43,7 +36,7 @@ describe('Mark as unread', () => {
await waitFor(element(by.id('rooms-list-view'))) await waitFor(element(by.id('rooms-list-view')))
.toExist() .toExist()
.withTimeout(5000); .withTimeout(5000);
await expect(element(by.id(`rooms-list-view-item-${data.users.alternate.username}`))).toExist(); await expect(element(by.id(`rooms-list-view-item-${otherUser.username}`))).toExist();
}); });
}); });
}); });

View File

@ -1,22 +1,10 @@
import { expect } from 'detox'; import { expect } from 'detox';
import data from '../../data'; import { navigateToLogin, login, tapBack, sleep, platformTypes, TTextMatcher, navigateToRoom } from '../../helpers/app';
import { navigateToLogin, login, tapBack, sleep, searchRoom, platformTypes, TTextMatcher } from '../../helpers/app'; import { createRandomRoom, createRandomUser, ITestUser } from '../../helpers/data_setup';
const privateRoomName = data.groups.private.name; async function navigateToRoomInfo(room: string) {
await navigateToRoom(room);
async function navigateToRoomInfo(type: string) {
let room;
if (type === 'd') {
room = 'rocket.cat';
} else {
room = privateRoomName;
}
await searchRoom(room);
await element(by.id(`rooms-list-view-item-${room}`)).tap();
await waitFor(element(by.id('room-view')))
.toExist()
.withTimeout(2000);
await element(by.id('room-header')).tap(); await element(by.id('room-header')).tap();
await waitFor(element(by.id('room-actions-view'))) await waitFor(element(by.id('room-actions-view')))
.toExist() .toExist()
@ -38,33 +26,20 @@ async function waitForToast() {
describe('Room info screen', () => { describe('Room info screen', () => {
let alertButtonType: string; let alertButtonType: string;
let textMatcher: TTextMatcher; let textMatcher: TTextMatcher;
let room: string;
let user: ITestUser;
beforeAll(async () => { beforeAll(async () => {
user = await createRandomUser();
({ name: room } = await createRandomRoom(user, 'p'));
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true }); await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
({ alertButtonType, textMatcher } = platformTypes[device.getPlatform()]); ({ alertButtonType, textMatcher } = platformTypes[device.getPlatform()]);
await navigateToLogin(); await navigateToLogin();
await login(data.users.regular.username, data.users.regular.password); await login(user.username, user.password);
});
describe('Direct', () => {
beforeAll(async () => {
await navigateToRoomInfo('d');
});
it('should navigate to room info', async () => {
await expect(element(by.id('room-info-view'))).toExist();
await expect(element(by.id('room-info-view-name'))).toExist();
});
afterAll(async () => {
await tapBack();
await tapBack();
await tapBack();
});
}); });
describe('Channel/Group', () => { describe('Channel/Group', () => {
beforeAll(async () => { beforeAll(async () => {
await navigateToRoomInfo('c'); await navigateToRoomInfo(room);
}); });
describe('Render', () => { describe('Render', () => {
@ -175,7 +150,7 @@ describe('Room info screen', () => {
await element(by.id('room-info-edit-view-react-when-ro')).tap(); await element(by.id('room-info-edit-view-react-when-ro')).tap();
await element(by.id('room-info-edit-view-reset')).tap(); await element(by.id('room-info-edit-view-reset')).tap();
// after reset // after reset
await expect(element(by.id('room-info-edit-view-name'))).toHaveText(privateRoomName); await expect(element(by.id('room-info-edit-view-name'))).toHaveText(room);
await expect(element(by.id('room-info-edit-view-description'))).toHaveText(''); await expect(element(by.id('room-info-edit-view-description'))).toHaveText('');
await expect(element(by.id('room-info-edit-view-topic'))).toHaveText(''); await expect(element(by.id('room-info-edit-view-topic'))).toHaveText('');
await expect(element(by.id('room-info-edit-view-announcement'))).toHaveText(''); await expect(element(by.id('room-info-edit-view-announcement'))).toHaveText('');
@ -187,7 +162,7 @@ describe('Room info screen', () => {
}); });
it('should change room name', async () => { it('should change room name', async () => {
await element(by.id('room-info-edit-view-name')).replaceText(`${privateRoomName}new`); await element(by.id('room-info-edit-view-name')).replaceText(`${room}new`);
await swipe('down'); // dismiss keyboard await swipe('down'); // dismiss keyboard
await swipe('up'); await swipe('up');
await element(by.id('room-info-edit-view-submit')).tap(); await element(by.id('room-info-edit-view-submit')).tap();
@ -198,7 +173,7 @@ describe('Room info screen', () => {
.withTimeout(2000); .withTimeout(2000);
const matcher = device.getPlatform() === 'android' ? 'toHaveText' : 'toHaveLabel'; const matcher = device.getPlatform() === 'android' ? 'toHaveText' : 'toHaveLabel';
await waitFor(element(by.id('room-info-view-name'))) await waitFor(element(by.id('room-info-view-name')))
[matcher](`${privateRoomName}new`) [matcher](`${room}new`)
.withTimeout(10000); .withTimeout(10000);
await element(by.id('room-info-view-edit-button')).tap(); await element(by.id('room-info-view-edit-button')).tap();
await waitFor(element(by.id('room-info-edit-view'))) await waitFor(element(by.id('room-info-edit-view')))
@ -207,7 +182,7 @@ describe('Room info screen', () => {
}); });
it('should change room description, topic, announcement', async () => { it('should change room description, topic, announcement', async () => {
await sleep(3000); // wait for changes to be applied from socket await sleep(5000); // wait for changes to be applied from socket
await element(by.id('room-info-edit-view-description')).replaceText('new description'); await element(by.id('room-info-edit-view-description')).replaceText('new description');
await element(by.id('room-info-edit-view-topic')).replaceText('new topic'); await element(by.id('room-info-edit-view-topic')).replaceText('new topic');
await element(by.id('room-info-edit-view-announcement')).replaceText('new announcement'); await element(by.id('room-info-edit-view-announcement')).replaceText('new announcement');
@ -273,7 +248,7 @@ describe('Room info screen', () => {
.toExist() .toExist()
.withTimeout(5000); .withTimeout(5000);
await element(by[textMatcher]('Yes, delete it!').and(by.type(alertButtonType))).tap(); await element(by[textMatcher]('Yes, delete it!').and(by.type(alertButtonType))).tap();
await waitFor(element(by.id(`rooms-list-view-item-${privateRoomName}new`))) await waitFor(element(by.id(`rooms-list-view-item-${room}new`)))
.not.toBeVisible() .not.toBeVisible()
.withTimeout(60000); .withTimeout(60000);
}); });

View File

@ -1,18 +1,7 @@
import { expect } from 'detox'; import { expect } from 'detox';
import data from '../../data'; import data from '../../data';
import { navigateToLogin, tapBack, login, searchRoom, sleep, platformTypes, TTextMatcher } from '../../helpers/app'; import { navigateToLogin, tapBack, login, sleep, platformTypes, TTextMatcher, navigateToRoom } from '../../helpers/app';
async function navigateToRoom(roomName: string) {
await searchRoom(`${roomName}`);
await element(by.id(`rooms-list-view-item-${roomName}`)).tap();
await waitFor(element(by.id('room-view')))
.toBeVisible()
.withTimeout(5000);
await waitFor(element(by.id(`room-view-title-${roomName}`)))
.toExist()
.withTimeout(5000);
}
let textMatcher: TTextMatcher; let textMatcher: TTextMatcher;
let alertButtonType: string; let alertButtonType: string;

View File

@ -4,23 +4,15 @@ import data from '../../data';
import { import {
navigateToLogin, navigateToLogin,
login, login,
searchRoom,
sleep, sleep,
platformTypes, platformTypes,
TTextMatcher, TTextMatcher,
tapBack, tapBack,
tapAndWaitFor, tapAndWaitFor,
checkRoomTitle checkRoomTitle,
navigateToRoom
} from '../../helpers/app'; } from '../../helpers/app';
import { sendMessage } from '../../helpers/data_setup'; import { createRandomRoom, createRandomUser, ITestUser, sendMessage } from '../../helpers/data_setup';
async function navigateToRoom(user: string) {
await searchRoom(`${user}`);
await element(by.id(`rooms-list-view-item-${user}`)).tap();
await waitFor(element(by.id('room-view')))
.toBeVisible()
.withTimeout(5000);
}
async function navigateToInfoView() { async function navigateToInfoView() {
await element(by.id('room-header')).tap(); await element(by.id('room-header')).tap();
@ -34,20 +26,25 @@ async function navigateToInfoView() {
} }
describe('Ignore/Block User', () => { describe('Ignore/Block User', () => {
const user = data.users.alternate.username; let user: ITestUser;
let otherUser: ITestUser;
let room: string;
let textMatcher: TTextMatcher; let textMatcher: TTextMatcher;
beforeAll(async () => { beforeAll(async () => {
user = await createRandomUser();
otherUser = await createRandomUser();
({ name: room } = await createRandomRoom(user));
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true }); await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
({ textMatcher } = platformTypes[device.getPlatform()]); ({ textMatcher } = platformTypes[device.getPlatform()]);
await navigateToLogin(); await navigateToLogin();
await login(data.users.regular.username, data.users.regular.password); await login(user.username, user.password);
}); });
describe('Usage', () => { describe('Usage', () => {
describe('Block user from DM', () => { describe('Block user from DM', () => {
it('should go to user info view', async () => { it('should go to user info view', async () => {
await navigateToRoom(user); await navigateToRoom(otherUser.username);
await navigateToInfoView(); await navigateToInfoView();
}); });
it('should block user', async () => { it('should block user', async () => {
@ -86,15 +83,14 @@ describe('Ignore/Block User', () => {
}); });
}); });
describe('Ignore user from Message', () => { describe('Ignore user from Message', () => {
const channelName = data.userRegularChannels.detoxpublic.name;
it('should ignore user from message', async () => { it('should ignore user from message', async () => {
await navigateToRoom(channelName); await navigateToRoom(room);
await sendMessage(data.users.alternate, channelName, 'message-01'); await sendMessage(otherUser, room, 'message-01');
await sendMessage(data.users.alternate, channelName, 'message-02'); await sendMessage(otherUser, room, 'message-02');
await waitFor(element(by[textMatcher](user)).atIndex(0)) await waitFor(element(by[textMatcher](otherUser.username)).atIndex(0))
.toExist() .toExist()
.withTimeout(30000); .withTimeout(30000);
await element(by[textMatcher](user)).atIndex(0).tap(); await element(by[textMatcher](otherUser.username)).atIndex(0).tap();
await sleep(300); // wait for navigation animation await sleep(300); // wait for navigation animation
await waitFor(element(by.id('room-info-view-ignore').withDescendant(by[textMatcher]('Ignore')))) await waitFor(element(by.id('room-info-view-ignore').withDescendant(by[textMatcher]('Ignore'))))
.toExist() .toExist()
@ -107,16 +103,16 @@ describe('Ignore/Block User', () => {
}); });
it('should tap to display message', async () => { it('should tap to display message', async () => {
await checkRoomTitle(channelName); await checkRoomTitle(room);
await waitFor(element(by[textMatcher]('Message ignored. Tap to display it.')).atIndex(0)) await waitFor(element(by[textMatcher]('Message ignored. Tap to display it.')).atIndex(0))
.toBeVisible() .toBeVisible()
.withTimeout(2000); .withTimeout(2000);
await tapAndWaitFor( await tapAndWaitFor(
element(by[textMatcher]('Message ignored. Tap to display it.')).atIndex(0), element(by[textMatcher]('Message ignored. Tap to display it.')).atIndex(0),
element(by[textMatcher](user)), element(by[textMatcher](otherUser.username)),
2000 2000
); );
await element(by[textMatcher](user)).atIndex(0).tap(); await element(by[textMatcher](otherUser.username)).atIndex(0).tap();
await sleep(300); // wait for navigation animation await sleep(300); // wait for navigation animation
await expect(element(by.id('room-info-view-ignore').withDescendant(by[textMatcher]('Unignore')))).toBeVisible(); await expect(element(by.id('room-info-view-ignore').withDescendant(by[textMatcher]('Unignore')))).toBeVisible();
await element(by.id('room-info-view-ignore')).tap(); await element(by.id('room-info-view-ignore')).tap();

View File

@ -1,18 +1,20 @@
import { expect } from 'detox'; import { expect } from 'detox';
import data from '../../data';
import { navigateToLogin, login, platformTypes, TTextMatcher } from '../../helpers/app'; import { navigateToLogin, login, platformTypes, TTextMatcher } from '../../helpers/app';
import { createRandomUser, ITestUser } from '../../helpers/data_setup';
const teamName = `team-${data.random}`; import random from '../../helpers/random';
describe('Create team screen', () => { describe('Create team screen', () => {
let alertButtonType: string; let alertButtonType: string;
let textMatcher: TTextMatcher; let textMatcher: TTextMatcher;
let user: ITestUser;
const teamName = `team${random()}`;
beforeAll(async () => { beforeAll(async () => {
user = await createRandomUser();
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true }); await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
({ alertButtonType, textMatcher } = platformTypes[device.getPlatform()]); ({ alertButtonType, textMatcher } = platformTypes[device.getPlatform()]);
await navigateToLogin(); await navigateToLogin();
await login(data.users.regular.username, data.users.regular.password); await login(user.username, user.password);
}); });
describe('New Message', () => { describe('New Message', () => {
@ -48,20 +50,7 @@ describe('Create team screen', () => {
describe('Create Team', () => { describe('Create Team', () => {
describe('Usage', () => { describe('Usage', () => {
it('should get invalid team name', async () => {
await element(by.id('create-channel-name')).replaceText(`${data.teams.private.name}`);
await waitFor(element(by.id('create-channel-submit')))
.toExist()
.withTimeout(2000);
await element(by.id('create-channel-submit')).tap();
await waitFor(element(by[textMatcher]('OK').and(by.type(alertButtonType))))
.toBeVisible()
.withTimeout(5000);
await element(by[textMatcher]('OK').and(by.type(alertButtonType))).tap();
});
it('should create private team', async () => { it('should create private team', async () => {
await element(by.id('create-channel-name')).replaceText('');
await element(by.id('create-channel-name')).replaceText(teamName); await element(by.id('create-channel-name')).replaceText(teamName);
await waitFor(element(by.id('create-channel-submit'))) await waitFor(element(by.id('create-channel-submit')))
.toExist() .toExist()

View File

@ -1,25 +1,18 @@
import { expect } from 'detox'; import { expect } from 'detox';
import data from '../../data';
import { import {
navigateToLogin, navigateToLogin,
login, login,
tapBack, tapBack,
sleep, sleep,
searchRoom,
platformTypes, platformTypes,
TTextMatcher, TTextMatcher,
checkRoomTitle, checkRoomTitle,
tapAndWaitFor tapAndWaitFor,
navigateToRoom
} from '../../helpers/app'; } from '../../helpers/app';
import { createRandomRoom, createRandomTeam, createRandomUser, ITestUser } from '../../helpers/data_setup';
async function navigateToRoom(roomName: string) { import random from '../../helpers/random';
await searchRoom(`${roomName}`);
await element(by.id(`rooms-list-view-item-${roomName}`)).tap();
await waitFor(element(by.id('room-view')))
.toBeVisible()
.withTimeout(5000);
}
async function openActionSheet(username: string) { async function openActionSheet(username: string) {
await waitFor(element(by.id(`room-members-view-item-${username}`))) await waitFor(element(by.id(`room-members-view-item-${username}`)))
@ -79,18 +72,23 @@ async function swipeTillVisible(
} }
describe('Team', () => { describe('Team', () => {
const team = data.teams.private.name; const room = `private${random()}-channel-team`;
const user = data.users.alternate;
const room = `private${data.random}-channel-team`;
const existingRoom = data.groups.alternate.name;
let alertButtonType: string; let alertButtonType: string;
let textMatcher: TTextMatcher; let textMatcher: TTextMatcher;
let user: ITestUser;
let otherUser: ITestUser;
let team: string;
let existingRoom: string;
beforeAll(async () => { beforeAll(async () => {
user = await createRandomUser();
otherUser = await createRandomUser();
team = await createRandomTeam(user);
({ name: existingRoom } = await createRandomRoom(user));
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true }); await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
({ alertButtonType, textMatcher } = platformTypes[device.getPlatform()]); ({ alertButtonType, textMatcher } = platformTypes[device.getPlatform()]);
await navigateToLogin(); await navigateToLogin();
await login(data.users.regular.username, data.users.regular.password); await login(user.username, user.password);
await navigateToRoom(team); await navigateToRoom(team);
}); });
@ -174,8 +172,8 @@ describe('Team', () => {
await waitFor(element(by.id('create-channel-view'))) await waitFor(element(by.id('create-channel-view')))
.toExist() .toExist()
.withTimeout(10000); .withTimeout(10000);
await element(by.id('create-channel-name')).replaceText('');
await element(by.id('create-channel-name')).replaceText(room); await element(by.id('create-channel-name')).replaceText(room);
await element(by.id('create-channel-name')).tapReturnKey();
await waitFor(element(by.id('create-channel-submit'))) await waitFor(element(by.id('create-channel-submit')))
.toExist() .toExist()
.withTimeout(10000); .withTimeout(10000);
@ -312,12 +310,12 @@ describe('Team', () => {
.toExist() .toExist()
.withTimeout(4000); .withTimeout(4000);
await element(by.id('select-users-view-search')).tap(); await element(by.id('select-users-view-search')).tap();
await element(by.id('select-users-view-search')).replaceText(user.username); await element(by.id('select-users-view-search')).replaceText(otherUser.username);
await waitFor(element(by.id(`select-users-view-item-${user.username}`))) await waitFor(element(by.id(`select-users-view-item-${otherUser.username}`)))
.toExist() .toExist()
.withTimeout(10000); .withTimeout(10000);
await element(by.id(`select-users-view-item-${user.username}`)).tap(); await element(by.id(`select-users-view-item-${otherUser.username}`)).tap();
await waitFor(element(by.id(`selected-user-${user.username}`))) await waitFor(element(by.id(`selected-user-${otherUser.username}`)))
.toExist() .toExist()
.withTimeout(5000); .withTimeout(5000);
@ -334,7 +332,7 @@ describe('Team', () => {
.toExist() .toExist()
.withTimeout(2000); .withTimeout(2000);
await element(by.id('room-members-view-toggle-status-all')).tap(); await element(by.id('room-members-view-toggle-status-all')).tap();
await waitFor(element(by.id(`room-members-view-item-${user.username}`))) await waitFor(element(by.id(`room-members-view-item-${otherUser.username}`)))
.toExist() .toExist()
.withTimeout(60000); .withTimeout(60000);
await backToActions(); await backToActions();
@ -397,22 +395,22 @@ describe('Team', () => {
.toExist() .toExist()
.withTimeout(2000); .withTimeout(2000);
await element(by.id('room-members-view-toggle-status-all')).tap(); await element(by.id('room-members-view-toggle-status-all')).tap();
await waitFor(element(by.id(`room-members-view-item-${user.username}`))) await waitFor(element(by.id(`room-members-view-item-${otherUser.username}`)))
.toExist() .toExist()
.withTimeout(60000); .withTimeout(60000);
}); });
it('should filter user', async () => { it('should filter user', async () => {
await waitFor(element(by.id(`room-members-view-item-${user.username}`))) await waitFor(element(by.id(`room-members-view-item-${otherUser.username}`)))
.toExist() .toExist()
.withTimeout(60000); .withTimeout(60000);
await element(by.id('room-members-view-search')).replaceText('rocket'); await element(by.id('room-members-view-search')).replaceText('rocket');
await waitFor(element(by.id(`room-members-view-item-${user.username}`))) await waitFor(element(by.id(`room-members-view-item-${otherUser.username}`)))
.toBeNotVisible() .toBeNotVisible()
.withTimeout(60000); .withTimeout(60000);
await element(by.id('room-members-view-search')).tap(); await element(by.id('room-members-view-search')).tap();
await element(by.id('room-members-view-search')).clearText(); await element(by.id('room-members-view-search')).clearText();
await waitFor(element(by.id(`room-members-view-item-${user.username}`))) await waitFor(element(by.id(`room-members-view-item-${otherUser.username}`)))
.toExist() .toExist()
.withTimeout(60000); .withTimeout(60000);
}); });
@ -441,11 +439,11 @@ describe('Team', () => {
}); });
it('should set member as owner', async () => { it('should set member as owner', async () => {
await openActionSheet(user.username); await openActionSheet(otherUser.username);
await element(by.id('action-sheet-set-owner')).tap(); await element(by.id('action-sheet-set-owner')).tap();
await waitForToast(); await waitForToast();
await openActionSheet(user.username); await openActionSheet(otherUser.username);
await waitFor(element(by.id('action-sheet-set-owner-checked'))) await waitFor(element(by.id('action-sheet-set-owner-checked')))
.toBeVisible() .toBeVisible()
.withTimeout(6000); .withTimeout(6000);
@ -488,9 +486,12 @@ describe('Team', () => {
.toExist() .toExist()
.withTimeout(2000); .withTimeout(2000);
await element(by.id('select-list-view-submit')).tap(); await element(by.id('select-list-view-submit')).tap();
await waitFor(element(by.id('rooms-list-view')))
.toBeVisible()
.withTimeout(10000);
await waitFor(element(by.id(`rooms-list-view-item-${team}`))) await waitFor(element(by.id(`rooms-list-view-item-${team}`)))
.toBeNotVisible() .toBeNotVisible()
.withTimeout(60000); .withTimeout(10000);
}); });
}); });
}); });

View File

@ -1,17 +1,9 @@
import data from '../../data'; import { navigateToLogin, login, tapBack, platformTypes, TTextMatcher, sleep, navigateToRoom } from '../../helpers/app';
import { import { createRandomUser, ITestUser } from '../../helpers/data_setup';
navigateToLogin, import random from '../../helpers/random';
login,
tapBack,
searchRoom,
platformTypes,
TTextMatcher,
tapAndWaitFor,
sleep
} from '../../helpers/app';
const toBeConverted = `to-be-converted-${data.random}`; const toBeConverted = `to-be-converted-${random()}`;
const toBeMoved = `to-be-moved-${data.random}`; const toBeMoved = `to-be-moved-${random()}`;
const createChannel = async (room: string) => { const createChannel = async (room: string) => {
await waitFor(element(by.id('rooms-list-view-create-channel'))) await waitFor(element(by.id('rooms-list-view-create-channel')))
@ -50,14 +42,6 @@ const createChannel = async (room: string) => {
.withTimeout(60000); .withTimeout(60000);
}; };
async function navigateToRoom(room: string) {
await searchRoom(`${room}`);
await element(by.id(`rooms-list-view-item-${room}`)).tap();
await waitFor(element(by.id('room-view')))
.toBeVisible()
.withTimeout(5000);
}
async function navigateToRoomActions(room: string) { async function navigateToRoomActions(room: string) {
await navigateToRoom(room); await navigateToRoom(room);
await element(by.id('room-header')).tap(); await element(by.id('room-header')).tap();
@ -69,11 +53,13 @@ async function navigateToRoomActions(room: string) {
describe('Move/Convert Team', () => { describe('Move/Convert Team', () => {
let alertButtonType: string; let alertButtonType: string;
let textMatcher: TTextMatcher; let textMatcher: TTextMatcher;
let user: ITestUser;
beforeAll(async () => { beforeAll(async () => {
user = await createRandomUser();
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true }); await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
({ alertButtonType, textMatcher } = platformTypes[device.getPlatform()]); ({ alertButtonType, textMatcher } = platformTypes[device.getPlatform()]);
await navigateToLogin(); await navigateToLogin();
await login(data.users.regular.username, data.users.regular.password); await login(user.username, user.password);
}); });
describe('Convert', () => { describe('Convert', () => {