discourse/spec/system/admin_site_setting_search_spec.rb
Blake Erickson 1a78e8ec1b
FEATURE: Add keywords support for site_settings search (#24146)
* FEATURE: Add keywords support for site_settings search

This change allows for a new `keywords` field that can be added to site
settings in order to help with searching. Keywords are not visible in
the UI, but site settings matching one of the contained keywords will
appear when searching for that keyword.

Keywords can be added for site settings inside of the
`config/locales/server.en.yml` file under the new `keywords` key.

```
site_settings
  example_1: "fancy description"
  example_2: "another description"

  keywords:
    example_1: "capybara"
```

* Add keywords entry for a recently changed site setting and add system specs

* Use page.visit now that we have our own visit
2023-10-27 15:42:57 -06:00

26 lines
804 B
Ruby

# frozen_string_literal: true
describe "Admin Site Setting Search", type: :system do
let(:settings_page) { PageObjects::Pages::AdminSettings.new }
fab!(:admin) { Fabricate(:admin) }
before do
SiteSetting.title = "Discourse"
sign_in(admin)
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