2023-10-19 00:23:41 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-11-20 10:49:49 -05:00
|
|
|
describe "Admin Revamp | Sidebar Navigation", type: :system do
|
2023-11-09 17:47:59 -05:00
|
|
|
fab!(:admin)
|
2023-12-17 20:48:25 -05:00
|
|
|
let(:sidebar) { PageObjects::Components::NavigationMenu::Sidebar.new }
|
2023-10-19 00:23:41 -04:00
|
|
|
|
|
|
|
before do
|
2023-12-17 20:48:25 -05:00
|
|
|
SiteSetting.enable_admin_sidebar_navigation = true
|
2023-10-19 00:23:41 -04:00
|
|
|
sign_in(admin)
|
|
|
|
end
|
|
|
|
|
2023-12-17 20:48:25 -05:00
|
|
|
it "shows the sidebar when navigating to an admin route and hides it when leaving" do
|
2023-10-19 00:23:41 -04:00
|
|
|
visit("/latest")
|
2023-12-17 20:48:25 -05:00
|
|
|
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
|
|
|
|
|
2023-12-20 20:37:20 -05:00
|
|
|
context "when the setting is disabled" do
|
|
|
|
before { SiteSetting.enable_admin_sidebar_navigation = false }
|
|
|
|
|
|
|
|
it "does not show the admin sidebar" do
|
|
|
|
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
|
2023-10-19 00:23:41 -04:00
|
|
|
end
|
|
|
|
end
|