2023-03-07 12:28:51 +00:00
|
|
|
import { device, waitFor, element, by, expect } from 'detox';
|
2022-09-12 14:51:33 +00:00
|
|
|
|
|
|
|
import {
|
2021-09-13 20:41:05 +00:00
|
|
|
navigateToLogin,
|
|
|
|
login,
|
|
|
|
tapBack,
|
|
|
|
sleep,
|
2021-12-02 13:19:15 +00:00
|
|
|
tryTapping,
|
2022-09-12 14:51:33 +00:00
|
|
|
platformTypes,
|
2023-03-07 12:28:51 +00:00
|
|
|
TTextMatcher,
|
2024-02-15 19:41:03 +00:00
|
|
|
mockMessage,
|
|
|
|
navigateToRoom,
|
|
|
|
navigateToRecentRoom
|
2022-09-12 14:51:33 +00:00
|
|
|
} from '../../helpers/app';
|
2023-03-07 12:28:51 +00:00
|
|
|
import { createRandomRoom, createRandomUser, ITestUser, sendMessage } from '../../helpers/data_setup';
|
2018-05-23 13:39:18 +00:00
|
|
|
|
|
|
|
describe('Room screen', () => {
|
2023-03-07 12:28:51 +00:00
|
|
|
let room: string;
|
2022-09-12 14:51:33 +00:00
|
|
|
let alertButtonType: string;
|
|
|
|
let textMatcher: TTextMatcher;
|
2023-03-07 12:28:51 +00:00
|
|
|
let user: ITestUser;
|
|
|
|
let randomMessage: string;
|
2019-04-17 17:01:03 +00:00
|
|
|
|
2023-03-07 12:28:51 +00:00
|
|
|
beforeAll(async () => {
|
|
|
|
user = await createRandomUser();
|
|
|
|
({ name: room } = await createRandomRoom(user));
|
2021-03-18 13:27:37 +00:00
|
|
|
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
2021-12-02 13:19:15 +00:00
|
|
|
({ alertButtonType, textMatcher } = platformTypes[device.getPlatform()]);
|
2021-03-18 13:27:37 +00:00
|
|
|
await navigateToLogin();
|
2023-03-07 12:28:51 +00:00
|
|
|
await login(user.username, user.password);
|
|
|
|
await navigateToRoom(room);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
2024-01-25 14:11:07 +00:00
|
|
|
describe('Composer', () => {
|
|
|
|
it('should send message', async () => {
|
|
|
|
randomMessage = await mockMessage('message');
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
2024-01-25 14:11:07 +00:00
|
|
|
it('should show and tap on emoji autocomplete', async () => {
|
|
|
|
await element(by.id('message-composer-input')).typeText(':joy');
|
|
|
|
await waitFor(element(by.id('autocomplete-item-joy')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(10000);
|
|
|
|
await element(by.id('autocomplete-item-joy')).tap();
|
|
|
|
await expect(element(by.id('message-composer-input'))).toHaveText(':joy: ');
|
|
|
|
await element(by.id('message-composer-input')).clearText();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
2024-01-25 14:11:07 +00:00
|
|
|
it('should show and tap on user autocomplete and send mention', async () => {
|
|
|
|
const { username } = user;
|
|
|
|
await element(by.id('message-composer-input')).typeText(`@${username}`);
|
|
|
|
await waitFor(element(by.id(`autocomplete-item-${username}`)))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(10000);
|
|
|
|
await element(by.id(`autocomplete-item-${username}`)).tap();
|
|
|
|
await expect(element(by.id('message-composer-input'))).toHaveText(`@${username} `);
|
|
|
|
await element(by.id('message-composer-input')).clearText();
|
|
|
|
});
|
2018-05-23 13:39:18 +00:00
|
|
|
|
2024-01-25 14:11:07 +00:00
|
|
|
it('should show and tap on room autocomplete', async () => {
|
|
|
|
await element(by.id('message-composer-input')).typeText('#general');
|
|
|
|
await waitFor(element(by.id(`autocomplete-item-general`)))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(10000);
|
|
|
|
await element(by.id(`autocomplete-item-general`)).tap();
|
|
|
|
await expect(element(by.id('message-composer-input'))).toHaveText('#general ');
|
|
|
|
await element(by.id('message-composer-input')).clearText();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2024-01-25 14:11:07 +00:00
|
|
|
// describe('Emoji Keyboard', () => {
|
|
|
|
// it('select an emoji', async () => {
|
|
|
|
// await element(by.id('message-composer-input')).tap();
|
|
|
|
// await waitFor(element(by.id('message-composer-open-emoji')))
|
|
|
|
// .toBeVisible()
|
|
|
|
// .withTimeout(2000);
|
|
|
|
// await element(by.id('message-composer-open-emoji')).tap();
|
|
|
|
|
|
|
|
// // TODO: change it after moved away from messabebox
|
|
|
|
// await waitFor(element(by.id('message-composer-keyboard-emoji')))
|
|
|
|
// .toExist()
|
|
|
|
// .withTimeout(10000);
|
|
|
|
// await waitFor(element(by.id('emoji-picker-tab-emoji')))
|
|
|
|
// .toExist()
|
|
|
|
// .withTimeout(10000);
|
|
|
|
// await element(by.id('emoji-picker-tab-emoji')).tap();
|
|
|
|
// await waitFor(element(by.id('emoji-blush')))
|
|
|
|
// .toBeVisible()
|
|
|
|
// .withTimeout(2000);
|
|
|
|
// await element(by.id('emoji-blush')).tap();
|
|
|
|
// await expect(element(by.id('message-composer-input'))).toHaveText('😊');
|
|
|
|
// await element(by.id('message-composer-input')).clearText();
|
|
|
|
// });
|
|
|
|
|
|
|
|
// it('should search emoji', async () => {
|
|
|
|
// await element(by.id('message-composer-input')).tap();
|
|
|
|
// await element(by.id('message-composer-open-emoji')).tap();
|
|
|
|
// await waitFor(element(by.id('emoji-picker-search')))
|
|
|
|
// .toExist()
|
|
|
|
// .withTimeout(4000);
|
|
|
|
// await element(by.id('emoji-picker-search')).tap();
|
|
|
|
// await waitFor(element(by.id('emoji-searchbar-input')))
|
|
|
|
// .toExist()
|
|
|
|
// .withTimeout(2000);
|
|
|
|
// await element(by.id('emoji-searchbar-input')).replaceText('no_mouth');
|
|
|
|
// await waitFor(element(by.id('emoji-no_mouth')))
|
|
|
|
// .toExist()
|
|
|
|
// .withTimeout(2000);
|
|
|
|
// await element(by.id('emoji-no_mouth')).tap();
|
|
|
|
// await expect(element(by.id('message-composer-input'))).toHaveText('😶');
|
|
|
|
// await element(by.id('message-composer-input')).clearText();
|
|
|
|
// });
|
|
|
|
// });
|
|
|
|
|
|
|
|
describe('Message', () => {
|
|
|
|
it('should copy link', async () => {
|
|
|
|
await element(by[textMatcher](randomMessage)).atIndex(0).longPress();
|
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
|
|
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
|
|
|
await element(by[textMatcher]('Get link')).atIndex(0).tap();
|
|
|
|
// TODO: test clipboard
|
|
|
|
});
|
|
|
|
it('should copy message', async () => {
|
|
|
|
await element(by[textMatcher](randomMessage)).atIndex(0).longPress();
|
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
|
|
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
|
|
|
await element(by[textMatcher]('Copy')).atIndex(0).tap();
|
|
|
|
// TODO: test clipboard
|
|
|
|
});
|
2021-03-18 13:27:37 +00:00
|
|
|
|
2024-01-25 14:11:07 +00:00
|
|
|
it('should react to message', async () => {
|
|
|
|
await waitFor(element(by[textMatcher](randomMessage)))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(60000);
|
|
|
|
await element(by[textMatcher](randomMessage)).atIndex(0).tap();
|
|
|
|
await element(by[textMatcher](randomMessage)).atIndex(0).longPress();
|
|
|
|
await sleep(300); // wait for animation
|
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
|
|
|
await element(by.id('add-reaction')).tap();
|
|
|
|
await sleep(300); // wait for animation
|
|
|
|
await waitFor(element(by.id('emoji-picker-tab-emoji')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await element(by.id('emoji-picker-tab-emoji')).tap();
|
|
|
|
await waitFor(element(by.id('emoji-grinning')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(10000);
|
|
|
|
await element(by.id('emoji-grinning')).tap();
|
|
|
|
await waitFor(element(by.id('message-reaction-:grinning:')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(60000);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
2024-01-25 14:11:07 +00:00
|
|
|
it('should search emojis in the reaction picker and react', async () => {
|
|
|
|
await element(by[textMatcher](randomMessage)).atIndex(0).longPress();
|
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
|
|
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
|
|
|
await element(by.id('add-reaction')).tap();
|
|
|
|
await waitFor(element(by.id('emoji-searchbar-input')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await element(by.id('emoji-searchbar-input')).replaceText('laughing');
|
|
|
|
await waitFor(element(by.id('emoji-laughing')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(4000);
|
|
|
|
await element(by.id('emoji-laughing')).tap();
|
|
|
|
await waitFor(element(by.id('message-reaction-:laughing:')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(60000);
|
|
|
|
});
|
2020-12-01 19:26:03 +00:00
|
|
|
|
2024-01-25 14:11:07 +00:00
|
|
|
it('should remove reaction', async () => {
|
|
|
|
await element(by.id('message-reaction-:grinning:')).tap();
|
|
|
|
await waitFor(element(by.id('message-reaction-:grinning:')))
|
|
|
|
.not.toExist()
|
|
|
|
.withTimeout(60000);
|
|
|
|
});
|
2022-10-21 18:27:55 +00:00
|
|
|
|
2024-01-25 14:11:07 +00:00
|
|
|
it('should react to message with frequently used emoji', async () => {
|
|
|
|
await element(by[textMatcher](randomMessage)).atIndex(0).longPress();
|
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
|
|
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
|
|
|
await sleep(300); // wait for animation
|
|
|
|
await waitFor(element(by.id('message-actions-emoji-grinning')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await element(by.id('message-actions-emoji-grinning')).tap();
|
|
|
|
await waitFor(element(by.id('message-reaction-:grinning:')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(60000);
|
|
|
|
});
|
2018-05-23 13:39:18 +00:00
|
|
|
|
2024-01-25 14:11:07 +00:00
|
|
|
it('should show reaction picker on add reaction button pressed and have frequently used emoji', async () => {
|
|
|
|
await element(by.id('message-add-reaction')).tap();
|
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
|
|
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 1);
|
|
|
|
await waitFor(element(by.id('emoji-grinning')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(4000);
|
|
|
|
await waitFor(element(by.id('emoji-picker-tab-emoji')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await element(by.id('emoji-picker-tab-emoji')).tap();
|
|
|
|
await waitFor(element(by.id('emoji-wink')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(10000);
|
|
|
|
await element(by.id('emoji-wink')).tap();
|
|
|
|
await waitFor(element(by.id('message-reaction-:wink:')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(60000);
|
|
|
|
});
|
2023-03-07 12:28:51 +00:00
|
|
|
|
2024-01-25 14:11:07 +00:00
|
|
|
it('should open/close reactions list', async () => {
|
|
|
|
await element(by.id('message-reaction-:laughing:')).longPress();
|
|
|
|
await waitFor(element(by.id('reactionsList')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(4000);
|
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
|
|
|
await element(by.id('action-sheet-handle')).swipe('down', 'fast', 0.5);
|
|
|
|
});
|
2020-12-01 19:26:03 +00:00
|
|
|
|
2024-01-25 14:11:07 +00:00
|
|
|
it('should edit message', async () => {
|
|
|
|
const editMessage = await mockMessage('edit');
|
|
|
|
const editedMessage = `${editMessage}ed`;
|
|
|
|
await tryTapping(element(by[textMatcher](editMessage)).atIndex(0), 2000, true);
|
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
|
|
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
|
|
|
await element(by[textMatcher]('Edit')).atIndex(0).tap();
|
|
|
|
await element(by.id('message-composer-input')).typeText('ed');
|
|
|
|
await element(by.id('message-composer-send')).tap();
|
|
|
|
await waitFor(element(by[textMatcher](editedMessage)).atIndex(0))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(60000);
|
|
|
|
});
|
2020-07-22 16:32:21 +00:00
|
|
|
|
2024-01-25 14:11:07 +00:00
|
|
|
let quotedMessage = '';
|
|
|
|
it('should quote message', async () => {
|
|
|
|
const quoteMessage = await mockMessage('quote');
|
|
|
|
quotedMessage = `${quoteMessage}d`;
|
|
|
|
await tryTapping(element(by[textMatcher](quoteMessage)).atIndex(0), 2000, true);
|
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
|
|
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
|
|
|
await element(by[textMatcher]('Quote')).atIndex(0).tap();
|
|
|
|
await element(by.id('message-composer-input')).replaceText(quotedMessage);
|
|
|
|
await waitFor(element(by.id('message-composer-send')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await element(by.id('message-composer-send')).tap();
|
|
|
|
await waitFor(element(by[textMatcher](quotedMessage)).atIndex(0))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(3000);
|
|
|
|
await waitFor(element(by.id(`reply-${user.name}-${quoteMessage}`).withDescendant(by[textMatcher](quoteMessage))))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(3000);
|
|
|
|
});
|
2022-09-29 19:42:04 +00:00
|
|
|
|
2024-01-25 14:11:07 +00:00
|
|
|
it('should back to rooms list view and see the last message correctly and navigate again to room', async () => {
|
|
|
|
const expectedLastMessage = `You: ${quotedMessage}`;
|
|
|
|
await sleep(300);
|
|
|
|
await tapBack();
|
|
|
|
await waitFor(element(by.id(`markdown-preview-${expectedLastMessage}`)))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(5000);
|
|
|
|
await element(by.id(`markdown-preview-${expectedLastMessage}`)).tap();
|
|
|
|
});
|
2020-12-01 19:26:03 +00:00
|
|
|
|
2024-01-25 14:11:07 +00:00
|
|
|
it('should delete message', async () => {
|
|
|
|
const deleteMessage = await mockMessage('delete');
|
|
|
|
await tryTapping(element(by[textMatcher](deleteMessage)).atIndex(0), 2000, true);
|
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
|
|
|
// Fix android flaky test. Close the action sheet, then re-open again
|
|
|
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
|
|
|
await element(by.id('action-sheet')).swipe('up', 'fast', 0.5);
|
|
|
|
await sleep(300); // wait for animation
|
|
|
|
await waitFor(element(by[textMatcher]('Delete')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await element(by[textMatcher]('Delete')).atIndex(0).tap();
|
|
|
|
const deleteAlertMessage = 'You will not be able to recover this message!';
|
|
|
|
await waitFor(element(by[textMatcher](deleteAlertMessage)).atIndex(0))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(10000);
|
|
|
|
await element(by[textMatcher]('Delete').and(by.type(alertButtonType))).tap();
|
|
|
|
await waitFor(element(by[textMatcher](deleteMessage)).atIndex(0))
|
|
|
|
.not.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await tapBack();
|
|
|
|
});
|
2022-11-04 17:09:58 +00:00
|
|
|
|
2024-01-25 14:11:07 +00:00
|
|
|
it('should reply in DM to another user', async () => {
|
|
|
|
const replyUser = await createRandomUser();
|
|
|
|
const { name: replyRoom } = await createRandomRoom(replyUser, 'c');
|
|
|
|
const originalMessage = 'Message to reply in DM';
|
|
|
|
const replyMessage = 'replied in dm';
|
|
|
|
await sendMessage(replyUser, replyRoom, originalMessage);
|
|
|
|
await waitFor(element(by.id('rooms-list-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await navigateToRoom(replyRoom);
|
|
|
|
await waitFor(element(by[textMatcher](originalMessage)).atIndex(0))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(10000);
|
|
|
|
await element(by.id('room-view-join-button')).tap();
|
|
|
|
await waitFor(element(by.id('room-view-join-button')))
|
|
|
|
.not.toBeVisible()
|
|
|
|
.withTimeout(10000);
|
|
|
|
await element(by[textMatcher](originalMessage)).atIndex(0).longPress();
|
|
|
|
await sleep(600); // wait for animation
|
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await sleep(600); // wait for animation
|
|
|
|
// Fix android flaky test. Close the action sheet, then re-open again
|
|
|
|
await element(by.id('action-sheet-handle')).swipe('down', 'fast', 0.5);
|
|
|
|
await sleep(1000); // wait for animation
|
|
|
|
await element(by[textMatcher](originalMessage)).atIndex(0).longPress();
|
|
|
|
await sleep(600); // wait for animation
|
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await sleep(600); // wait for animation
|
|
|
|
await waitFor(element(by[textMatcher]('Reply in direct message')).atIndex(0))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(6000);
|
|
|
|
await sleep(600); // wait for animation
|
|
|
|
await element(by[textMatcher]('Reply in direct message')).atIndex(0).tap();
|
|
|
|
await sleep(600); // wait for animation
|
|
|
|
await waitFor(element(by.id(`room-view-title-${replyUser.username}`)))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(6000);
|
|
|
|
await element(by.id('message-composer-input')).replaceText(replyMessage);
|
|
|
|
await waitFor(element(by.id('message-composer-send')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await element(by.id('message-composer-send')).tap();
|
|
|
|
await waitFor(element(by[textMatcher](replyMessage)))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(60000);
|
|
|
|
await element(by[textMatcher](replyMessage)).atIndex(0).tap();
|
2024-02-15 19:41:03 +00:00
|
|
|
await tapBack();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should save message and quote draft correctly', async () => {
|
|
|
|
const newUser = await createRandomUser();
|
|
|
|
const { name: draftRoom } = await createRandomRoom(newUser, 'c');
|
|
|
|
const draftMessage = 'draft';
|
|
|
|
const originalMessage = '123';
|
|
|
|
const quoteMessage = '123456';
|
|
|
|
await sendMessage(newUser, draftRoom, originalMessage);
|
|
|
|
await waitFor(element(by.id('rooms-list-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(5000);
|
|
|
|
await navigateToRoom(draftRoom);
|
|
|
|
await waitFor(element(by[textMatcher](originalMessage)).atIndex(0))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(10000);
|
|
|
|
await element(by.id('room-view-join-button')).tap();
|
|
|
|
await waitFor(element(by.id('room-view-join-button')))
|
|
|
|
.not.toBeVisible()
|
|
|
|
.withTimeout(10000);
|
|
|
|
// add draft
|
|
|
|
await element(by.id('message-composer-input')).typeText(draftMessage);
|
|
|
|
await tapBack();
|
|
|
|
await navigateToRecentRoom(draftRoom);
|
|
|
|
await sleep(500); // wait for animation
|
|
|
|
await expect(element(by.id('message-composer-input'))).toHaveText(draftMessage);
|
|
|
|
// add quote to draft
|
|
|
|
await tryTapping(element(by[textMatcher](originalMessage)).atIndex(0), 2000, true);
|
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(5000);
|
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
|
|
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
|
|
|
await element(by[textMatcher]('Quote')).atIndex(0).tap();
|
|
|
|
await waitFor(element(by.id(`markdown-preview-${originalMessage}`)))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(10000);
|
|
|
|
await tapBack();
|
|
|
|
await navigateToRecentRoom(draftRoom);
|
|
|
|
await sleep(500); // wait for animation
|
|
|
|
await waitFor(element(by.id(`markdown-preview-${originalMessage}`)))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(10000);
|
|
|
|
// edit draft with quote
|
|
|
|
await element(by.id('message-composer-input')).replaceText(quoteMessage);
|
|
|
|
await tapBack();
|
|
|
|
await navigateToRecentRoom(draftRoom);
|
|
|
|
await sleep(500); // wait for animation
|
|
|
|
await expect(element(by.id('message-composer-input'))).toHaveText(quoteMessage);
|
|
|
|
// send message
|
|
|
|
await waitFor(element(by.id('message-composer-send')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(5000);
|
|
|
|
await element(by.id('message-composer-send')).tap();
|
|
|
|
await waitFor(element(by.id(`reply-${newUser.name}-${originalMessage}`).withDescendant(by[textMatcher](originalMessage))))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(5000);
|
|
|
|
await expect(element(by.id('message-composer-input'))).toHaveText('');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should edit message on shareview and after close the text needs to be changed on roomView', async () => {
|
|
|
|
const draftShareMessage = 'draftShare';
|
|
|
|
const originalMessage = '123';
|
|
|
|
await element(by.id('message-composer-input')).typeText(draftShareMessage);
|
|
|
|
await element(by.id('message-composer-actions')).tap();
|
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await element(by[textMatcher]('Choose from library')).atIndex(0).tap();
|
|
|
|
await sleep(300); // wait for animation
|
|
|
|
await waitFor(element(by.id('message-composer-input-share')))
|
|
|
|
.toHaveText(draftShareMessage)
|
|
|
|
.withTimeout(2000);
|
|
|
|
await element(by.id('message-composer-input-share')).replaceText(draftShareMessage + originalMessage);
|
|
|
|
await element(by.id('share-view-close')).tap();
|
|
|
|
await sleep(500); // wait for animation
|
|
|
|
await waitFor(element(by.id('message-composer-input')))
|
|
|
|
.toHaveText(draftShareMessage + originalMessage)
|
|
|
|
.withTimeout(2000);
|
|
|
|
// add quote to draft
|
|
|
|
await tryTapping(element(by[textMatcher](originalMessage)).atIndex(0), 2000, true);
|
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
|
|
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
|
|
|
await element(by[textMatcher]('Quote')).atIndex(0).tap();
|
|
|
|
await element(by.id('message-composer-actions')).tap();
|
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await element(by[textMatcher]('Choose from library')).atIndex(0).tap();
|
|
|
|
await sleep(500); // wait for animation
|
|
|
|
await waitFor(element(by.id(`markdown-preview-${originalMessage}`)).atIndex(0))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(20000);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
});
|
2020-12-01 19:26:03 +00:00
|
|
|
});
|