DEV: Spec for opening thread on mobile

This commit is contained in:
Martin Brennan 2023-02-09 15:11:00 +10:00
parent d93cdec8bb
commit b33883db2c
5 changed files with 30 additions and 4 deletions

View File

@ -40,7 +40,7 @@
{{#if this.messageCapabilities.hasThread}}
<DButton
@class="btn-flat chat-message-thread-btn"
@action={{this.messageActions.showThread}}
@action={{this.messageActions.openThread}}
@icon="puzzle-piece"
@title="chat.threads.open"
/>

View File

@ -238,6 +238,14 @@ export default Component.extend({
});
}
if (this.openThread) {
buttons.push({
id: "openThread",
name: I18n.t("chat.threads.open"),
icon: "puzzle-piece",
});
}
return buttons;
},
@ -253,7 +261,7 @@ export default Component.extend({
restore: this.restore,
rebakeMessage: this.rebakeMessage,
toggleBookmark: this.toggleBookmark,
showThread: this.showThread,
openThread: this.openThread,
startReactionForMessageActions: this.startReactionForMessageActions,
};
},
@ -732,7 +740,7 @@ export default Component.extend({
},
@action
showThread() {
openThread() {
this.router.transitionTo("chat.channel.thread", this.message.thread_id);
},

View File

@ -32,6 +32,10 @@ module PageObjects
click_more_buttons(message)
end
def expand_message_actions_mobile(message, delay: 1)
message_by_id(message.id).click(delay: delay)
end
def hover_message(message)
message_by_id(message.id).hover
end
@ -56,6 +60,11 @@ 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

@ -67,5 +67,14 @@ describe "Single thread in side panel", type: :system, js: true do
expect(open_thread.op).to have_css(".chat-user-avatar img.avatar")
expect(open_thread.op).to have_content(thread.original_message_user.username)
end
context "when using mobile" 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)
expect(side_panel).to have_open_thread(thread)
end
end
end
end

View File

@ -28,7 +28,7 @@ RSpec.describe "Quoting chat message transcripts", type: :system, js: true do
def select_message_mobile(message)
i = 0.5
try_until_success(timeout: 20) do
chat_channel_page.message_by_id(message.id).click(delay: i)
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