Files
discourse/spec/system/page_objects/pages/admin_new_features.rb
Martin Brennan b471e3d5ba FEATURE: Allow showing only experiments on "What's new?" (#31347)
This commit allows admins to filter the list of feature
feed items on the "What's new?" page to _only_ show experiments.

This is useful to both find existing experiments they may have
enabled, and to get a better overview of new ones they would
like to try.

This will eventually not be required when we build a dedicated
config page for experiments.
2025-02-14 13:30:37 +10:00

61 lines
1.5 KiB
Ruby

# frozen_string_literal: true
module PageObjects
module Pages
class AdminNewFeatures < PageObjects::Pages::Base
def visit
page.visit("/admin/whats-new")
self
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_experiment_button?(enabled)
page.has_css?(
".admin-new-feature-item__feature-toggle .d-toggle-switch__checkbox[aria-checked='#{enabled}']",
visible: false,
)
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)
element = find(".admin-config-area-card__title")
element.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
toggle_switch =
PageObjects::Components::DToggleSwitch.new(
".admin-new-features__experiments-filter .d-toggle-switch__checkbox",
)
toggle_switch.toggle
end
end
end
end