2023-11-21 07:37:11 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
describe "Admin Plugins List", type: :system, js: true do
|
|
|
|
fab!(:current_user) { Fabricate(:admin) }
|
|
|
|
|
2023-11-23 06:40:55 +08:00
|
|
|
before do
|
|
|
|
sign_in(current_user)
|
|
|
|
Discourse.stubs(:visible_plugins).returns([spoiler_alert_plugin])
|
|
|
|
end
|
2023-11-21 07:37:11 +08:00
|
|
|
|
|
|
|
let(:spoiler_alert_plugin) do
|
2023-11-23 06:40:55 +08:00
|
|
|
path = File.join(Rails.root, "plugins", "spoiler-alert", "plugin.rb")
|
|
|
|
Plugin::Instance.parse_from_source(path)
|
2023-11-21 07:37:11 +08:00
|
|
|
end
|
|
|
|
|
2023-11-23 06:40:55 +08:00
|
|
|
it "shows the list of plugins" do
|
2023-11-21 07:37:11 +08:00
|
|
|
visit "/admin/plugins"
|
|
|
|
|
2023-11-23 06:40:55 +08:00
|
|
|
plugin_row =
|
2024-03-14 09:28:08 +08:00
|
|
|
find(
|
|
|
|
".admin-plugins-list tr[data-plugin-name=\"spoiler-alert\"] td.admin-plugins-list__name-details",
|
|
|
|
)
|
2023-11-21 07:37:11 +08:00
|
|
|
expect(plugin_row).to have_css(
|
2023-11-23 06:40:55 +08:00
|
|
|
".admin-plugins-list__name-with-badges .admin-plugins-list__name",
|
2023-11-21 07:37:11 +08:00
|
|
|
text: "Spoiler Alert",
|
|
|
|
)
|
|
|
|
expect(plugin_row).to have_css(
|
2023-11-23 06:40:55 +08:00
|
|
|
".admin-plugins-list__author",
|
2023-11-21 07:37:11 +08:00
|
|
|
text: I18n.t("admin_js.admin.plugins.author", { author: "Discourse" }),
|
|
|
|
)
|
|
|
|
expect(plugin_row).to have_css(
|
2023-11-23 06:40:55 +08:00
|
|
|
".admin-plugins-list__name-with-badges .admin-plugins-list__name a[href=\"https://meta.discourse.org/t/12650\"]",
|
2023-11-21 07:37:11 +08:00
|
|
|
)
|
|
|
|
expect(plugin_row).to have_css(
|
2023-11-23 06:40:55 +08:00
|
|
|
".admin-plugins-list__about",
|
2023-11-21 07:37:11 +08:00
|
|
|
text: spoiler_alert_plugin.metadata.about,
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|