discourse/plugins/chat/spec/system/user_presence.rb
Alan Guo Xiang Tan 41f8bff2c3
DEV: Remove superfluous js: true metadata (#21960)
Why this change?

It is very unlikely that we need to ever JS for system tests considering
that we rely on a JS framework on the frontend.
2023-06-07 09:26:58 +08:00

33 lines
866 B
Ruby

# frozen_string_literal: true
RSpec.describe "User presence", type: :system do
fab!(:channel_1) { Fabricate(:chat_channel) }
fab!(:current_user) { Fabricate(:user) }
let(:channel) { PageObjects::Pages::ChatChannel.new }
before do
chat_system_bootstrap
channel_1.add(current_user)
end
it "shows presence indicator" do
sign_in(current_user)
chat.visit_channel(channel_1)
channel.send_message("Am I present?")
expect(page).to have_selector(".chat-user-avatar.is-online")
end
context "when user hides presence" do
it "hides the presence indicator" do
current_user.user_option.update!(hide_profile_and_presence: true)
sign_in(current_user)
chat.visit_channel(channel_1)
channel.send_message("Am I present?")
expect(page).to have_no_selector(".chat-user-avatar.is-online")
end
end
end