[TESTS] Add E2E tests to draft message (#2960)
* [E2E TEST] Draft message * Fix tests Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
1ff6530a19
commit
e164b6496c
|
@ -5,9 +5,6 @@ const data = require('../../data');
|
||||||
const { navigateToLogin, login, mockMessage, tapBack, sleep, searchRoom, starMessage, pinMessage, dismissReviewNag, tryTapping } = require('../../helpers/app');
|
const { navigateToLogin, login, mockMessage, tapBack, sleep, searchRoom, starMessage, pinMessage, dismissReviewNag, tryTapping } = require('../../helpers/app');
|
||||||
|
|
||||||
async function navigateToRoom(roomName) {
|
async function navigateToRoom(roomName) {
|
||||||
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
|
||||||
await navigateToLogin();
|
|
||||||
await login(data.users.regular.username, data.users.regular.password);
|
|
||||||
await searchRoom(`${ roomName }`);
|
await searchRoom(`${ roomName }`);
|
||||||
await waitFor(element(by.id(`rooms-list-view-item-${ roomName }`))).toExist().withTimeout(60000);
|
await waitFor(element(by.id(`rooms-list-view-item-${ roomName }`))).toExist().withTimeout(60000);
|
||||||
await element(by.id(`rooms-list-view-item-${ roomName }`)).tap();
|
await element(by.id(`rooms-list-view-item-${ roomName }`)).tap();
|
||||||
|
@ -18,6 +15,9 @@ describe('Room screen', () => {
|
||||||
const mainRoom = data.groups.private.name;
|
const mainRoom = data.groups.private.name;
|
||||||
|
|
||||||
before(async() => {
|
before(async() => {
|
||||||
|
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
||||||
|
await navigateToLogin();
|
||||||
|
await login(data.users.regular.username, data.users.regular.password);
|
||||||
await navigateToRoom(mainRoom);
|
await navigateToRoom(mainRoom);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -126,6 +126,20 @@ describe('Room screen', () => {
|
||||||
await expect(element(by.id('messagebox-input'))).toHaveText('#general ');
|
await expect(element(by.id('messagebox-input'))).toHaveText('#general ');
|
||||||
await element(by.id('messagebox-input')).clearText();
|
await element(by.id('messagebox-input')).clearText();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should draft message', async () => {
|
||||||
|
await element(by.id('messagebox-input')).atIndex(0).tap();
|
||||||
|
await element(by.id('messagebox-input')).atIndex(0).typeText(`${ data.random }draft`);
|
||||||
|
await tapBack();
|
||||||
|
|
||||||
|
await navigateToRoom(mainRoom);
|
||||||
|
await expect(element(by.id('messagebox-input'))).toHaveText(`${ data.random }draft`);
|
||||||
|
await element(by.id('messagebox-input')).clearText();
|
||||||
|
await tapBack();
|
||||||
|
|
||||||
|
await navigateToRoom(mainRoom);
|
||||||
|
await expect(element(by.id('messagebox-input'))).toHaveText('');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Message', async() => {
|
describe('Message', async() => {
|
||||||
|
@ -352,6 +366,27 @@ describe('Room screen', () => {
|
||||||
await expect(element(by.id('thread-messages-view'))).toExist();
|
await expect(element(by.id('thread-messages-view'))).toExist();
|
||||||
await tapBack();
|
await tapBack();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should draft thread message', async () => {
|
||||||
|
await element(by.id(`message-thread-button-${ thread }`)).tap();
|
||||||
|
await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(5000);
|
||||||
|
await waitFor(element(by.id(`room-view-title-${ thread }`))).toExist().withTimeout(5000);
|
||||||
|
await element(by.id('messagebox-input')).atIndex(0).tap();
|
||||||
|
await element(by.id('messagebox-input')).atIndex(0).typeText(`${ thread }draft`);
|
||||||
|
await tapBack();
|
||||||
|
|
||||||
|
await element(by.id(`message-thread-button-${ thread }`)).tap();
|
||||||
|
await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(5000);
|
||||||
|
await waitFor(element(by.id(`room-view-title-${ thread }`))).toExist().withTimeout(5000);
|
||||||
|
await expect(element(by.id('messagebox-input')).atIndex(0)).toHaveText(`${ thread }draft`);
|
||||||
|
await element(by.id('messagebox-input')).atIndex(0).clearText();
|
||||||
|
await tapBack();
|
||||||
|
|
||||||
|
await element(by.id(`message-thread-button-${ thread }`)).tap();
|
||||||
|
await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(5000);
|
||||||
|
await waitFor(element(by.id(`room-view-title-${ thread }`))).toExist().withTimeout(5000);
|
||||||
|
await expect(element(by.id('messagebox-input')).atIndex(0)).toHaveText('');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// after(async() => {
|
// after(async() => {
|
||||||
|
|
Loading…
Reference in New Issue