DEV: Uncomment chat upload system specs (#20859)

These were commented in  daaa41ae0760c863c91bfcda659a4f966ea7545c,
doesn't seem to have made an observable difference, uncommenting
these now to see if chat system specs still pass.
This commit is contained in:
Martin Brennan 2023-03-29 00:55:01 +10:00 committed by GitHub
parent 08ff6eebad
commit 70c0955722
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 72 additions and 72 deletions

View File

@ -1,39 +1,39 @@
# frozen_string_literal: true # frozen_string_literal: true
# RSpec.describe "Channel message selection", type: :system, js: true do RSpec.describe "Channel message selection", type: :system, js: true do
# fab!(:current_user) { Fabricate(:user) } fab!(:current_user) { Fabricate(:user) }
# fab!(:channel_1) { Fabricate(:chat_channel) } fab!(:channel_1) { Fabricate(:chat_channel) }
# fab!(:message_1) { Fabricate(:chat_message, chat_channel: channel_1) } fab!(:message_1) { Fabricate(:chat_message, chat_channel: channel_1) }
# let(:chat) { PageObjects::Pages::Chat.new } let(:chat) { PageObjects::Pages::Chat.new }
# let(:channel) { PageObjects::Pages::ChatChannel.new } let(:channel) { PageObjects::Pages::ChatChannel.new }
# let(:image) do let(:image) do
# Fabricate( Fabricate(
# :upload, :upload,
# original_filename: "test_image.jpg", original_filename: "test_image.jpg",
# width: 400, width: 400,
# height: 300, height: 300,
# extension: "jpg", extension: "jpg",
# ) )
# end end
# before do before do
# chat_system_bootstrap chat_system_bootstrap
# channel_1.add(current_user) channel_1.add(current_user)
# sign_in(current_user) sign_in(current_user)
# message_1.attach_uploads([image]) message_1.attach_uploads([image])
# end end
# it "can collapse/expand an image and still have lightbox working" do it "can collapse/expand an image and still have lightbox working" do
# chat.visit_channel(channel_1) chat.visit_channel(channel_1)
# find(".chat-message-collapser-button").click find(".chat-message-collapser-button").click
# expect(page).to have_css(".chat-message-collapser-body.hidden", visible: :false) expect(page).to have_css(".chat-message-collapser-body.hidden", visible: :false)
# find(".chat-message-collapser-button").click find(".chat-message-collapser-button").click
# expect(page).to have_no_css(".chat-message-collapser-body.hidden") expect(page).to have_no_css(".chat-message-collapser-body.hidden")
# find(".chat-img-upload").click find(".chat-img-upload").click
# # visible false is because the upload doesn’t exist but it's enough to know lightbox is working # visible false is because the upload doesn’t exist but it's enough to know lightbox is working
# expect(page).to have_css(".mfp-image-holder img[src*='#{image.url}']", visible: false) expect(page).to have_css(".mfp-image-holder img[src*='#{image.url}']", visible: false)
# end end
# end end

View File

@ -79,54 +79,54 @@ describe "Uploading files in chat messages", type: :system, js: true do
end end
end end
# context "when editing a message with uploads" do context "when editing a message with uploads" do
# fab!(:message_2) { Fabricate(:chat_message, user: current_user, chat_channel: channel_1) } fab!(:message_2) { Fabricate(:chat_message, user: current_user, chat_channel: channel_1) }
# fab!(:upload_reference) do fab!(:upload_reference) do
# Fabricate( Fabricate(
# :upload_reference, :upload_reference,
# target: message_2, target: message_2,
# upload: Fabricate(:upload, user: current_user), upload: Fabricate(:upload, user: current_user),
# ) )
# end end
# before do before do
# channel_1.add(current_user) channel_1.add(current_user)
# sign_in(current_user) sign_in(current_user)
# file = file_from_fixtures("logo-dev.png", "images") file = file_from_fixtures("logo-dev.png", "images")
# url = Discourse.store.store_upload(file, upload_reference.upload) url = Discourse.store.store_upload(file, upload_reference.upload)
# upload_reference.upload.update!(url: url, sha1: Upload.generate_digest(file)) upload_reference.upload.update!(url: url, sha1: Upload.generate_digest(file))
# end end
# it "allows deleting uploads" do it "allows deleting uploads" do
# chat.visit_channel(channel_1) chat.visit_channel(channel_1)
# channel.open_edit_message(message_2) channel.open_edit_message(message_2)
# find(".chat-composer-upload").find(".remove-upload").click find(".chat-composer-upload").find(".remove-upload").click
# channel.click_send_message channel.click_send_message
# expect(channel.message_by_id(message_2.id)).not_to have_css(".chat-uploads") expect(channel.message_by_id(message_2.id)).not_to have_css(".chat-uploads")
# expect(message_2.reload.uploads).to be_empty expect(message_2.reload.uploads).to be_empty
# end end
# it "allows adding more uploads" do it "allows adding more uploads" do
# chat.visit_channel(channel_1) chat.visit_channel(channel_1)
# channel.open_edit_message(message_2) channel.open_edit_message(message_2)
# file_path = file_from_fixtures("logo.png", "images").path file_path = file_from_fixtures("logo.png", "images").path
# attach_file(file_path) do attach_file(file_path) do
# channel.open_action_menu channel.open_action_menu
# channel.click_action_button("chat-upload-btn") channel.click_action_button("chat-upload-btn")
# end end
# expect(page).to have_css(".chat-composer-upload .preview .preview-img", count: 2) expect(page).to have_css(".chat-composer-upload .preview .preview-img", count: 2)
# expect(page).to have_content(File.basename(file_path)) expect(page).to have_content(File.basename(file_path))
# channel.click_send_message channel.click_send_message
# expect(page).not_to have_css(".chat-composer-upload") expect(page).not_to have_css(".chat-composer-upload")
# expect(page).to have_css(".chat-img-upload", count: 2) expect(page).to have_css(".chat-img-upload", count: 2)
# expect(message_2.reload.uploads.count).to eq(2) expect(message_2.reload.uploads.count).to eq(2)
# end end
# end end
context "when uploads are not allowed" do context "when uploads are not allowed" do
fab!(:user_2) { Fabricate(:user) } fab!(:user_2) { Fabricate(:user) }