diff --git a/e2e/tests/room/02-room.spec.js b/e2e/tests/room/02-room.spec.js index a4720ba7..d4090d6c 100644 --- a/e2e/tests/room/02-room.spec.js +++ b/e2e/tests/room/02-room.spec.js @@ -5,9 +5,6 @@ const data = require('../../data'); const { navigateToLogin, login, mockMessage, tapBack, sleep, searchRoom, starMessage, pinMessage, dismissReviewNag, tryTapping } = require('../../helpers/app'); 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 waitFor(element(by.id(`rooms-list-view-item-${ roomName }`))).toExist().withTimeout(60000); await element(by.id(`rooms-list-view-item-${ roomName }`)).tap(); @@ -18,6 +15,9 @@ describe('Room screen', () => { const mainRoom = data.groups.private.name; 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); }); @@ -126,6 +126,20 @@ describe('Room screen', () => { await expect(element(by.id('messagebox-input'))).toHaveText('#general '); 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() => { @@ -352,6 +366,27 @@ describe('Room screen', () => { await expect(element(by.id('thread-messages-view'))).toExist(); 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() => {