mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 03:56:21 +08:00
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.
This commit is contained in:
@ -51,14 +51,14 @@ describe "Admin New Features Page", type: :system do
|
||||
|
||||
new_features_page.visit
|
||||
|
||||
within find(".admin-config-area-card:first-child") do
|
||||
within find(".admin-config-area-card[data-new-features-group='November 2023']") do
|
||||
expect(new_features_page).to have_screenshot
|
||||
expect(new_features_page).to have_learn_more_link
|
||||
expect(new_features_page).to have_no_emoji
|
||||
expect(new_features_page).to have_date("November 2023")
|
||||
end
|
||||
|
||||
within find(".admin-config-area-card:last-child") do
|
||||
within find(".admin-config-area-card[data-new-features-group='August 2023']") do
|
||||
expect(new_features_page).to have_screenshot
|
||||
expect(new_features_page).to have_learn_more_link
|
||||
expect(new_features_page).to have_no_emoji
|
||||
@ -155,6 +155,45 @@ describe "Admin New Features Page", type: :system do
|
||||
expect(new_features_page).to have_no_experimental_text
|
||||
end
|
||||
|
||||
it "allows filtering to only show experimental items" do
|
||||
DiscourseUpdates.stubs(:new_features).returns(
|
||||
[
|
||||
{
|
||||
"id" => 7,
|
||||
"user_id" => 1,
|
||||
"emoji" => "😍",
|
||||
"title" => "New feature",
|
||||
"description" => "New feature description",
|
||||
"link" => "https://meta.discourse.org",
|
||||
"tier" => [],
|
||||
"discourse_version" => "",
|
||||
"created_at" => "2023-11-10T02:52:41.462Z",
|
||||
"updated_at" => "2023-11-10T04:28:47.020Z",
|
||||
"experiment_setting" => "experimental_form_templates",
|
||||
"experiment_enabled" => true,
|
||||
},
|
||||
{
|
||||
"id" => 8,
|
||||
"user_id" => 1,
|
||||
"emoji" => "🥹",
|
||||
"title" => "Non experimental feature",
|
||||
"description" => "Cool description",
|
||||
"link" => "https://meta.discourse.org",
|
||||
"tier" => [],
|
||||
"discourse_version" => "",
|
||||
"created_at" => "2023-11-10T02:52:41.462Z",
|
||||
"updated_at" => "2023-11-10T04:28:47.020Z",
|
||||
"experiment_setting" => nil,
|
||||
"experiment_enabled" => false,
|
||||
},
|
||||
],
|
||||
)
|
||||
new_features_page.visit
|
||||
new_features_page.toggle_experiments_only
|
||||
expect(new_features_page).to have_experimental_text
|
||||
expect(new_features_page).not_to have_text("Non experimental feature")
|
||||
end
|
||||
|
||||
it "displays a new feature indicator on the sidebar and clears it when navigating to what's new" do
|
||||
DiscourseUpdates.stubs(:has_unseen_features?).returns(true)
|
||||
visit "/admin"
|
||||
|
@ -47,6 +47,14 @@ module PageObjects
|
||||
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
|
||||
|
Reference in New Issue
Block a user