-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[TEST] E2E for Jump to Message #3202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
11c3af0
8e9efa1
29a1032
ae8297d
2f37aa0
7bfe83a
706e86a
5b18885
6c66049
dd3f8a3
d6d7be5
b0bdbbb
ef47bce
b328b57
38813cc
d5fde89
47a6566
2f57350
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -149,6 +149,10 @@ const setup = async () => { | |
|
|
||
| await login(data.users.regular.username, data.users.regular.password) | ||
|
|
||
| await createChannelIfNotExists(`jumpToMessageChat${data.random}`); | ||
|
gerzonc marked this conversation as resolved.
Outdated
|
||
| await createChannelIfNotExists(`jumpToMessageThreads${data.random}`); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't forget to create the script for docker |
||
|
|
||
|
|
||
| for (var groupKey in data.groups) { | ||
| if (data.groups.hasOwnProperty(groupKey)) { | ||
| const group = data.groups[groupKey] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,295 @@ | ||
| const { | ||
| device, expect, element, by, waitFor | ||
| } = require('detox'); | ||
| const data = require('../../data'); | ||
| const { navigateToLogin, login, mockMessage, tapBack, sleep, searchRoom, starMessage, pinMessage, dismissReviewNag, tryTapping } = require('../../helpers/app'); | ||
| const { post, get } = require('../../helpers/data_setup'); | ||
| const deepLink = msg => `https://mobile.rocket.chat/channel/jumpToMessageChatrwurojjluzrbfxyocppa?msg=${msg}`; | ||
|
gerzonc marked this conversation as resolved.
Outdated
|
||
| let url; | ||
|
|
||
| async function navigateToRoom(roomName) { | ||
| await searchRoom(`${ roomName }`); | ||
| await element(by.id(`rooms-list-view-item-${ roomName }`)).tap(); | ||
| await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(5000); | ||
| } | ||
| describe('Room', () => { | ||
|
gerzonc marked this conversation as resolved.
Outdated
|
||
| const mainRoom = `jumpToMessageChat${data.random}`; | ||
|
|
||
| before(async() => { | ||
| for(let x = 1; x <= 200; x++) { | ||
|
gerzonc marked this conversation as resolved.
Outdated
|
||
| console.log(`Sending message ${x} to ${mainRoom}`) | ||
| if (x === 30) { | ||
| const { data: { message } } = await post('chat.postMessage', { channel: mainRoom, msg: x }); | ||
| url = deepLink(message._id); | ||
| } else if (x === 200) { | ||
| await post('chat.postMessage', { channel: mainRoom, msg: `[](${url}) ${x}` }); | ||
| } else { | ||
| await post('chat.postMessage', { channel: mainRoom, msg: x }); | ||
| } | ||
|
|
||
| } | ||
| await device.launchApp({ permissions: { notifications: 'YES' }, delete: true }); | ||
| await navigateToLogin(); | ||
| await login(data.users.regular.username, data.users.regular.password); | ||
| await navigateToRoom(mainRoom); | ||
| }); | ||
|
|
||
| describe('Render room', async() => { | ||
| it('should have room screen', async() => { | ||
| await expect(element(by.id('room-view'))).toExist(); | ||
| await waitFor(element(by.id(`room-view-title-${ mainRoom }`))).toExist().withTimeout(5000); | ||
| }); | ||
|
|
||
| describe('Header', async() => { | ||
| it('should have actions button ', async() => { | ||
| await expect(element(by.id('room-header'))).toExist(); | ||
| }); | ||
|
|
||
| it('should have threads button ', async() => { | ||
| await expect(element(by.id('room-view-header-threads'))).toExist(); | ||
| }); | ||
| }); | ||
|
|
||
| describe('Messagebox', async() => { | ||
| it('should have messagebox', async() => { | ||
| await expect(element(by.id('messagebox'))).toExist(); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| describe('Load messages on chat', async() => { | ||
| it('should jump to an old message and load its surroundings', async() => { | ||
|
gerzonc marked this conversation as resolved.
Outdated
|
||
| await waitFor(element(by.label('200'))).toExist().withTimeout(5000); | ||
| await waitFor(element(by.label('30'))).toExist().withTimeout(5000); | ||
| await element(by.label('30')).tap(); | ||
| await waitFor(element(by.label('29'))).toExist().withTimeout(5000); | ||
| await waitFor(element(by.label('31'))).toExist().withTimeout(5000); | ||
| await sleep(3000); | ||
|
gerzonc marked this conversation as resolved.
Outdated
|
||
| }); | ||
|
|
||
| it('should load messages on scroll', async() => { | ||
|
gerzonc marked this conversation as resolved.
Outdated
|
||
| await waitFor(element(by.id('nav-jump-to-bottom'))).toExist().withTimeout(5000); | ||
| await element(by.id('nav-jump-to-bottom')).tap(); | ||
| await waitFor(element(by.id('room-view-messages'))).toExist().withTimeout(5000); | ||
| await sleep(5000); | ||
| await element(by.id('room-view-messages')).atIndex(0).swipe('down', 'fast', 0.8); | ||
| await waitFor(element(by.label('160'))).toExist().withTimeout(5000); | ||
| }); | ||
|
|
||
| it('should look for old message and load its surroundings', async() => { | ||
|
gerzonc marked this conversation as resolved.
Outdated
|
||
| await element(by.id('room-view-search')).tap(); | ||
| await waitFor(element(by.id('search-messages-view'))).toExist().withTimeout(5000); | ||
| await element(by.id('search-message-view-input')).typeText('30\n'); | ||
| await sleep(1000); | ||
| await waitFor(element(by.label('30')).atIndex(0)).toExist().withTimeout(5000); | ||
| await element(by.label('30')).atIndex(1).tap(); | ||
| await waitFor(element(by.label('30'))).toExist().withTimeout(6000); | ||
| await waitFor(element(by.label('32'))).toExist().withTimeout(6000); | ||
| await waitFor(element(by.label('31'))).toExist().withTimeout(6000); | ||
| await waitFor(element(by.label('29'))).toExist().withTimeout(6000); | ||
| await waitFor(element(by.label('28'))).toExist().withTimeout(6000); | ||
| }) | ||
|
|
||
| it('should load newer and older messages', async() => { | ||
|
gerzonc marked this conversation as resolved.
Outdated
|
||
| await sleep(3000); | ||
| await element(by.id('room-view-messages')).atIndex(0).swipe('down', 'fast', 0.8); | ||
| await waitFor(element(by.label('5'))).toExist().withTimeout(5000); | ||
| await waitFor(element(by.label('Load Older'))).toExist().withTimeout(5000); | ||
| await element(by.label('Load Older')).atIndex(0).tap(); | ||
| await waitFor(element(by.label('4'))).toExist().withTimeout(5000); | ||
| await element(by.id('room-view-messages')).atIndex(0).swipe('down', 'fast', 0.5); | ||
| await waitFor(element(by.label('1'))).toExist().withTimeout(5000); | ||
| await element(by.id('room-view-messages')).atIndex(0).swipe('up', 'fast', 0.5); | ||
| await waitFor(element(by.label('25'))).toExist().withTimeout(5000); | ||
| await element(by.id('room-view-messages')).atIndex(0).swipe('up', 'fast', 0.5); | ||
| await waitFor(element(by.label('50'))).toExist().withTimeout(5000); | ||
| await element(by.id('room-view-messages')).atIndex(0).swipe('up', 'slow', 0.5); | ||
| await waitFor(element(by.label('Load Newer'))).toExist().withTimeout(5000); | ||
| await element(by.label('Load Newer')).atIndex(0).tap(); | ||
| await waitFor(element(by.label('98'))).toExist().withTimeout(5000); | ||
| await waitFor(element(by.label('99'))).toExist().withTimeout(5000); | ||
| await waitFor(element(by.label('100'))).toExist().withTimeout(5000); | ||
| }); | ||
| }); | ||
|
|
||
| describe('Jump to message on chat', async() => { | ||
|
|
||
| it('should jump from search message', async() => { | ||
|
gerzonc marked this conversation as resolved.
Outdated
|
||
| await element(by.id('room-view-search')).tap(); | ||
| await waitFor(element(by.id('search-messages-view'))).toExist().withTimeout(5000); | ||
| await element(by.id('search-message-view-input')).typeText('2\n'); | ||
| await sleep(1000); | ||
| await waitFor(element(by.label('2')).atIndex(0)).toExist().withTimeout(5000); | ||
| }); | ||
|
|
||
| it('should quote an old message from the chat', async() => { | ||
|
gerzonc marked this conversation as resolved.
Outdated
|
||
| await element(by.label('2')).atIndex(1).tap(); | ||
| await waitFor(element(by.label('2')).atIndex(1)).toExist().withTimeout(10000); | ||
| await sleep(14000); | ||
| await element(by.label('2')).atIndex(1).longPress(); | ||
| await waitFor(element(by.label('Quote')).atIndex(0)).toExist().withTimeout(5000); | ||
| await element(by.label('Quote')).atIndex(0).tap(); | ||
| await element(by.id('messagebox-input')).tap(); | ||
| await element(by.id('messagebox-input')).typeText(`${ data.random }response`); | ||
| await element(by.id('messagebox-send-message')).tap(); | ||
| await waitFor(element(by.id('nav-jump-to-bottom'))).toExist().withTimeout(5000); | ||
| await element(by.id('nav-jump-to-bottom')).tap(); | ||
| }) | ||
|
|
||
| it('should jump to message', async() => { | ||
|
gerzonc marked this conversation as resolved.
Outdated
|
||
| await waitFor(element(by.label(`${data.random}response`))).toExist().withTimeout(15000); | ||
| await waitFor(element(by.label('2')).atIndex(1)).toExist().withTimeout(5000); | ||
| await element(by.label('2')).atIndex(0).tap(); | ||
| await waitFor(element(by.label('2'))).toExist().withTimeout(5000); | ||
| await waitFor(element(by.label('3'))).toExist().withTimeout(5000); | ||
|
|
||
| }); | ||
|
|
||
| it('should jump to another chat with deep linking', async() => { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is jumping to messages from another channel and not deep linking. |
||
| await sleep(6000); | ||
| await tapBack(); | ||
| await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(5000); | ||
| await waitFor(element(by.id(`rooms-list-view-item-${ data.groups.private.name }`))).toExist().withTimeout(5000); | ||
| await element(by.id(`rooms-list-view-item-${ data.groups.private.name }`)).tap(); | ||
| await waitFor(element(by.id('messagebox-input'))).toBeVisible().withTimeout(5000); | ||
| await element(by.id('messagebox-input')).tap(); | ||
| await element(by.id('messagebox-input')).replaceText(url); | ||
| await element(by.id('messagebox-send-message')).tap(); | ||
| await waitFor(element(by.label(url)).atIndex(0)).toExist().withTimeout(8000); | ||
| await element(by.label(url)).atIndex(0).tap(); | ||
| await waitFor(element(by.label('30'))).toExist().withTimeout(10000); | ||
| }) | ||
| }); | ||
| }); | ||
|
|
||
| describe('Threads', async() => { | ||
| const threadRoom = `jumpToMessageThreads${data.random}`; | ||
| before(async() => { | ||
|
gerzonc marked this conversation as resolved.
Outdated
|
||
| const { data: { message } } = await post('chat.postMessage', { channel: threadRoom, msg: 'Sample message for thread' }); | ||
| const { data: { channel } } = await get(`channels.info?roomName=${threadRoom}`); | ||
| for(let x = 1; x <= 200; x++) { | ||
| console.log(`Sending message ${x} to thread in ${threadRoom}`); | ||
| if (x === 30) { | ||
| const result = await post('chat.postMessage', { | ||
| tmid: message._id, | ||
| text: x, | ||
| roomId: channel._id, | ||
| }); | ||
| url = deepLink(result.data?.message._id); | ||
| } else if (x === 200) { | ||
| await post('chat.postMessage', { | ||
| tmid: message._id, | ||
| text: `[](${url}) ${x}`, | ||
| roomId: channel._id, | ||
| }); | ||
| } else { | ||
| await post('chat.postMessage', { | ||
| tmid: message._id, | ||
| text: x, | ||
| roomId: channel._id, | ||
| }); | ||
| } | ||
| } | ||
| await device.launchApp({ permissions: { notifications: 'YES' }, delete: true }); | ||
| await navigateToLogin(); | ||
| await login(data.users.regular.username, data.users.regular.password); | ||
| await navigateToRoom(threadRoom); | ||
| }); | ||
|
|
||
| describe('Load messages on chat', async() => { | ||
| it('should jump to an old message and load its surroundings', async() => { | ||
| await waitFor(element(by.label('Sample message for thread'))).toExist().withTimeout(5000); | ||
| await sleep(5000); | ||
| // we should change this once we come up with a fix | ||
| await waitFor(element(by.label('Load More')).atIndex(0)).toExist().withTimeout(8000); | ||
| await element(by.label('Load More')).atIndex(0).tap(); | ||
| await waitFor(element(by.label('Load More')).atIndex(0)).toExist().withTimeout(8000); | ||
| await element(by.label('Load More')).atIndex(0).tap(); | ||
| await waitFor(element(by.label('Load More')).atIndex(0)).toExist().withTimeout(8000); | ||
| await element(by.label('Load More')).atIndex(0).tap(); | ||
| await waitFor(element(by.label('Load More')).atIndex(0)).toExist().withTimeout(8000); | ||
| await element(by.label('Load More')).atIndex(0).tap(); | ||
| await waitFor(element(by.label('Reply')).atIndex(0)).toExist().withTimeout(5000); | ||
| await element(by.label('Reply')).atIndex(0).tap(); | ||
| await waitFor(element(by.label('200'))).toExist().withTimeout(5000); | ||
| await waitFor(element(by.label('30'))).toExist().withTimeout(5000); | ||
| await element(by.label('30')).tap(); | ||
| await waitFor(element(by.label('29'))).toExist().withTimeout(8000); | ||
| await waitFor(element(by.label('31'))).toExist().withTimeout(8000); | ||
| await sleep(3000); | ||
| }); | ||
|
|
||
| it('should load messages on scroll', async() => { | ||
| await waitFor(element(by.id('nav-jump-to-bottom'))).toExist().withTimeout(5000); | ||
| await element(by.id('nav-jump-to-bottom')).tap(); | ||
| await waitFor(element(by.id('room-view'))).toExist().withTimeout(5000); | ||
| await sleep(5000); | ||
| await element(by.id('room-view-messages')).atIndex(1).swipe('down', 'fast', 0.8); | ||
| await waitFor(element(by.label('160'))).toExist().withTimeout(5000); | ||
| }); | ||
|
|
||
| it('should look for old message and load its surroundings', async() => { | ||
| await tapBack(); | ||
| await element(by.id('room-view-search')).tap(); | ||
| await waitFor(element(by.id('search-messages-view'))).toExist().withTimeout(5000); | ||
| await element(by.id('search-message-view-input')).typeText('30\n'); | ||
| await sleep(1000); | ||
| await waitFor(element(by.label('30')).atIndex(0)).toExist().withTimeout(8000); | ||
| await element(by.label('30')).atIndex(1).tap(); | ||
| await waitFor(element(by.label('30'))).toExist().withTimeout(10000); | ||
| await waitFor(element(by.label('32'))).toExist().withTimeout(6000); | ||
| await waitFor(element(by.label('31'))).toExist().withTimeout(6000); | ||
| await waitFor(element(by.label('29'))).toExist().withTimeout(6000); | ||
| await waitFor(element(by.label('28'))).toExist().withTimeout(6000); | ||
| }) | ||
| }); | ||
|
|
||
| describe('Jump to message on threads', async() => { | ||
|
gerzonc marked this conversation as resolved.
Outdated
|
||
| it('should jump from search message', async() => { | ||
| await tapBack(); | ||
| await element(by.id('room-view-search')).tap(); | ||
| await waitFor(element(by.id('search-messages-view'))).toExist().withTimeout(5000); | ||
| await element(by.id('search-message-view-input')).typeText('2\n'); | ||
| await sleep(1000); | ||
| await waitFor(element(by.label('2')).atIndex(0)).toExist().withTimeout(10000); | ||
| }); | ||
|
|
||
| it('should quote an old message from the chat', async() => { | ||
| await element(by.label('2')).atIndex(1).tap(); | ||
| await waitFor(element(by.label('2')).atIndex(1)).toExist().withTimeout(10000); | ||
| await sleep(15000); | ||
| await element(by.label('2')).atIndex(1).longPress(); | ||
| await waitFor(element(by.label('Quote')).atIndex(0)).toExist().withTimeout(5000); | ||
| await element(by.label('Quote')).atIndex(0).tap(); | ||
| await element(by.id('messagebox-input-thread')).tap(); | ||
| await element(by.id('messagebox-input-thread')).typeText(`${ data.random }response`); | ||
| await element(by.id('messagebox-send-message')).tap(); | ||
| await waitFor(element(by.id('nav-jump-to-bottom'))).toExist().withTimeout(5000); | ||
| await element(by.id('nav-jump-to-bottom')).tap(); | ||
| }) | ||
|
|
||
| it('should jump to message', async() => { | ||
| await waitFor(element(by.label(`${data.random}response`))).toExist().withTimeout(15000); | ||
| await waitFor(element(by.label('2')).atIndex(1)).toExist().withTimeout(5000); | ||
| await element(by.label('2')).atIndex(0).tap(); | ||
| await waitFor(element(by.label('2'))).toExist().withTimeout(5000); | ||
| await waitFor(element(by.label('3'))).toExist().withTimeout(5000); | ||
| }); | ||
|
|
||
| it('should jump to another chat with deep linking', async() => { | ||
| await sleep(6000); | ||
| await tapBack(); | ||
| await tapBack(); | ||
| await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(5000); | ||
| await waitFor(element(by.id(`rooms-list-view-item-${ data.groups.private.name }`))).toExist().withTimeout(5000); | ||
| await element(by.id(`rooms-list-view-item-${ data.groups.private.name }`)).tap(); | ||
| await waitFor(element(by.id('messagebox-input'))).toBeVisible().withTimeout(5000); | ||
| await element(by.id('messagebox-input')).tap(); | ||
| await element(by.id('messagebox-input')).replaceText(url); | ||
| await element(by.id('messagebox-send-message')).tap(); | ||
| await waitFor(element(by.label(url)).atIndex(0)).toExist().withTimeout(8000); | ||
| await element(by.label(url)).atIndex(0).tap(); | ||
| await waitFor(element(by.label('30'))).toExist().withTimeout(10000); | ||
| }); | ||
| }); | ||
| }); | ||
Uh oh!
There was an error while loading. Please reload this page.