mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:31:35 +08:00
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:
@ -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
|
||||
|
@ -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
|
||||
|
29
plugins/chat/spec/system/navigation_spec.rb
Normal file
29
plugins/chat/spec/system/navigation_spec.rb
Normal 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
|
Reference in New Issue
Block a user