Skip to content

A platform for community discussion. Free, open, simple.

DEV: Change sidebar header dropdown to use wait_for_animation (#20627)

Martin Brennan168de5253863
diff --git a/app/assets/javascripts/discourse/app/components/site-header.js b/app/assets/javascripts/discourse/app/components/site-header.js
index f215fa6ec5d..58cf5a78c84 100644
--- a/app/assets/javascripts/discourse/app/components/site-header.js
+++ b/app/assets/javascripts/discourse/app/components/site-header.js
@@ -78,7 +78,6 @@ const SiteHeaderComponent = MountWidget.extend(
headerCloak.classList.add("animate");
this._scheduledRemoveAnimate = discourseLater(() => {
panel.classList.remove("animate");
- panel.classList.add("animated");
headerCloak.classList.remove("animate");
}, 200);
panel.style.setProperty("--offset", 0);
@@ -90,7 +89,6 @@ const SiteHeaderComponent = MountWidget.extend(
this._animate = true;
const headerCloak = document.querySelector(".header-cloak");
panel.classList.add("animate");
- panel.classList.remove("animated");
headerCloak.classList.add("animate");
if (menuOrigin === "left") {
panel.style.setProperty("--offset", `-100vw`);
diff --git a/plugins/chat/spec/system/page_objects/chat/chat_channel.rb b/plugins/chat/spec/system/page_objects/chat/chat_channel.rb
index b0729fe3c3c..1d093778b8a 100644
--- a/plugins/chat/spec/system/page_objects/chat/chat_channel.rb
+++ b/plugins/chat/spec/system/page_objects/chat/chat_channel.rb
@@ -3,8 +3,6 @@
module PageObjects
module Pages
class ChatChannel < PageObjects::Pages::Base
- include SystemHelpers
-
def type_in_composer(input)
find(".chat-composer-input").send_keys(input)
end
diff --git a/spec/system/page_objects/components/base.rb b/spec/system/page_objects/components/base.rb
index cb933c19688..4815a37b240 100644
--- a/spec/system/page_objects/components/base.rb
+++ b/spec/system/page_objects/components/base.rb
@@ -5,6 +5,7 @@ module PageObjects
class Base
include Capybara::DSL
include RSpec::Matchers
+ include SystemHelpers
end
end
end
diff --git a/spec/system/page_objects/components/sidebar_header_dropdown.rb b/spec/system/page_objects/components/sidebar_header_dropdown.rb
index 1d74577f927..3556feb1616 100644
--- a/spec/system/page_objects/components/sidebar_header_dropdown.rb
+++ b/spec/system/page_objects/components/sidebar_header_dropdown.rb
@@ -5,9 +5,7 @@ module PageObjects
class SidebarHeaderDropdown < PageObjects::Components::Base
def click
page.find(".hamburger-dropdown").click
-
- # `.animated` is important here because we want to wait until dropdown has finished its animation completely
- page.has_css?(".menu-panel.animated")
+ wait_for_animation(find(".menu-panel"), timeout: 5)
self
end
diff --git a/spec/system/page_objects/pages/base.rb b/spec/system/page_objects/pages/base.rb
index 48b005fc1c2..42d716abb9a 100644
--- a/spec/system/page_objects/pages/base.rb
+++ b/spec/system/page_objects/pages/base.rb
@@ -4,6 +4,8 @@ module PageObjects
module Pages
class Base
include Capybara::DSL
+ include RSpec::Matchers
+ include SystemHelpers
end
end
end
diff --git a/spec/system/viewing_sidebar_spec.rb b/spec/system/viewing_sidebar_spec.rb
index e830fe59440..1866194e41c 100644
--- a/spec/system/viewing_sidebar_spec.rb
+++ b/spec/system/viewing_sidebar_spec.rb
@@ -5,7 +5,7 @@ describe "Viewing sidebar", type: :system, js: true do
fab!(:user) { Fabricate(:user) }
fab!(:category_sidebar_section_link) { Fabricate(:category_sidebar_section_link, user: user) }
- before_all { sign_in(user) }
+ before { sign_in(user) }
describe "when using the legacy navigation menu" do
before { SiteSetting.navigation_menu = "legacy" }