From cbd9b27cf7085416aa3884827fb648d961af60f5 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Fri, 2 Dec 2022 14:06:14 -0300 Subject: [PATCH] [FIX] Cannot read property 'fetch' of undefined on ThreadMessagesView (#4557) * [FIX] Cannot read property 'fetch' of undefined on ThreadMessagesView * added e2e test * change from _raw to _id * test thread messages view with a thread created --- app/views/ThreadMessagesView/index.tsx | 4 ++-- .../assorted/09-joinfromdirectory.spec.ts | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/app/views/ThreadMessagesView/index.tsx b/app/views/ThreadMessagesView/index.tsx index 2aee455b8..2769b3302 100644 --- a/app/views/ThreadMessagesView/index.tsx +++ b/app/views/ThreadMessagesView/index.tsx @@ -142,7 +142,7 @@ class ThreadMessagesView extends React.Component ( - + ) }; @@ -242,7 +242,7 @@ class ThreadMessagesView extends React.Component ({ messages: [...messages, ...update] })); return; } diff --git a/e2e/tests/assorted/09-joinfromdirectory.spec.ts b/e2e/tests/assorted/09-joinfromdirectory.spec.ts index ab181b9ed..c9e19efb2 100644 --- a/e2e/tests/assorted/09-joinfromdirectory.spec.ts +++ b/e2e/tests/assorted/09-joinfromdirectory.spec.ts @@ -1,5 +1,6 @@ import data from '../../data'; import { navigateToLogin, login, tapBack, sleep } from '../../helpers/app'; +import { sendMessage } from '../../helpers/data_setup'; const testuser = data.users.regular; @@ -26,6 +27,13 @@ describe('Join room from directory', () => { }); describe('Usage', () => { + const threadMessage = `thread-${data.random}`; + before(async () => { + const result = await sendMessage(data.users.alternate, data.channels.detoxpublic.name, threadMessage); + const threadId = result.message._id; + await sendMessage(data.users.alternate, result.message.rid, data.random, threadId); + }); + it('should tap directory', async () => { await element(by.id('rooms-list-view-directory')).tap(); await waitFor(element(by.id('directory-view'))) @@ -37,6 +45,20 @@ describe('Join room from directory', () => { await navigateToRoom(data.channels.detoxpublic.name); }); + it('should navigate to thread messages view and load messages', async () => { + await waitFor(element(by.id('room-view-header-threads'))) + .toBeVisible() + .withTimeout(2000); + await element(by.id('room-view-header-threads')).tap(); + await waitFor(element(by.id(`thread-messages-view-${threadMessage}`))) + .toBeVisible() + .withTimeout(2000); + await tapBack(); + await waitFor(element(by.id('room-view-header-threads'))) + .toBeVisible() + .withTimeout(2000); + }); + it('should search user and navigate', async () => { await tapBack(); await element(by.id('rooms-list-view-directory')).tap();