discourse/plugins/chat/spec/system/receiving_message_spec.rb
Alan Guo Xiang Tan fde9e6bc25
DEV: Migrate sidebar site settings (#19336)
This new site setting replaces the
`enable_experimental_sidebar_hamburger` and `enable_sidebar` site
settings as the sidebar feature exits the experimental phase.

Note that we're replacing this without depreciation since the previous
site setting was considered experimental.

Internal Ref: /t/86563
2022-12-08 09:44:29 +08:00

52 lines
1.5 KiB
Ruby

# frozen_string_literal: true
RSpec.describe "Receiving message", type: :system, js: true do
fab!(:current_user) { Fabricate(:admin) }
fab!(:user_2) { Fabricate(:user) }
fab!(:user_3) { Fabricate(:user) }
fab!(:direct_message_channel_1) do
Fabricate(:direct_message_channel, users: [current_user, user_2])
end
fab!(:direct_message_channel_2) do
Fabricate(:direct_message_channel, users: [current_user, user_2, user_3])
end
let(:chat_page) { PageObjects::Pages::Chat.new }
before do
chat_system_bootstrap(current_user, [direct_message_channel_1, direct_message_channel_2])
sign_in(current_user)
end
context "when core sidebar is enabled" do
before do
SiteSetting.navigation_menu = "sidebar"
end
context "when receiving a direct message" do
it "reorders the direct messages sidebar section links ordering by last message received" do
visit("/")
expect(
page.find(
"#sidebar-section-content-chat-dms .sidebar-section-link-wrapper:nth-child(2) .sidebar-row",
),
).to have_content(direct_message_channel_2.name)
creator =
Chat::ChatMessageCreator.create(
chat_channel: direct_message_channel_2,
user: user_2,
content: "this is good",
)
expect(
page.find(
"#sidebar-section-content-chat-dms .sidebar-section-link-wrapper:nth-child(1) .sidebar-row",
),
).to have_content(direct_message_channel_2.name)
end
end
end
end