DEV: Fix mobile thread spec

This commit is contained in:
Martin Brennan 2023-02-09 15:49:32 +10:00
parent 81cd3d32f9
commit 77fb4fb2f2
4 changed files with 15 additions and 18 deletions

View File

@ -238,7 +238,7 @@ export default Component.extend({
});
}
if (this.openThread) {
if (this.hasThread) {
buttons.push({
id: "openThread",
name: I18n.t("chat.threads.open"),

View File

@ -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)

View File

@ -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

View File

@ -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