Alan Guo Xiang Tan c2295b9d5d
DEV: Unskip flaky editing sidebar nav menu categories on mobile test (#24412)
Why this change?

The test became flaky due to d208396c5c495301cf301426a4166006ffb1d285.
In that commit, we introduced `page.has_no_css?("div.menu-panel.animating")` to `PageObjects::Components::NavigationMenu::Sidebar#open_on_mobile` but
it did not work as intended because `page.has_no_css?("div.menu-panel.animating")` can return `true` immediately as the `animating` class has not been added
to the element.

What does this change do?

Switch to the `wait_for_animation` system helper to ensure that all
animations have ended on the element.
2023-11-17 06:37:20 +08:00

47 lines
1.3 KiB
Ruby

# frozen_string_literal: true
module PageObjects
module Components
module NavigationMenu
class Sidebar < Base
def open_on_mobile
click_button("toggle-hamburger-menu")
wait_for_animation(find("div.menu-panel"))
end
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?
community_section.has_no_button?(class: "sidebar-section-link-button")
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
end
end
end
end