Skip to content

A platform for community discussion. Free, open, simple.

DEV: Avoid pointer race in chat original-message system tests (#42702)

Alan Guo Xiang Tan00724578441d
diff --git a/plugins/chat/spec/system/page_objects/chat/chat_thread.rb b/plugins/chat/spec/system/page_objects/chat/chat_thread.rb
index d66a81b9119..c0620ca283d 100644
--- a/plugins/chat/spec/system/page_objects/chat/chat_thread.rb
+++ b/plugins/chat/spec/system/page_objects/chat/chat_thread.rb
@@ -57,7 +57,7 @@ module PageObjects
end
def open_original_message
- find(".chat-message-info__original-message").click
+ find(".chat-message-info__original-message__text").click
end
def has_back_link_to_thread_list?(channel)
diff --git a/plugins/chat/spec/system/single_thread_spec.rb b/plugins/chat/spec/system/single_thread_spec.rb
index a7a3d7dc4c7..d7fcb3e5974 100644
--- a/plugins/chat/spec/system/single_thread_spec.rb
+++ b/plugins/chat/spec/system/single_thread_spec.rb
@@ -107,12 +107,12 @@ describe "Single thread in side panel" do
end
context "when in drawer" do
- it "opens the channel and highlights the message when clicking original message link" do
+ it "takes the user to the highlighted message after they click the original message link" do
visit("/latest")
chat_page.open_from_header
chat_drawer_page.open_channel(channel)
channel_page.message_thread_indicator(thread.original_message).click
- find(".chat-message-info__original-message").click
+ thread_page.open_original_message
expect(chat_drawer_page).to have_open_channel(channel)
expect(channel_page.messages).to have_message(
@@ -122,10 +122,10 @@ describe "Single thread in side panel" do
end
end
- it "highlights the message in the channel when clicking original message link" do
+ it "takes the user to the highlighted message after they click the original message link" do
chat_page.visit_thread(thread)
- find(".chat-message-info__original-message").click
+ thread_page.open_original_message
expect(channel_page.messages).to have_message(
id: thread.original_message.id,
@@ -246,10 +246,11 @@ describe "Single thread in side panel" do
expect(side_panel).to have_open_thread(thread)
end
- it "navigates back to channel when clicking original message link", mobile: true do
+ it "takes the user back to the channel after they click the original message link",
+ mobile: true do
chat_page.visit_thread(thread)
- find(".chat-message-info__original-message").click
+ thread_page.open_original_message
expect(page).to have_current_path("/chat/c/#{channel.slug}/#{channel.id}")
end