2023-03-18 01:26:32 +08:00
|
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2023-06-07 09:26:58 +08:00
|
|
|
|
RSpec.describe "Channel message selection", type: :system do
|
2023-03-28 22:55:01 +08:00
|
|
|
|
fab!(:current_user) { Fabricate(:user) }
|
|
|
|
|
fab!(:channel_1) { Fabricate(:chat_channel) }
|
|
|
|
|
fab!(:message_1) { Fabricate(:chat_message, chat_channel: channel_1) }
|
2023-03-18 01:26:32 +08:00
|
|
|
|
|
2023-03-28 22:55:01 +08:00
|
|
|
|
let(:chat) { PageObjects::Pages::Chat.new }
|
|
|
|
|
let(:channel) { PageObjects::Pages::ChatChannel.new }
|
|
|
|
|
let(:image) do
|
|
|
|
|
Fabricate(
|
|
|
|
|
:upload,
|
|
|
|
|
original_filename: "test_image.jpg",
|
|
|
|
|
width: 400,
|
|
|
|
|
height: 300,
|
|
|
|
|
extension: "jpg",
|
|
|
|
|
)
|
|
|
|
|
end
|
2023-03-18 01:26:32 +08:00
|
|
|
|
|
2023-03-28 22:55:01 +08:00
|
|
|
|
before do
|
|
|
|
|
chat_system_bootstrap
|
|
|
|
|
channel_1.add(current_user)
|
|
|
|
|
sign_in(current_user)
|
2023-07-20 21:22:47 +08:00
|
|
|
|
message_1.uploads = [image]
|
2023-03-28 22:55:01 +08:00
|
|
|
|
end
|
2023-03-18 01:26:32 +08:00
|
|
|
|
|
2023-03-28 22:55:01 +08:00
|
|
|
|
it "can collapse/expand an image and still have lightbox working" do
|
|
|
|
|
chat.visit_channel(channel_1)
|
2023-03-18 01:26:32 +08:00
|
|
|
|
|
2023-03-28 22:55:01 +08:00
|
|
|
|
find(".chat-message-collapser-button").click
|
2023-12-07 06:25:00 +08:00
|
|
|
|
expect(page).to have_css(".chat-message-collapser-body.hidden", visible: :hidden)
|
2023-03-28 22:55:01 +08:00
|
|
|
|
find(".chat-message-collapser-button").click
|
|
|
|
|
expect(page).to have_no_css(".chat-message-collapser-body.hidden")
|
|
|
|
|
find(".chat-img-upload").click
|
2023-03-18 01:26:32 +08:00
|
|
|
|
|
2023-03-28 22:55:01 +08:00
|
|
|
|
# visible false is because the upload doesn’t exist but it's enough to know lightbox is working
|
2023-12-07 06:25:00 +08:00
|
|
|
|
expect(page).to have_css(".mfp-image-holder img[src*='#{image.url}']", visible: :hidden)
|
2023-03-28 22:55:01 +08:00
|
|
|
|
end
|
|
|
|
|
end
|