diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-message.js b/plugins/chat/assets/javascripts/discourse/components/chat-message.js index de90bced35..17ce8d8f41 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat-message.js +++ b/plugins/chat/assets/javascripts/discourse/components/chat-message.js @@ -238,7 +238,7 @@ export default Component.extend({ }); } - if (this.openThread) { + if (this.hasThread) { buttons.push({ id: "openThread", name: I18n.t("chat.threads.open"), diff --git a/plugins/chat/spec/system/page_objects/chat/chat_channel.rb b/plugins/chat/spec/system/page_objects/chat/chat_channel.rb index 1263b86dcf..96ebb4478d 100644 --- a/plugins/chat/spec/system/page_objects/chat/chat_channel.rb +++ b/plugins/chat/spec/system/page_objects/chat/chat_channel.rb @@ -3,6 +3,8 @@ module PageObjects module Pages class ChatChannel < PageObjects::Pages::Base + include SystemHelpers + def type_in_composer(input) find(".chat-composer-input").send_keys(input) end @@ -32,10 +34,19 @@ module PageObjects click_more_buttons(message) end - def expand_message_actions_mobile(message, delay: 1) + def expand_message_actions_mobile(message, delay: 2) message_by_id(message.id).click(delay: delay) end + def click_message_action_mobile(message, message_action) + i = 0.5 + try_until_success(timeout: 20) do + expand_message_actions_mobile(message, delay: i) + first(".chat-message-action-item[data-id=\"#{message_action}\"]") + end + find(".chat-message-action-item[data-id=\"#{message_action}\"] button").click + end + def hover_message(message) message_by_id(message.id).hover end @@ -60,11 +71,6 @@ module PageObjects find(".chat-message-thread-btn").click end - def open_message_thread_mobile(message) - expand_message_actions_mobile(message) - find(".chat-message-action-item[data-id=\"openThread\"]").click - end - def select_message(message) hover_message(message) click_more_buttons(message) diff --git a/plugins/chat/spec/system/single_thread_spec.rb b/plugins/chat/spec/system/single_thread_spec.rb index ebbf8e1f68..a640b81ea4 100644 --- a/plugins/chat/spec/system/single_thread_spec.rb +++ b/plugins/chat/spec/system/single_thread_spec.rb @@ -72,7 +72,7 @@ describe "Single thread in side panel", type: :system, js: true do it "opens the side panel for a single thread from the mobile message actions menu", mobile: true do chat_page.visit_channel(channel) - channel_page.open_message_thread_mobile(thread.chat_messages.last) + channel_page.click_message_action_mobile(thread.chat_messages.last, "openThread") expect(side_panel).to have_open_thread(thread) end end diff --git a/plugins/chat/spec/system/transcript_spec.rb b/plugins/chat/spec/system/transcript_spec.rb index a7790b8447..886219096a 100644 --- a/plugins/chat/spec/system/transcript_spec.rb +++ b/plugins/chat/spec/system/transcript_spec.rb @@ -25,15 +25,6 @@ RSpec.describe "Quoting chat message transcripts", type: :system, js: true do end end - def select_message_mobile(message) - i = 0.5 - try_until_success(timeout: 20) do - chat_channel_page.expand_message_actions_mobile(message, delay: 1) - first(".chat-message-action-item[data-id=\"selectMessage\"]") - end - find(".chat-message-action-item[data-id=\"selectMessage\"] button").click - end - def cdp_allow_clipboard_access! cdp_params = { origin: page.server_url, @@ -230,7 +221,7 @@ RSpec.describe "Quoting chat message transcripts", type: :system, js: true do expect(chat_channel_page).to have_no_loading_skeleton - select_message_mobile(message_1) + chat_channel_page.click_message_action_mobile(message_1, "selectMessage") click_selection_button("quote") expect(topic_page).to have_expanded_composer