DEV: initial system tests for chat and plugins (#18881)

This is a very basic to ensure it's working and open future possible work
This commit is contained in:
Joffrey JAFFEUX
2022-11-04 15:06:24 +01:00
committed by GitHub
parent 518707c42a
commit 11f3618b80
5 changed files with 40 additions and 12 deletions

View File

@ -17,7 +17,11 @@ class CategoryChannel < ChatChannel
category.secure_group_ids.to_a.concat(staff_groups)
end
def title(_)
def title(_ = nil)
name.presence || category.name
end
def slug
title.truncate(100).parameterize
end
end

View File

@ -619,7 +619,7 @@ after_initialize do
get "/browse/archived" => "chat#respond"
get "/draft-channel" => "chat#respond"
get "/channel/:channel_id" => "chat#respond"
get "/channel/:channel_id/:channel_title" => "chat#respond"
get "/channel/:channel_id/:channel_title" => "chat#respond", :as => "channel"
get "/channel/:channel_id/:channel_title/info" => "chat#respond"
get "/channel/:channel_id/:channel_title/info/about" => "chat#respond"
get "/channel/:channel_id/:channel_title/info/members" => "chat#respond"
@ -697,12 +697,7 @@ after_initialize do
add_api_key_scope(
:chat,
{
create_message: {
actions: %w[chat/chat#create_message],
params: %i[chat_channel_id],
},
},
{ create_message: { actions: %w[chat/chat#create_message], params: %i[chat_channel_id] } },
)
# Dark mode email styles

View File

@ -0,0 +1,29 @@
# frozen_string_literal: true
RSpec.describe "Navigation", type: :system, js: true do
fab!(:user) { Fabricate(:user) }
fab!(:category_channel) { Fabricate(:category_channel) }
fab!(:message) { Fabricate(:chat_message, chat_channel: category_channel) }
before do
SiteSetting.chat_enabled = true
SiteSetting.chat_allowed_groups = Group::AUTO_GROUPS[:everyone]
end
context "when visiting /chat" do
before do
category_channel.add(user)
sign_in(user)
end
it "it opens full page" do
visit("/chat")
expect(page).to have_current_path(
chat.channel_path(category_channel.id, category_channel.slug),
)
expect(page).to have_css("html.has-full-page-chat")
expect(page).to have_css(".chat-message-container[data-id='#{message.id}']")
end
end
end