mirror of
https://github.com/discourse/discourse.git
synced 2026-08-05 19:53:47 +08:00
This replaces the old ember-cli build with a modern Rolldown build. In local testing, this provides an 80% improvement in build times, while remaining 100% backwards compatible for themes and plugins. As part of this move, we have decided to stop using a proxy in front of Discourse for development. Development should now be done directly against the Rails server. `bin/ember-cli -u` has been replaced with `bin/dev`. This will launch Rails on `:3000`, and will run the rolldown build in the background. Log output from both processes will be shown with an appropriate prefix. You should visit `:3000` in your browser. `:4200` will no longer serve anything. To help with migration, `bin/ember-cli` is now a backwards-compatible shim. It will print help information, and will launch a lightweight server on `:4200` with instructions to move to `:3000`. If you prefer to launch Rails and the JS build as separate commands, you can still do that. Rails boot commands are unchanged, and the rolldown development builder can be run using `bin/dev --only ember`. https://meta.discourse.org/t/403908 --------- Co-authored-by: Jarek Radosz <jarek@cvx.dev> Co-authored-by: Chris Manson <chris@manson.ie>
116 lines
3.8 KiB
Ruby
Vendored
116 lines
3.8 KiB
Ruby
Vendored
# frozen_string_literal: true
|
||
|
||
describe "Admin Search" do
|
||
fab!(:current_user, :admin)
|
||
let(:search_modal) { PageObjects::Modals::AdminSearch.new }
|
||
let(:sidebar) { PageObjects::Components::NavigationMenu::Sidebar.new }
|
||
|
||
before { sign_in(current_user) }
|
||
|
||
it "can search for settings, pages, themes, components, and reports" do
|
||
Fabricate(:theme, name: "Discourse Invincible Theme")
|
||
Fabricate(:theme, name: "Discourse Redacted", component: true)
|
||
|
||
Theme
|
||
.any_instance
|
||
.stubs(:internal_translations)
|
||
.returns([stub(key: "theme_metadata.description", value: "Some description")])
|
||
|
||
visit "/admin"
|
||
sidebar.click_search_input
|
||
|
||
search_modal.search("min_topic_title")
|
||
expect(search_modal.find_result("setting", 0)).to have_content("Min topic title length")
|
||
expect(search_modal.find_result("setting", 0)).to have_content(
|
||
I18n.t("site_settings.min_topic_title_length"),
|
||
)
|
||
|
||
search_modal.search("mau")
|
||
expect(search_modal.find_result("report", 0)).to have_content(
|
||
I18n.t("reports.dau_by_mau.title"),
|
||
)
|
||
expect(search_modal.find_result("report", 0)).to have_content(
|
||
I18n.t("reports.dau_by_mau.description"),
|
||
)
|
||
|
||
search_modal.search("permalinks")
|
||
expect(search_modal.find_result("page", 0)).to have_content(
|
||
I18n.t("admin_js.admin.config.permalinks.title"),
|
||
)
|
||
expect(search_modal.find_result("page", 0)).to have_content(
|
||
I18n.t("admin_js.admin.config.permalinks.header_description"),
|
||
)
|
||
|
||
search_modal.search("invincible")
|
||
expect(search_modal.find_result("theme", 0)).to have_content("Discourse Invincible Theme")
|
||
expect(search_modal.find_result("theme", 0)).to have_content("Some description")
|
||
|
||
search_modal.search("redacted")
|
||
expect(search_modal.find_result("component", 0)).to have_content("Discourse Redacted")
|
||
expect(search_modal.find_result("component", 0)).to have_content("Some description")
|
||
end
|
||
|
||
it "can search full page" do
|
||
visit "/admin"
|
||
sidebar.click_search_input
|
||
search_modal.search("min_topic_title")
|
||
search_modal.input_enter
|
||
expect(page).to have_current_path("/admin/search?filter=min_topic_title")
|
||
expect(search_modal.find_result("setting", 0)).to have_content("Min topic title length")
|
||
expect(search_modal.find_result("setting", 0)).to have_content(
|
||
I18n.t("site_settings.min_topic_title_length"),
|
||
)
|
||
end
|
||
|
||
it "informs user about no results" do
|
||
visit "/admin"
|
||
sidebar.click_search_input
|
||
|
||
search_modal.search("very long search phrase")
|
||
|
||
expect(search_modal).to have_content(
|
||
'We couldn’t find anything matching "very long search phrase".',
|
||
)
|
||
end
|
||
|
||
it "opens search modal with keyboard shortcut" do
|
||
visit "/admin"
|
||
expect(page).to have_css("#site-logo")
|
||
|
||
send_keys([SystemHelpers::PLATFORM_KEY_MODIFIER, "/"])
|
||
expect(search_modal).to be_open
|
||
end
|
||
|
||
it "works with sections which have a redirect instead of explicit /settings route" do
|
||
visit "/admin"
|
||
|
||
sidebar.click_search_input
|
||
|
||
search_modal.search("tags tag style")
|
||
search_modal.find_result("setting", 0).click
|
||
|
||
expect(page).to have_current_path("/admin/config/content?filter=tag_style")
|
||
end
|
||
|
||
it "works for social logins" do
|
||
visit "/admin"
|
||
sidebar.click_search_input
|
||
search_modal.search("google oauth2 logins")
|
||
search_modal.find_result("setting", 0).click
|
||
|
||
expect(page).to have_current_path(
|
||
"/admin/config/login-and-authentication/authenticators?filter=enable_google_oauth2_logins",
|
||
)
|
||
end
|
||
|
||
it "works for discourse connect" do
|
||
visit "/admin"
|
||
sidebar.click_search_input
|
||
search_modal.search("enable discourse connect")
|
||
search_modal.find_result("setting", 0).click
|
||
|
||
expect(page).to have_current_path(
|
||
"/admin/config/login-and-authentication/discourseconnect?filter=enable_discourse_connect",
|
||
)
|
||
end
|
||
end
|