From c2295b9d5d306106c332994097151d6a4a3694c6 Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Fri, 17 Nov 2023 06:37:20 +0800 Subject: [PATCH] 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. --- spec/system/editing_sidebar_categories_navigation_spec.rb | 2 +- spec/system/page_objects/components/navigation_menu/sidebar.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/system/editing_sidebar_categories_navigation_spec.rb b/spec/system/editing_sidebar_categories_navigation_spec.rb index c7cea8608b1..b7ae3bd0b98 100644 --- a/spec/system/editing_sidebar_categories_navigation_spec.rb +++ b/spec/system/editing_sidebar_categories_navigation_spec.rb @@ -24,7 +24,7 @@ RSpec.describe "Editing sidebar categories navigation", type: :system do before { sign_in(user) } shared_examples "a user can edit the sidebar categories navigation" do |mobile| - xit "allows a user to edit the sidebar categories navigation", mobile: mobile do + it "allows a user to edit the sidebar categories navigation", mobile: mobile do visit "/latest" sidebar.open_on_mobile if mobile diff --git a/spec/system/page_objects/components/navigation_menu/sidebar.rb b/spec/system/page_objects/components/navigation_menu/sidebar.rb index 5c262651944..0be51b8d7aa 100644 --- a/spec/system/page_objects/components/navigation_menu/sidebar.rb +++ b/spec/system/page_objects/components/navigation_menu/sidebar.rb @@ -6,7 +6,7 @@ module PageObjects class Sidebar < Base def open_on_mobile click_button("toggle-hamburger-menu") - page.has_no_css?("div.menu-panel.animating") + wait_for_animation(find("div.menu-panel")) end def visible?