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:
parent
518707c42a
commit
11f3618b80
|
@ -41,8 +41,6 @@ jobs:
|
||||||
target: plugins
|
target: plugins
|
||||||
- build_type: frontend
|
- build_type: frontend
|
||||||
target: core # Handled by core_frontend_tests job (below)
|
target: core # Handled by core_frontend_tests job (below)
|
||||||
- build_type: system
|
|
||||||
target: plugins # Enable once at least 1 plugin has system tests
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
@ -178,7 +176,7 @@ jobs:
|
||||||
|
|
||||||
- name: Plugin System Tests
|
- name: Plugin System Tests
|
||||||
if: matrix.build_type == 'system' && matrix.target == 'plugins'
|
if: matrix.build_type == 'system' && matrix.target == 'plugins'
|
||||||
run: bin/system_rspec plugins/*/spec/system
|
run: LOAD_PLUGINS=1 bin/system_rspec plugins/*/spec/system
|
||||||
|
|
||||||
- name: Upload failed system test screenshots
|
- name: Upload failed system test screenshots
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
|
|
|
@ -174,7 +174,9 @@ def spec(plugin, parallel: false)
|
||||||
params << "--seed #{ENV['RSPEC_SEED']}" if Integer(ENV['RSPEC_SEED'], exception: false)
|
params << "--seed #{ENV['RSPEC_SEED']}" if Integer(ENV['RSPEC_SEED'], exception: false)
|
||||||
|
|
||||||
ruby = `which ruby`.strip
|
ruby = `which ruby`.strip
|
||||||
files = Dir.glob("./plugins/#{plugin}/spec/**/*_spec.rb").sort
|
# reject system specs as they are slow and need dedicated setup
|
||||||
|
files =
|
||||||
|
Dir.glob("./plugins/#{plugin}/spec/**/*_spec.rb").reject { |f| f.include?("spec/system/") }.sort
|
||||||
if files.length > 0
|
if files.length > 0
|
||||||
cmd = parallel ? "bin/turbo_rspec" : "bin/rspec"
|
cmd = parallel ? "bin/turbo_rspec" : "bin/rspec"
|
||||||
sh "LOAD_PLUGINS=1 #{cmd} #{files.join(' ')} #{params.join(' ')}"
|
sh "LOAD_PLUGINS=1 #{cmd} #{files.join(' ')} #{params.join(' ')}"
|
||||||
|
|
|
@ -17,7 +17,11 @@ class CategoryChannel < ChatChannel
|
||||||
category.secure_group_ids.to_a.concat(staff_groups)
|
category.secure_group_ids.to_a.concat(staff_groups)
|
||||||
end
|
end
|
||||||
|
|
||||||
def title(_)
|
def title(_ = nil)
|
||||||
name.presence || category.name
|
name.presence || category.name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def slug
|
||||||
|
title.truncate(100).parameterize
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -619,7 +619,7 @@ after_initialize do
|
||||||
get "/browse/archived" => "chat#respond"
|
get "/browse/archived" => "chat#respond"
|
||||||
get "/draft-channel" => "chat#respond"
|
get "/draft-channel" => "chat#respond"
|
||||||
get "/channel/:channel_id" => "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" => "chat#respond"
|
||||||
get "/channel/:channel_id/:channel_title/info/about" => "chat#respond"
|
get "/channel/:channel_id/:channel_title/info/about" => "chat#respond"
|
||||||
get "/channel/:channel_id/:channel_title/info/members" => "chat#respond"
|
get "/channel/:channel_id/:channel_title/info/members" => "chat#respond"
|
||||||
|
@ -697,12 +697,7 @@ after_initialize do
|
||||||
|
|
||||||
add_api_key_scope(
|
add_api_key_scope(
|
||||||
:chat,
|
: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
|
# Dark mode email styles
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue