Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 38 additions & 3 deletions e2e/tests/room/02-room.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
});

Expand Down Expand Up @@ -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`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should test if the room has rendered before testing messagebox content.

await element(by.id('messagebox-input')).clearText();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should test if draft was removed after messagebox is cleared.

await tapBack();

await navigateToRoom(mainRoom);
await expect(element(by.id('messagebox-input'))).toHaveText('');
});
});

describe('Message', async() => {
Expand Down Expand Up @@ -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() => {
Expand Down