Skip to content

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

DEV: Add chat system spec for multi-file upload (#19709)

Martin Brennan9e175a361311
diff --git a/plugins/chat/spec/system/uploads_spec.rb b/plugins/chat/spec/system/uploads_spec.rb
index 75e656c6332..6e49290023c 100644
--- a/plugins/chat/spec/system/uploads_spec.rb
+++ b/plugins/chat/spec/system/uploads_spec.rb
@@ -34,6 +34,22 @@ describe "Uploading files in chat messages", type: :system, js: true do
expect(ChatMessage.last.uploads.count).to eq(1)
end
+ it "allows uploading multiple files" do
+ chat.visit_channel(channel_1)
+ file_path_1 = file_from_fixtures("logo.png", "images").path
+ file_path_2 = file_from_fixtures("logo.jpg", "images").path
+ attach_file([file_path_1, file_path_2]) do
+ channel.open_action_menu
+ channel.click_action_button("chat-upload-btn")
+ end
+ expect(page).to have_css(".chat-composer-upload .preview .preview-img", count: 2)
+ channel.send_message("upload testing")
+
+ expect(page).not_to have_css(".chat-composer-upload")
+ expect(channel).to have_message(text: "upload testing")
+ expect(ChatMessage.last.uploads.count).to eq(2)
+ end
+
it "allows uploading a huge image file with preprocessing" do
SiteSetting.composer_media_optimization_image_bytes_optimization_threshold = 200.kilobytes
chat.visit_channel(channel_1)