2023-02-21 09:59:56 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module PageObjects
|
|
|
|
module Components
|
|
|
|
class SidebarHeaderDropdown < PageObjects::Components::Base
|
|
|
|
def click
|
|
|
|
page.find(".hamburger-dropdown").click
|
2023-03-10 12:54:57 +08:00
|
|
|
wait_for_animation(find(".menu-panel"), timeout: 5)
|
2023-02-23 15:01:39 +08:00
|
|
|
self
|
2023-02-21 09:59:56 +08:00
|
|
|
end
|
|
|
|
|
2023-02-23 15:01:39 +08:00
|
|
|
SIDEBAR_HAMBURGER_DROPDOWN = ".sidebar-hamburger-dropdown"
|
|
|
|
|
2023-02-21 09:59:56 +08:00
|
|
|
def visible?
|
2023-02-23 15:01:39 +08:00
|
|
|
page.has_css?(SIDEBAR_HAMBURGER_DROPDOWN)
|
|
|
|
end
|
|
|
|
|
|
|
|
def hidden?
|
|
|
|
page.has_no_css?(SIDEBAR_HAMBURGER_DROPDOWN)
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_no_keyboard_shortcuts_button?
|
|
|
|
page.has_no_css?(".sidebar-footer-actions-keyboard-shortcuts")
|
|
|
|
end
|
|
|
|
|
|
|
|
def click_community_header_button
|
|
|
|
page.click_button(
|
2023-05-29 13:20:23 +08:00
|
|
|
I18n.t("js.sidebar.sections.community.header_action_create_topic_title"),
|
2023-02-23 15:01:39 +08:00
|
|
|
class: "sidebar-section-header-button",
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2023-06-15 09:36:38 +08:00
|
|
|
def click_topics_link
|
2023-04-12 15:52:10 +08:00
|
|
|
find(".sidebar-section-link[data-link-name='everything']").click
|
2023-02-23 15:01:39 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def click_toggle_to_desktop_view_button
|
|
|
|
page.click_button(
|
|
|
|
I18n.t("js.desktop_view"),
|
|
|
|
class: "sidebar-footer-actions-toggle-mobile-view",
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def click_outside
|
2023-05-25 00:59:12 +08:00
|
|
|
width = page.evaluate_script("document.body.clientWidth")
|
|
|
|
page.find("body").click(x: width - 1, y: 1)
|
2023-02-21 09:59:56 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|