2023-11-20 06:59:04 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2024-08-16 07:12:24 +08:00
|
|
|
describe "Admin New Features Page", type: :system do
|
|
|
|
let(:new_features_page) { PageObjects::Pages::AdminNewFeatures.new }
|
2024-08-19 12:50:30 +08:00
|
|
|
let(:sidebar) { PageObjects::Components::NavigationMenu::Sidebar.new }
|
2023-11-22 07:03:17 +08:00
|
|
|
fab!(:admin)
|
2023-11-20 06:59:04 +08:00
|
|
|
|
2024-08-19 12:50:30 +08:00
|
|
|
before do
|
|
|
|
SiteSetting.navigation_menu = "sidebar"
|
|
|
|
SiteSetting.admin_sidebar_enabled_groups = [
|
|
|
|
Group::AUTO_GROUPS[:admins],
|
|
|
|
Group::AUTO_GROUPS[:moderators],
|
|
|
|
]
|
|
|
|
sign_in(admin)
|
|
|
|
end
|
2023-11-20 06:59:04 +08:00
|
|
|
|
2024-06-04 21:16:24 +08:00
|
|
|
it "displays new features with screenshot taking precedence over emoji" do
|
2023-11-20 06:59:04 +08:00
|
|
|
DiscourseUpdates.stubs(:new_features).returns(
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"id" => 7,
|
|
|
|
"user_id" => 1,
|
|
|
|
"emoji" => "😍",
|
|
|
|
"title" => "New feature",
|
|
|
|
"description" => "New feature description",
|
|
|
|
"link" => "https://meta.discourse.org",
|
|
|
|
"tier" => [],
|
2024-07-29 12:20:12 +08:00
|
|
|
"discourse_version" => "3.3.0.beta4",
|
2023-11-20 06:59:04 +08:00
|
|
|
"created_at" => "2023-11-10T02:52:41.462Z",
|
|
|
|
"updated_at" => "2023-11-10T04:28:47.020Z",
|
|
|
|
"screenshot_url" =>
|
|
|
|
"/uploads/default/original/1X/bab053dc94dc4e0d357b0e777e3357bb1ac99e12.jpeg",
|
|
|
|
},
|
2024-07-29 12:20:12 +08:00
|
|
|
{
|
|
|
|
"id" => 8,
|
|
|
|
"user_id" => 1,
|
|
|
|
"emoji" => "🐼",
|
|
|
|
"title" => "New feature from previous release",
|
|
|
|
"description" => "New feature description",
|
|
|
|
"link" => "https://meta.discourse.org",
|
|
|
|
"tier" => [],
|
|
|
|
"discourse_version" => "3.3.0.beta3",
|
|
|
|
"created_at" => "2023-09-10T02:52:41.462Z",
|
|
|
|
"updated_at" => "2023-09-10T04:28:47.020Z",
|
|
|
|
"released_at" => "2023-08-10T04:28:47.020Z",
|
|
|
|
"screenshot_url" =>
|
|
|
|
"/uploads/default/original/1X/bab054dc94dc4e0d357b0e777e3357bb1ac99e13.jpeg",
|
|
|
|
},
|
2023-11-20 06:59:04 +08:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
new_features_page.visit
|
2024-07-29 12:20:12 +08:00
|
|
|
|
|
|
|
within find(".admin-config-area-card:first-child") 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")
|
|
|
|
expect(new_features_page).to have_version("3.3.0.beta4")
|
|
|
|
end
|
|
|
|
|
|
|
|
within find(".admin-config-area-card:last-child") 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("August 2023")
|
|
|
|
expect(new_features_page).to have_version("3.3.0.beta3")
|
|
|
|
end
|
2023-11-20 06:59:04 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
it "displays new features with emoji when no screenshot" 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",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
)
|
|
|
|
new_features_page.visit
|
|
|
|
expect(new_features_page).to have_emoji
|
|
|
|
expect(new_features_page).to have_no_screenshot
|
|
|
|
end
|
2024-08-19 12:50:30 +08:00
|
|
|
|
|
|
|
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"
|
|
|
|
sidebar.toggle_all_sections
|
|
|
|
expect(sidebar.find_section_link("admin_whats_new")).to have_css(
|
|
|
|
".sidebar-section-link-suffix.admin-sidebar-nav-link__dot",
|
|
|
|
)
|
|
|
|
sidebar.find_section_link("admin_whats_new").click
|
|
|
|
expect(sidebar.find_section_link("admin_whats_new")).to have_no_css(
|
|
|
|
".sidebar-section-link-suffix.admin-sidebar-nav-link__dot",
|
|
|
|
)
|
|
|
|
end
|
2023-11-20 06:59:04 +08:00
|
|
|
end
|