A platform for community discussion. Free, open, simple.
DEV: Restore (and fix?) chat upload specs (#39301)
Jarek Radoszade0cce6272c
diff --git a/plugins/chat/spec/system/uploads_spec.rb b/plugins/chat/spec/system/uploads_spec.rbindex fdaecc58b82..1fe696ab50a 100644--- a/plugins/chat/spec/system/uploads_spec.rb+++ b/plugins/chat/spec/system/uploads_spec.rb@@ -58,26 +58,23 @@ describe "Uploading files in chat messages" doexpect(Chat::Message.last.uploads.count).to eq(1)end- xit "adds a thumbnail for large images" do+ it "adds a thumbnail for large images" doSiteSetting.create_thumbnails = true+ SiteSetting.max_image_megapixels = 150chat.visit_channel(channel_1)file_path = file_from_fixtures("huge.jpg", "images").path+ attach_file("channel-file-uploader", file_path, make_visible: true)- attach_file(file_path) do- channel_page.open_action_menu- channel_page.click_action_button("chat-upload-btn")- end+ expect(page).to have_css(".chat-composer-upload .preview .preview-img")expect { channel_page.send_message }.to change { Chat::Message.count }.by(1)expect(channel_page).to have_no_css(".chat-composer-upload")message = Chat::Message.last-- expect(message.uploads.first.thumbnail).to be_present-upload = message.uploads.first+ expect(upload.thumbnail).to be_present# image has src attribute with thumbnail urlexpect(channel_page).to have_css(".chat-uploads img[src$='#{upload.thumbnail.url}']")@@ -96,8 +93,6 @@ describe "Uploading files in chat messages" doendit "allows uploading multiple files" do- skip_on_ci!-chat.visit_channel(channel_1)file_path_1 = file_from_fixtures("logo.png", "images").path@@ -111,25 +106,19 @@ describe "Uploading files in chat messages" doexpect(channel_page.messages).to have_message(text: "upload testing\n#{I18n.t("js.chat.uploaded_files", count: 2)}",persisted: true,- wait: 5,)expect(Chat::Message.last.uploads.count).to eq(2)end- it "allows uploading a huge image file with preprocessing" do- skip_on_ci!-- SiteSetting.max_image_megapixels = 150- SiteSetting.composer_media_optimization_image_bytes_optimization_threshold = 200.kilobytes+ it "allows uploading an image with client-side preprocessing enabled" do+ SiteSetting.composer_media_optimization_image_bytes_optimization_threshold = 1chat.visit_channel(channel_1)- file_path = file_from_fixtures("huge.jpg", "images").path++ file_path = file_from_fixtures("logo.jpg", "images").pathattach_file("channel-file-uploader", file_path, make_visible: true)- expect(find(".chat-composer-upload")).to have_content("Processing")- # image processing clientside is slow! here we are waiting for processing- # to complete then the upload to complete as well- expect(page).to have_css(".chat-composer-upload .preview .preview-img", wait: 25)+ expect(page).to have_css(".chat-composer-upload .preview .preview-img")channel_page.send_message("upload testing")