2020-05-20 16:33:40 +00:00
|
|
|
const data = require('../../data');
|
2021-07-02 17:39:39 +00:00
|
|
|
const {
|
2021-09-13 20:41:05 +00:00
|
|
|
navigateToLogin,
|
|
|
|
login,
|
|
|
|
mockMessage,
|
|
|
|
tapBack,
|
|
|
|
sleep,
|
|
|
|
searchRoom,
|
|
|
|
starMessage,
|
|
|
|
pinMessage,
|
|
|
|
dismissReviewNag,
|
2021-12-02 13:19:15 +00:00
|
|
|
tryTapping,
|
|
|
|
platformTypes
|
2021-07-02 17:39:39 +00:00
|
|
|
} = require('../../helpers/app');
|
2018-05-23 13:39:18 +00:00
|
|
|
|
2020-07-22 16:32:21 +00:00
|
|
|
async function navigateToRoom(roomName) {
|
2021-09-13 20:41:05 +00:00
|
|
|
await searchRoom(`${roomName}`);
|
|
|
|
await element(by.id(`rooms-list-view-item-${roomName}`)).tap();
|
|
|
|
await waitFor(element(by.id('room-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(5000);
|
2018-05-23 13:39:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
describe('Room screen', () => {
|
2020-07-22 16:32:21 +00:00
|
|
|
const mainRoom = data.groups.private.name;
|
2021-12-02 13:19:15 +00:00
|
|
|
let alertButtonType;
|
|
|
|
let textMatcher;
|
2019-04-17 17:01:03 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
before(async () => {
|
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();
|
|
|
|
await login(data.users.regular.username, data.users.regular.password);
|
2020-07-22 16:32:21 +00:00
|
|
|
await navigateToRoom(mainRoom);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
2021-07-02 17:39:39 +00:00
|
|
|
describe('Render', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have room screen', async () => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('room-view'))).toExist();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id(`room-view-title-${mainRoom}`)))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(5000);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// Render - Header
|
2021-07-02 17:39:39 +00:00
|
|
|
describe('Header', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have actions button ', async () => {
|
2021-04-07 18:31:25 +00:00
|
|
|
await expect(element(by.id('room-header'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
2020-03-03 20:27:38 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have threads button ', async () => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('room-view-header-threads'))).toExist();
|
2020-03-03 20:27:38 +00:00
|
|
|
});
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// Render - Messagebox
|
2021-07-02 17:39:39 +00:00
|
|
|
describe('Messagebox', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have messagebox', async () => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('messagebox'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have open emoji button', async () => {
|
2022-08-24 19:09:54 +00:00
|
|
|
await expect(element(by.id('messagebox-open-emoji'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have message input', async () => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('messagebox-input'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have audio button', async () => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('messagebox-send-audio'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should have actions button', async () => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('messagebox-actions'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-07-02 17:39:39 +00:00
|
|
|
describe('Usage', () => {
|
|
|
|
describe('Messagebox', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should send message', async () => {
|
2021-07-02 17:39:39 +00:00
|
|
|
await mockMessage('message');
|
2021-12-02 13:19:15 +00:00
|
|
|
await expect(element(by[textMatcher](`${data.random}message`)).atIndex(0)).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
2019-05-28 13:03:08 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should show/hide emoji keyboard', async () => {
|
2022-08-24 19:09:54 +00:00
|
|
|
await element(by.id('messagebox-open-emoji')).tap();
|
|
|
|
await waitFor(element(by.id('messagebox-keyboard-emoji')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(10000);
|
|
|
|
await expect(element(by.id('messagebox-close-emoji'))).toExist();
|
|
|
|
await expect(element(by.id('messagebox-open-emoji'))).toBeNotVisible();
|
|
|
|
await element(by.id('messagebox-close-emoji')).tap();
|
|
|
|
await waitFor(element(by.id('messagebox-keyboard-emoji')))
|
|
|
|
.not.toBeVisible()
|
|
|
|
.withTimeout(10000);
|
|
|
|
await expect(element(by.id('messagebox-close-emoji'))).toBeNotVisible();
|
|
|
|
await expect(element(by.id('messagebox-open-emoji'))).toExist();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should clear the emoji', async () => {
|
|
|
|
await element(by.id('messagebox-open-emoji')).tap();
|
|
|
|
await waitFor(element(by.id('messagebox-keyboard-emoji')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(10000);
|
|
|
|
await expect(element(by.id('emoji-picker-tab-emoji'))).toExist();
|
|
|
|
await element(by.id('emoji-picker-tab-emoji')).tap();
|
|
|
|
await expect(element(by.id('emoji-smiley'))).toExist();
|
|
|
|
await element(by.id('emoji-smiley')).tap();
|
|
|
|
await waitFor(element(by.id('emoji-picker-backspace')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(4000);
|
|
|
|
await expect(element(by.id('messagebox-input'))).toHaveText('😃');
|
|
|
|
await expect(element(by.id('emoji-picker-backspace'))).toExist();
|
|
|
|
await element(by.id('emoji-picker-backspace')).tap();
|
|
|
|
await expect(element(by.id('messagebox-input'))).toHaveText('');
|
|
|
|
await element(by.id('messagebox-close-emoji')).tap();
|
|
|
|
await waitFor(element(by.id('messagebox-keyboard-emoji')))
|
|
|
|
.not.toBeVisible()
|
|
|
|
.withTimeout(10000);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search emojis, go back to EmojiKeyboard and then close the EmojiKeyboard', async () => {
|
|
|
|
await element(by.id('messagebox-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')).typeText('smiley');
|
|
|
|
await waitFor(element(by.id('searched-emoji-smiley')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await element(by.id('searched-emoji-smiley')).tap();
|
|
|
|
await expect(element(by.id('messagebox-input'))).toHaveText('😃');
|
|
|
|
await element(by.id('emoji-searchbar-input')).clearText();
|
|
|
|
await element(by.id('emoji-searchbar-input')).typeText('random-text');
|
|
|
|
await waitFor(element(by.id('no-results-found')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await element(by.id('emoji-searchbar-input')).clearText();
|
|
|
|
await expect(element(by.id('openback-emoji-keyboard'))).toExist();
|
|
|
|
await element(by.id('openback-emoji-keyboard')).tap();
|
|
|
|
await waitFor(element(by.id('emoji-searchbar-input')))
|
|
|
|
.not.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await expect(element(by.id('messagebox-close-emoji'))).toExist();
|
|
|
|
await element(by.id('messagebox-close-emoji')).tap();
|
|
|
|
await waitFor(element(by.id('messagebox-keyboard-emoji')))
|
|
|
|
.not.toBeVisible()
|
|
|
|
.withTimeout(10000);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should show/hide emoji autocomplete', async () => {
|
2022-08-24 19:09:54 +00:00
|
|
|
await element(by.id('messagebox-input')).clearText();
|
2020-03-03 20:27:38 +00:00
|
|
|
await element(by.id('messagebox-input')).typeText(':joy');
|
2021-12-02 13:19:15 +00:00
|
|
|
await sleep(300);
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('messagebox-container')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(10000);
|
2018-05-23 13:39:18 +00:00
|
|
|
await element(by.id('messagebox-input')).clearText();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('messagebox-container')))
|
|
|
|
.toBeNotVisible()
|
|
|
|
.withTimeout(10000);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
2019-05-28 13:03:08 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should show and tap on emoji autocomplete', async () => {
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by.id('messagebox-input')).typeText(':joy');
|
|
|
|
await sleep(300);
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('messagebox-container')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(10000);
|
2022-05-26 17:10:24 +00:00
|
|
|
await waitFor(element(by.id('mention-item-joy')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(10000);
|
2018-05-23 13:39:18 +00:00
|
|
|
await element(by.id('mention-item-joy')).tap();
|
|
|
|
await expect(element(by.id('messagebox-input'))).toHaveText(':joy: ');
|
|
|
|
await element(by.id('messagebox-input')).clearText();
|
|
|
|
});
|
2019-05-28 13:03:08 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should not show emoji autocomplete on semicolon in middle of a string', async () => {
|
2021-07-02 17:39:39 +00:00
|
|
|
await element(by.id('messagebox-input')).typeText('name:is');
|
2021-12-02 13:19:15 +00:00
|
|
|
await sleep(300);
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('messagebox-container')))
|
|
|
|
.toNotExist()
|
|
|
|
.withTimeout(20000);
|
2021-04-07 18:56:16 +00:00
|
|
|
await element(by.id('messagebox-input')).clearText();
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should show and tap on user autocomplete and send mention', async () => {
|
2021-07-02 17:39:39 +00:00
|
|
|
const { username } = data.users.regular;
|
2021-12-02 13:19:15 +00:00
|
|
|
const messageMention = `@${username}`;
|
|
|
|
const message = `${data.random}mention`;
|
|
|
|
const fullMessage = `${messageMention} ${message}`;
|
2021-09-13 20:41:05 +00:00
|
|
|
await element(by.id('messagebox-input')).typeText(`@${username}`);
|
2021-12-02 13:19:15 +00:00
|
|
|
await sleep(300);
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('messagebox-container')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(4000);
|
|
|
|
await waitFor(element(by.id(`mention-item-${username}`)))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(4000);
|
|
|
|
await tryTapping(element(by.id(`mention-item-${username}`)), 2000, true);
|
2021-12-02 13:19:15 +00:00
|
|
|
await expect(element(by.id('messagebox-input'))).toHaveText(`${messageMention} `);
|
2021-07-02 17:39:39 +00:00
|
|
|
await tryTapping(element(by.id('messagebox-input')), 2000);
|
2021-12-02 13:19:15 +00:00
|
|
|
if (device.getPlatform() === 'ios') {
|
|
|
|
await element(by.id('messagebox-input')).typeText(message);
|
|
|
|
await element(by.id('messagebox-send-message')).tap();
|
|
|
|
const fullMessageMatcher = fullMessage.substr(1); // removes `@`
|
|
|
|
await waitFor(element(by[textMatcher](fullMessageMatcher)))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(60000);
|
|
|
|
await expect(element(by[textMatcher](fullMessageMatcher))).toExist();
|
|
|
|
await element(by[textMatcher](fullMessageMatcher)).atIndex(0).tap();
|
|
|
|
} else {
|
|
|
|
await element(by.id('messagebox-input')).replaceText(fullMessage);
|
|
|
|
await element(by.id('messagebox-send-message')).tap();
|
|
|
|
}
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
2019-05-28 13:03:08 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should not show user autocomplete on @ in the middle of a string', async () => {
|
2021-07-02 17:39:39 +00:00
|
|
|
await element(by.id('messagebox-input')).typeText('email@gmail');
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('messagebox-container')))
|
|
|
|
.toNotExist()
|
|
|
|
.withTimeout(4000);
|
2021-04-07 18:56:16 +00:00
|
|
|
await element(by.id('messagebox-input')).clearText();
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should show and tap on room autocomplete', async () => {
|
2018-05-23 13:39:18 +00:00
|
|
|
await element(by.id('messagebox-input')).typeText('#general');
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('mention-item-general')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(4000);
|
2021-07-02 17:39:39 +00:00
|
|
|
await tryTapping(element(by.id('mention-item-general')), 2000, true);
|
2018-05-23 13:39:18 +00:00
|
|
|
await expect(element(by.id('messagebox-input'))).toHaveText('#general ');
|
|
|
|
await element(by.id('messagebox-input')).clearText();
|
|
|
|
});
|
2021-03-18 13:27:37 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should not show room autocomplete on # in middle of a string', async () => {
|
2021-04-07 18:56:16 +00:00
|
|
|
await element(by.id('messagebox-input')).tap();
|
|
|
|
await element(by.id('messagebox-input')).typeText('te#gen');
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('messagebox-container')))
|
|
|
|
.toNotExist()
|
|
|
|
.withTimeout(4000);
|
2021-04-07 18:56:16 +00:00
|
|
|
await element(by.id('messagebox-input')).clearText();
|
|
|
|
});
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should draft message', async () => {
|
|
|
|
await element(by.id('messagebox-input')).typeText(`${data.random}draft`);
|
2021-03-18 13:27:37 +00:00
|
|
|
await tapBack();
|
|
|
|
|
|
|
|
await navigateToRoom(mainRoom);
|
2021-09-13 20:41:05 +00:00
|
|
|
await expect(element(by.id('messagebox-input'))).toHaveText(`${data.random}draft`);
|
2021-03-18 13:27:37 +00:00
|
|
|
await element(by.id('messagebox-input')).clearText();
|
|
|
|
await tapBack();
|
|
|
|
|
|
|
|
await navigateToRoom(mainRoom);
|
|
|
|
await expect(element(by.id('messagebox-input'))).toHaveText('');
|
2021-07-02 17:39:39 +00:00
|
|
|
});
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
2021-07-02 17:39:39 +00:00
|
|
|
describe('Message', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should copy permalink', async () => {
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by[textMatcher](`${data.random}message`))
|
2021-09-13 20:41:05 +00:00
|
|
|
.atIndex(0)
|
|
|
|
.longPress();
|
2021-12-02 13:19:15 +00:00
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
2020-06-15 19:35:45 +00:00
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
|
|
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by[textMatcher]('Permalink')).atIndex(0).tap();
|
2018-05-23 13:39:18 +00:00
|
|
|
// TODO: test clipboard
|
|
|
|
});
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should copy message', async () => {
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by[textMatcher](`${data.random}message`))
|
2021-09-13 20:41:05 +00:00
|
|
|
.atIndex(0)
|
|
|
|
.longPress();
|
2021-12-02 13:19:15 +00:00
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
2020-06-15 19:35:45 +00:00
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
|
|
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by[textMatcher]('Copy')).atIndex(0).tap();
|
2018-05-23 13:39:18 +00:00
|
|
|
// TODO: test clipboard
|
|
|
|
});
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should star message', async () => {
|
2021-07-02 17:39:39 +00:00
|
|
|
await starMessage('message');
|
|
|
|
await sleep(1000); // https://github.com/RocketChat/Rocket.Chat.ReactNative/issues/2324
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by[textMatcher](`${data.random}message`))
|
2021-09-13 20:41:05 +00:00
|
|
|
.atIndex(0)
|
|
|
|
.longPress();
|
2021-12-02 13:19:15 +00:00
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
2020-06-15 19:35:45 +00:00
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
2021-04-19 14:31:43 +00:00
|
|
|
await element(by.id('action-sheet-handle')).swipe('up', 'slow', 0.5);
|
2021-12-02 13:19:15 +00:00
|
|
|
await waitFor(element(by[textMatcher]('Unstar')).atIndex(0))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toExist()
|
|
|
|
.withTimeout(6000);
|
2021-04-19 14:31:43 +00:00
|
|
|
await element(by.id('action-sheet-handle')).swipe('down', 'fast', 0.8);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should react to message', async () => {
|
2021-12-02 13:19:15 +00:00
|
|
|
await waitFor(element(by[textMatcher](`${data.random}message`)))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(60000);
|
|
|
|
await element(by[textMatcher](`${data.random}message`))
|
|
|
|
.atIndex(0)
|
|
|
|
.tap();
|
|
|
|
await element(by[textMatcher](`${data.random}message`))
|
2021-09-13 20:41:05 +00:00
|
|
|
.atIndex(0)
|
|
|
|
.longPress();
|
2021-12-02 13:19:15 +00:00
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
2020-06-15 19:35:45 +00:00
|
|
|
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();
|
2022-08-24 19:09:54 +00:00
|
|
|
await waitFor(element(by.id('emoji-picker-tab-emoji')))
|
|
|
|
.toExist()
|
2021-09-13 20:41:05 +00:00
|
|
|
.withTimeout(2000);
|
2022-08-24 19:09:54 +00:00
|
|
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 1);
|
|
|
|
await element(by.id('emoji-picker-tab-emoji')).tap();
|
|
|
|
await waitFor(element(by.id('emoji-grinning')))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toExist()
|
2022-05-26 17:10:24 +00:00
|
|
|
.withTimeout(10000);
|
2022-08-24 19:09:54 +00:00
|
|
|
await element(by.id('emoji-grinning')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('message-reaction-:grinning:')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(60000);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
2022-08-24 19:09:54 +00:00
|
|
|
it('should search emojis in the reaction picker and react', async () => {
|
|
|
|
await element(by[textMatcher](`${data.random}message`))
|
|
|
|
.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('reaction-picker-searchbar')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
|
|
|
await element(by.id('reaction-picker-searchbar')).typeText('smile');
|
|
|
|
await waitFor(element(by.id('emoji-smile')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(4000);
|
|
|
|
await element(by.id('emoji-smile')).tap();
|
|
|
|
await waitFor(element(by.id('message-reaction-:smile:')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(60000);
|
|
|
|
});
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should react to message with frequently used emoji', async () => {
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by[textMatcher](`${data.random}message`))
|
2021-09-13 20:41:05 +00:00
|
|
|
.atIndex(0)
|
|
|
|
.longPress();
|
2021-12-02 13:19:15 +00:00
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
2020-06-15 19:35:45 +00:00
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
|
|
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('message-actions-emoji-+1')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(2000);
|
2020-06-15 19:35:45 +00:00
|
|
|
await element(by.id('message-actions-emoji-+1')).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('message-reaction-:+1:')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(60000);
|
2020-06-15 19:35:45 +00:00
|
|
|
});
|
2021-12-02 13:19:15 +00:00
|
|
|
it('should show reaction picker on add reaction button pressed and have frequently used emoji, and dismiss review nag', async () => {
|
2018-05-23 13:39:18 +00:00
|
|
|
await element(by.id('message-add-reaction')).tap();
|
2022-08-24 19:09:54 +00:00
|
|
|
await waitFor(element(by.id('action-sheet')))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
2022-08-24 19:09:54 +00:00
|
|
|
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')))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toExist()
|
2022-08-24 19:09:54 +00:00
|
|
|
.withTimeout(4000);
|
|
|
|
await waitFor(element(by.id('emoji-picker-tab-emoji')))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
2022-08-24 19:09:54 +00:00
|
|
|
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:')))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toExist()
|
|
|
|
.withTimeout(60000);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should remove reaction', async () => {
|
2022-08-24 19:09:54 +00:00
|
|
|
await element(by.id('message-reaction-:smile:')).tap();
|
|
|
|
await waitFor(element(by.id('message-reaction-:smile:')))
|
|
|
|
.not.toExist()
|
2021-09-13 20:41:05 +00:00
|
|
|
.withTimeout(60000);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
2021-12-02 13:19:15 +00:00
|
|
|
it('should ask for review', async () => {
|
|
|
|
await dismissReviewNag(); // TODO: Create a proper test for this elsewhere.
|
|
|
|
});
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should edit message', async () => {
|
2018-05-24 20:17:45 +00:00
|
|
|
await mockMessage('edit');
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by[textMatcher](`${data.random}edit`))
|
2021-09-13 20:41:05 +00:00
|
|
|
.atIndex(0)
|
|
|
|
.longPress();
|
2021-12-02 13:19:15 +00:00
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
2020-06-15 19:35:45 +00:00
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
|
|
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by[textMatcher]('Edit')).atIndex(0).tap();
|
|
|
|
await element(by.id('messagebox-input')).replaceText(`${data.random}edited`);
|
2018-05-24 20:17:45 +00:00
|
|
|
await element(by.id('messagebox-send-message')).tap();
|
2022-05-26 17:10:24 +00:00
|
|
|
await waitFor(element(by[textMatcher](`${data.random}edited`)).atIndex(0))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(60000);
|
|
|
|
await waitFor(element(by.id(`${data.random}edited-edited`)))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toExist()
|
|
|
|
.withTimeout(60000);
|
2018-05-24 20:17:45 +00:00
|
|
|
});
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should quote message', async () => {
|
2018-05-24 20:17:45 +00:00
|
|
|
await mockMessage('quote');
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by[textMatcher](`${data.random}quote`))
|
2021-09-13 20:41:05 +00:00
|
|
|
.atIndex(0)
|
|
|
|
.longPress();
|
2021-12-02 13:19:15 +00:00
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
2020-06-15 19:35:45 +00:00
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
|
|
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by[textMatcher]('Quote')).atIndex(0).tap();
|
|
|
|
await element(by.id('messagebox-input')).replaceText(`${data.random}quoted`);
|
|
|
|
await waitFor(element(by.id('messagebox-send-message')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
2018-05-24 20:17:45 +00:00
|
|
|
await element(by.id('messagebox-send-message')).tap();
|
|
|
|
// TODO: test if quote was sent
|
|
|
|
});
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should pin message', async () => {
|
2021-07-02 17:39:39 +00:00
|
|
|
await mockMessage('pin');
|
|
|
|
await pinMessage('pin');
|
2021-12-02 13:19:15 +00:00
|
|
|
await waitFor(element(by[textMatcher](`${data.random}pin`)).atIndex(0))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toExist()
|
|
|
|
.withTimeout(5000);
|
2021-12-02 13:19:15 +00:00
|
|
|
await waitFor(element(by[textMatcher](`${data.users.regular.username} Message pinned`)).atIndex(0))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toExist()
|
|
|
|
.withTimeout(5000);
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by[textMatcher](`${data.random}pin`))
|
2021-09-13 20:41:05 +00:00
|
|
|
.atIndex(0)
|
|
|
|
.longPress();
|
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(1000);
|
2020-06-15 19:35:45 +00:00
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
|
|
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
2021-12-02 13:19:15 +00:00
|
|
|
await waitFor(element(by[textMatcher]('Unpin')).atIndex(0))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
2021-04-19 14:31:43 +00:00
|
|
|
await element(by.id('action-sheet-handle')).swipe('down', 'fast', 0.8);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should delete message', async () => {
|
2021-07-02 17:39:39 +00:00
|
|
|
await mockMessage('delete');
|
2021-12-02 13:19:15 +00:00
|
|
|
await waitFor(element(by[textMatcher](`${data.random}delete`)).atIndex(0)).toBeVisible();
|
|
|
|
await element(by[textMatcher](`${data.random}delete`))
|
2021-09-13 20:41:05 +00:00
|
|
|
.atIndex(0)
|
|
|
|
.longPress();
|
2021-12-02 13:19:15 +00:00
|
|
|
await waitFor(element(by.id('action-sheet')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(2000);
|
2020-06-15 19:35:45 +00:00
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
|
|
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
2021-12-02 13:19:15 +00:00
|
|
|
await waitFor(element(by[textMatcher]('Delete')))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toExist()
|
|
|
|
.withTimeout(1000);
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by[textMatcher]('Delete')).atIndex(0).tap();
|
2020-06-15 19:35:45 +00:00
|
|
|
const deleteAlertMessage = 'You will not be able to recover this message!';
|
2021-12-02 13:19:15 +00:00
|
|
|
await waitFor(element(by[textMatcher](deleteAlertMessage)).atIndex(0))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toExist()
|
|
|
|
.withTimeout(10000);
|
2021-12-02 13:19:15 +00:00
|
|
|
await element(by[textMatcher]('Delete').and(by.type(alertButtonType))).tap();
|
|
|
|
await waitFor(element(by[textMatcher](`${data.random}delete`)).atIndex(0))
|
2021-09-13 20:41:05 +00:00
|
|
|
.toNotExist()
|
|
|
|
.withTimeout(2000);
|
2020-06-15 19:35:45 +00:00
|
|
|
});
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
});
|
2020-12-01 19:26:03 +00:00
|
|
|
});
|