discourse/plugins/chat/spec/system/user_chat_preferences_spec.rb
Joffrey JAFFEUX 6b0aeced7e
DEV: rework the chat-live-pane (#20519)
This PR is introducing glimmer usage in the chat-live-pane, for components but also for models. RestModel usage has been dropped in favor of native classes.

Other changes/additions in this PR:

sticky dates, scrolling will now keep the date separator of the current section at the top of the screen
better unread management, marking a channel as unread will correctly mark the correct message and not mark the whole channel as read. Tracking state will also now correctly return unread count and unread mentions.
adds an animation on bottom arrow
better scrolling behavior, we should now always correctly keep the scroll position while loading more
reactions are now more reactive, and will update their tooltip without needed to close/reopen it
skeleton has been improved with placeholder images and reactions
when making a reaction on the desktop message actions, the menu won't move anymore
simplify logic and stop maintaining a list of unloaded messages
2023-03-03 13:09:25 +01:00

61 lines
1.7 KiB
Ruby

# frozen_string_literal: true
RSpec.describe "User chat preferences", type: :system, js: true do
fab!(:current_user) { Fabricate(:user) }
let(:chat) { PageObjects::Pages::Chat.new }
before do
chat_system_bootstrap
sign_in(current_user)
end
context "when chat disabled" do
before do
SiteSetting.chat_enabled = false
sign_in(current_user)
end
it "shows a not found page" do
visit("/u/#{current_user.username}/preferences/chat")
expect(page).to have_content(I18n.t("page_not_found.title"))
end
end
it "can select chat sound" do
visit("/u/#{current_user.username}/preferences/chat")
find("#user_chat_sounds .select-kit-header[data-value]").click
find("[data-value='bell']").click
find(".save-changes").click
expect(page).to have_css("#user_chat_sounds .select-kit-header[data-value='bell']")
end
it "can select header_indicator_preference" do
visit("/u/#{current_user.username}/preferences/chat")
find("#user_chat_header_indicator_preference .select-kit-header[data-value]").click
find("[data-value='dm_and_mentions']").click
find(".save-changes").click
expect(page).to have_css(
"#user_chat_header_indicator_preference .select-kit-header[data-value='dm_and_mentions']",
)
end
context "as an admin on another user's preferences" do
fab!(:current_user) { Fabricate(:admin) }
fab!(:user_1) { Fabricate(:user) }
before { sign_in(current_user) }
it "allows to change settings" do
visit("/u/#{user_1.username}/preferences")
find(".user-nav__preferences-chat").click
expect(page).to have_current_path("/u/#{user_1.username}/preferences/chat")
end
end
end