0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-11 02:59:07 +08:00
discourse/spec/system/page_objects/pages/admin_report.rb
Alan Guo Xiang Tan 77ec3d235d
FEATURE: Add admin report group filter URLs (#41383)
This PR lets admins open the existing reports index with a report group
selected from the URL.

Previously, `/admin/reports` grouped reports visually, but the selected
group could not be represented in a bookmarkable URL. This keeps the
existing reports index and filter controls while adding URL-backed group
selection for any report group, including groups provided by plugins.
2026-07-07 09:49:48 +08:00

68 lines
1.7 KiB
Ruby
Vendored

# frozen_string_literal: true
module PageObjects
module Pages
class AdminReport < PageObjects::Pages::Base
def visit_index(group: nil)
page.visit("/admin/reports#{group ? "?group=#{group}" : ""}")
self
end
def visit_default_dashboard_report
page.visit(
"/admin/reports/#{SeedData::AdminDashboardReports::DEFAULT_BUILTIN_REPORTS.first}",
)
self
end
def has_back_to_dashboard?
has_link?("Back to dashboard")
end
def has_no_back_to_dashboard?
has_no_link?("Back to dashboard")
end
def has_back_to_all_reports?
has_link?("Back to all reports", href: "/admin/reports")
end
def has_no_back_to_all_reports?
has_no_link?("Back to all reports")
end
def go_back
find(".back-button").click
self
end
def filter_controls
PageObjects::Components::AdminFilterControls.new(".admin-filter-controls")
end
def has_group?(name)
page.has_css?(".admin-reports-group__title", text: name)
end
def has_no_group?(name)
page.has_no_css?(".admin-reports-group__title", text: name)
end
def has_report?(title)
page.has_css?(".admin-section-landing-item__title", text: title)
end
def has_no_report?(title)
page.has_no_css?(".admin-section-landing-item__title", text: title)
end
def has_current_all_reports_path?
page.has_current_path?("/admin/reports")
end
def has_current_reports_path?(group: nil)
page.has_current_path?("/admin/reports#{group ? "?group=#{group}" : ""}")
end
end
end
end