discourse/plugins/chat/spec/system/unfollow_dm_channel_spec.rb
Joffrey JAFFEUX 60c67afba4
DEV: various improvements to devex on chat (#21612)
- Improves styleguide support
- Adds toggle color scheme to styleguide
- Adds properties mutators to styleguide
- Attempts to quit a session as soon as done with it in system specs, this should at least free resources faster
- Refactors fabricators to simplify them
- Adds more fabricators (uploads for example)
- Starts implementing components pattern in system specs
- Uses Chat::Message creator to create messages in system specs, this should help to have more real specs as the side effects should now happen
2023-05-17 17:49:52 +02:00

38 lines
1.2 KiB
Ruby

# frozen_string_literal: true
RSpec.describe "Unfollow dm channel", type: :system, js: true do
fab!(:current_user) { Fabricate(:user) }
fab!(:other_user) { Fabricate(:user) }
fab!(:dm_channel_1) { Fabricate(:direct_message_channel, users: [current_user, other_user]) }
let!(:chat_page) { PageObjects::Pages::Chat.new }
let!(:chat_channel_page) { PageObjects::Pages::ChatChannel.new }
before do
SiteSetting.navigation_menu = "sidebar"
chat_system_bootstrap
sign_in(current_user)
end
context "when receiving a message after unfollowing" do
it "correctly shows the channel" do
visit("/")
find(".channel-#{dm_channel_1.id}").hover
find(".channel-#{dm_channel_1.id} .sidebar-section-link-hover").click
expect(page).to have_no_css(".channel-#{dm_channel_1.id}")
using_session(:user_1) do |session|
text = "this is fine"
sign_in(other_user)
chat_page.visit_channel(dm_channel_1)
chat_channel_page.send_message(text)
expect(chat_channel_page).to have_message(text: text)
session.quit
end
expect(page).to have_css(".channel-#{dm_channel_1.id} .urgent")
end
end
end