discourse/spec/system/admin_revamp_sidebar_navigation_spec.rb
Martin Brennan 6de00f89c2
FEATURE: Initial admin sidebar navigation (#24789)
This is v0 of admin sidebar navigation, which moves
all of the top-level admin nav from the top of the page
into a sidebar. This is hidden behind a enable_admin_sidebar_navigation
site setting, and is opt-in for now.

This sidebar is dynamically shown whenever the user enters an
admin route in the UI, and is hidden and replaced with either
the:

* Main forum sidebar
* Chat sidebar

Depending on where they navigate to. For now, custom sections
are not supported in the admin sidebar.

This commit removes the experimental admin sidebar generation rake
task but keeps the experimental sidebar UI for now for further
testing; it just uses the real nav as the default now.
2023-12-18 11:48:25 +10:00

31 lines
1.1 KiB
Ruby

# frozen_string_literal: true
describe "Admin Revamp | Sidebar Navigation", type: :system do
fab!(:admin)
let(:sidebar) { PageObjects::Components::NavigationMenu::Sidebar.new }
before do
SiteSetting.enable_admin_sidebar_navigation = true
sign_in(admin)
end
it "shows the sidebar when navigating to an admin route and hides it when leaving" do
visit("/latest")
sidebar.click_link_in_section("community", "admin")
expect(page).to have_current_path("/admin")
expect(sidebar).to be_visible
expect(page).to have_no_css(".admin-main-nav")
sidebar.click_link_in_section("admin-nav-section-root", "back_to_forum")
expect(page).to have_current_path("/latest")
expect(sidebar).to have_no_section("admin-nav-section-root")
end
it "does not show the admin sidebar if the setting is disabled" do
SiteSetting.enable_admin_sidebar_navigation = false
visit("/latest")
sidebar.click_link_in_section("community", "admin")
expect(page).to have_current_path("/admin")
expect(sidebar).to have_no_section("admin-nav-section-root")
end
end