2023-10-28 05:42:57 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
describe "Admin Site Setting Search", type: :system do
|
2024-06-19 14:01:24 +08:00
|
|
|
let(:settings_page) { PageObjects::Pages::AdminSiteSettings.new }
|
2023-11-10 06:47:59 +08:00
|
|
|
fab!(:admin)
|
2023-10-28 05:42:57 +08:00
|
|
|
|
|
|
|
before do
|
|
|
|
SiteSetting.title = "Discourse"
|
|
|
|
sign_in(admin)
|
|
|
|
end
|
|
|
|
|
2024-03-18 06:50:39 +08:00
|
|
|
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
|
|
|
|
|
2023-10-28 05:42:57 +08:00
|
|
|
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
|
|
|
|
|
2024-04-03 11:06:31 +08:00
|
|
|
it "finds the associated site setting when many keywords" do
|
|
|
|
settings_page.visit
|
|
|
|
settings_page.type_in_search("deactivated")
|
|
|
|
expect(settings_page).to have_search_result("clean_up_inactive_users_after_days")
|
|
|
|
expect(settings_page).to have_search_result("purge_unactivated_users_grace_period_days")
|
|
|
|
end
|
|
|
|
|
2023-10-28 05:42:57 +08:00
|
|
|
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
|