2023-07-11 09:40:37 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module PageObjects
|
|
|
|
module Components
|
|
|
|
module NavigationMenu
|
|
|
|
class Sidebar < Base
|
|
|
|
def open_on_mobile
|
|
|
|
click_button("toggle-hamburger-menu")
|
2023-11-17 06:37:20 +08:00
|
|
|
wait_for_animation(find("div.menu-panel"))
|
2023-07-11 09:40:37 +08:00
|
|
|
end
|
|
|
|
|
2024-05-13 12:40:23 +08:00
|
|
|
def click_header_toggle
|
|
|
|
find(header_toggle_css).click
|
|
|
|
end
|
|
|
|
|
|
|
|
def header_toggle_css
|
|
|
|
".header-sidebar-toggle"
|
|
|
|
end
|
|
|
|
|
2023-07-11 09:40:37 +08:00
|
|
|
def visible?
|
|
|
|
page.has_css?("#d-sidebar")
|
|
|
|
end
|
|
|
|
|
|
|
|
def not_visible?
|
|
|
|
page.has_no_css?("#d-sidebar")
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_no_customize_community_section_button?
|
2024-05-07 21:20:30 +08:00
|
|
|
community_section.has_no_button?('[data-list-item-name="customize"]')
|
2023-07-11 09:40:37 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def click_customize_community_section_button
|
|
|
|
community_section.click_button(
|
|
|
|
I18n.t("js.sidebar.sections.community.edit_section.sidebar"),
|
|
|
|
)
|
|
|
|
|
|
|
|
expect(community_section).to have_no_css(".sidebar-more-section-links-details")
|
|
|
|
|
|
|
|
PageObjects::Modals::SidebarSectionForm.new
|
|
|
|
end
|
|
|
|
|
|
|
|
def click_community_section_more_button
|
|
|
|
community_section.click_button(class: "sidebar-more-section-links-details-summary")
|
|
|
|
expect(community_section).to have_css(".sidebar-more-section-links-details")
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def custom_section_modal_title
|
|
|
|
find("#discourse-modal-title")
|
|
|
|
end
|
2024-03-27 11:42:06 +08:00
|
|
|
|
|
|
|
def toggle_all_sections
|
|
|
|
find(".sidebar-toggle-all-sections").click
|
|
|
|
end
|
2023-07-11 09:40:37 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|