Skip to content

A platform for community discussion. Free, open, simple.

DEV: Restore and fix chat's user menu invitation spec (#39593)

Jarek Radosz3e2c3ac88f61
diff --git a/plugins/chat/spec/system/user_menu_notifications/sidebar_spec.rb b/plugins/chat/spec/system/user_menu_notifications/sidebar_spec.rb
index 2efa4087af3..638ea140fc8 100644
--- a/plugins/chat/spec/system/user_menu_notifications/sidebar_spec.rb
+++ b/plugins/chat/spec/system/user_menu_notifications/sidebar_spec.rb
@@ -202,27 +202,27 @@ RSpec.describe "User menu notifications | sidebar" do
end
end
- context "when inviting a user" do
+ context "when invited to a channel" do
fab!(:channel_1, :chat_channel)
- fab!(:other_user, :user)
-
- before { channel_1.add(current_user) }
- xit "shows an invitation notification" do
- Jobs.run_immediately!
+ let(:user_menu) { PageObjects::Components::UserMenu.new }
- chat.visit_channel(channel_1)
- channel.send_message("this is fine @#{other_user.username}")
- find(".invite-link", wait: 5).click
+ before do
+ Chat::InviteUsersToChannel.call(
+ guardian: Guardian.new(Fabricate(:admin)),
+ params: {
+ channel_id: channel_1.id,
+ user_ids: [current_user.id],
+ },
+ )
+ end
- using_session(:user_1) do
- sign_in(other_user)
- visit("/discuss")
- find(".header-dropdown-toggle.current-user").click
+ it "shows an invitation notification" do
+ visit("/discuss")
+ user_menu.open
- expect(find("#user-menu-button-chat-notifications")).to have_content(1)
- expect(find("#quick-access-all-notifications")).to have_css(".chat-invitation.unread")
- end
+ expect(page).to have_css("#user-menu-button-chat-notifications", text: "1")
+ expect(page).to have_css("#quick-access-all-notifications .chat-invitation.unread")
end
end
end