2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-03-04 01:15:08 +08:00
discourse/spec/system/admin_reports_spec.rb
chapoi 4ecbaf0699
UX: Admin dashboard & reports improvements (#37598)
* Reorganise the admin reports listing page — reports are now grouped
into logical sections (Engagement, Traffic, Members, Content,
Moderation, Security) instead of a flat alphabetical list.
Plugin-provided reports are grouped under their plugin name.
* Hide legacy/deprecated reports from the listing via a new
Report::LEGACY_REPORTS constant, while keeping them accessible by direct
URL. Legacy reports show an info banner warning they are deprecated.
* Filter out reports from disabled plugins — the reports listing now
resolves which plugin each report belongs to (via source file path) and
excludes reports whose plugin is disabled. Each report also exposes
plugin and plugin_display_name metadata.
* Simplify reports page layout — removed the dashboard settings tab from
the reports page header, replaced hideTabs logic with showHeader that
only renders the DPageHeader on the index route (not on individual
report pages). Removed the separate dashboard-reports
route/controller/template entirely.

Screenshots
<img width="1454" height="1494" alt="Screenshot 2026-02-13 at 12 00
05 pm"
src="https://github.com/user-attachments/assets/60b62563-1ebe-43f6-a13c-695eb640488c"
/>
<img width="1459" height="845" alt="Screenshot 2026-02-13 at 12 00
16 pm"
src="https://github.com/user-attachments/assets/01ed2d0c-4105-4189-b653-f39074a40a43"
/>
<img width="1442" height="1086" alt="Screenshot 2026-02-23 at 2 34
16 pm"
src="https://github.com/user-attachments/assets/b324c67d-b09c-41b5-8840-f5966486eaa8"
/>
2026-02-24 09:20:38 +08:00

44 lines
1.3 KiB
Ruby

# frozen_string_literal: true
describe "Admin Reports", type: :system do
fab!(:current_user, :admin)
before { sign_in(current_user) }
context "when use_legacy_pageviews is true" do
before { SiteSetting.use_legacy_pageviews = true }
it "redirects from site_traffic to consolidated_page_views" do
visit "/admin/reports/site_traffic"
expect(page).to have_current_path("/admin/reports/consolidated_page_views")
end
end
context "when use_legacy_pageviews is false" do
before { SiteSetting.use_legacy_pageviews = false }
it "won't redirects from site_traffic to consolidated_page_views" do
visit "/admin/reports/site_traffic"
expect(page).to have_current_path("/admin/reports/site_traffic")
end
end
context "with legacy reports" do
before { SiteSetting.reporting_improvements = true }
it "does not list bookmarks on the index page but allows direct access with a warning" do
visit "/admin/reports"
expect(page).to have_no_css(
".admin-section-landing-item__title",
text: I18n.t("reports.bookmarks.title"),
)
visit "/admin/reports/bookmarks"
expect(page).to have_css(".admin-report")
expect(page).to have_css(
".alert.alert-info",
text: I18n.t("admin_js.admin.reports.legacy_warning"),
)
end
end
end