discourse/spec/system/page_objects/pages/admin_new_features.rb
Martin Brennan 725e146dca
FIX: Calculate experiment_enabled on server for "What's new?" (#30599)
Experimental "What's new?" feature feed items previously calculated
a boolean for experimentEnabled on the client based on the siteSettings
service, and this would control the initial state of the experiment
toggle.

However this requires the person who creates the site setting for the
experiment to remember to set it to `client: true`. This commit removes
that manual step by calculating whether the experiment is enabled
server-side, where we have access to all the site settings.
2025-01-07 11:27:24 +10:00

53 lines
1.3 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
end
end
end