0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-14 13:58:53 +08:00
discourse/spec/system/page_objects/pages/admin_new_features.rb
Martin Brennan 8faf71e3bb
FIX: Redirect upcoming change notifications to What's New when permanent (#41385)
When an upcoming change was automatically enabled, the notification
linked admins to the upcoming changes config page. But once a change
reaches permanent status it no longer appears there (that page only
lists experimental through stable) and instead surfaces on the What's
New page. So if the notification was left unread until the change became
permanent, clicking it dropped the admin on an empty filtered list.

This resolves the change's status at click time rather than baking it
into the notification. The permanent change names are now exposed to
staff via the site serializer, and the notification's link checks them:
if every referenced change is now permanent, it sends the admin to
What's New scrolled to that change's card; otherwise it keeps the
existing upcoming changes page where the still non-permanent changes
remain actionable.

To support the scroll, every What's New item now has a stable id anchor,
and the page accepts a scrollTo query param that scrolls to and briefly
highlights the matching card once the feed loads.
2026-07-03 15:28:21 +10:00

72 lines
1.9 KiB
Ruby
Vendored

# frozen_string_literal: true
module PageObjects
module Pages
class AdminWhatsNew < PageObjects::Pages::Base
def visit
page.visit("/admin/whats-new")
self
end
def within_new_feature_group(month_and_year, &block)
within find(".admin-config-area-card[data-new-features-group='#{month_and_year}']") do
block.call
end
end
def within_new_feature_item(title, &block)
within find(".admin-new-feature-item##{title.parameterize.downcase}") do
block.call
end
end
def has_screenshot?
page.has_css?(".admin-new-feature-item__screenshot")
end
def has_no_screenshot?
page.has_no_css?(".admin-new-feature-item__screenshot")
end
def has_toggle_feature_button?
page.has_css?(".admin-new-feature-item__feature-toggle .d-toggle-switch__checkbox")
end
def has_learn_more_link?
page.has_css?(".admin-new-feature-item__learn-more")
end
def has_emoji?
page.has_css?(".admin-new-feature-item__new-feature-emoji")
end
def has_no_emoji?
page.has_no_css?(".admin-new-feature-item__new-feature-emoji")
end
def has_date?(date)
find(".admin-config-area-card__title").has_text?(date)
end
def has_experimental_text?
page.has_css?(".admin-new-feature-item__header-experimental")
end
def has_no_experimental_text?
page.has_no_css?(".admin-new-feature-item__header-experimental")
end
def toggle_experiments_only
PageObjects::Components::DToggleSwitch.new(
".admin-new-features__experiments-filter .d-toggle-switch__checkbox",
).toggle
end
def enable_item_toggle
PageObjects::Components::DToggleSwitch.new(
".admin-new-feature-item__feature-toggle .d-toggle-switch__checkbox",
)
end
end
end
end