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