discourse/spec/system/admin_site_setting_search_spec.rb
Martin Brennan 78bafb331a
FEATURE: Allow site settings to be edited throughout admin UI (#26154)
This commit makes it so the site settings filter controls and
the list of settings input editors themselves can be used elsewhere
in the admin UI outside of /admin/site_settings

This allows us to provide more targeted groups of settings in different
UI areas where it makes sense to provide them, such as on plugin pages.
You could open a single page for a plugin where you can see information
about that plugin, change settings, and configure it with custom UIs
in the one place.

In future we will do this in "config areas" for other parts of the
admin UI.
2024-03-18 08:50:39 +10:00

43 lines
1.4 KiB
Ruby

# frozen_string_literal: true
describe "Admin Site Setting Search", type: :system do
let(:settings_page) { PageObjects::Pages::AdminSettings.new }
fab!(:admin)
before do
SiteSetting.title = "Discourse"
sign_in(admin)
end
it "clears the filter" do
settings_page.visit
settings_page.type_in_search("min personal message post length")
expect(settings_page).to have_n_results(1)
settings_page.clear_search
expect(settings_page).to have_greater_than_n_results(1)
end
it "can show only overridden settings" do
overridden_setting_count = SiteSetting.all_settings(only_overridden: true).length
settings_page.visit
settings_page.toggle_only_show_overridden
assert_selector(".admin-detail .row.setting.overridden", count: overridden_setting_count)
settings_page.toggle_only_show_overridden
expect(settings_page).to have_greater_than_n_results(overridden_setting_count)
end
describe "when searching for keywords" do
it "finds the associated site setting" do
settings_page.visit
settings_page.type_in_search("anonymous_posting_min_trust_level")
expect(settings_page).to have_search_result("anonymous_posting_allowed_groups")
end
it "can search for previous site setting without underscores" do
settings_page.visit
settings_page.type_in_search("anonymous posting min")
expect(settings_page).to have_search_result("anonymous_posting_allowed_groups")
end
end
end