From e9d4afec534349e9934cbd608f57ed010a61fd79 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Sat, 28 Dec 2024 15:27:12 +0100 Subject: [PATCH] DEV: simplify restore message spec (#30490) This spec was flaky, by not using a second session and rely on services instead, I hope to make it more stable and faster. --- .../spec/system/thread_list/full_page_spec.rb | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/plugins/chat/spec/system/thread_list/full_page_spec.rb b/plugins/chat/spec/system/thread_list/full_page_spec.rb index 03072d857a4..440aa698596 100644 --- a/plugins/chat/spec/system/thread_list/full_page_spec.rb +++ b/plugins/chat/spec/system/thread_list/full_page_spec.rb @@ -181,24 +181,12 @@ describe "Thread list in side panel | full page", type: :system do end it "shows the thread in the list when another user restores the original message" do - # This is necessary because normal users can't see deleted messages - other_user.update!(admin: true) - current_user.update!(admin: true) - - thread_1.original_message.trash! + trash_message!(thread_1.original_message) chat_page.visit_threads_list(channel) expect(thread_list_page).to have_no_thread(thread_1) - using_session(:tab_2) do - sign_in(other_user) - chat_page.visit_channel(channel) - expect(channel_page).to have_no_loading_skeleton - channel_page.expand_deleted_message(thread_1.original_message) - channel_page.message_thread_indicator(thread_1.original_message).click - expect(side_panel_page).to have_open_thread(thread_1) - thread_page.messages.restore(thread_1.original_message) - end + restore_message!(thread_1.original_message, user: other_user) expect(thread_list_page).to have_thread(thread_1) end