Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix spec test.

Christophe Bliard087da9c0215f
diff --git a/spec/support/shared/drag_and_drop_helper_spec.rb b/spec/support/shared/drag_and_drop_helper_spec.rb
index d1f8de97748..9e266c1a64e 100644
--- a/spec/support/shared/drag_and_drop_helper_spec.rb
+++ b/spec/support/shared/drag_and_drop_helper_spec.rb
@@ -63,7 +63,7 @@ def drag_n_drop_element(from:, to:, offset_x: nil, offset_y: nil)
end
def drag_by_pixel(element:, by_x:, by_y:)
- scroll_to_element(element)
+ scroll_to_element(element, block: :center)
page
.driver
diff --git a/spec/support/shared/scroll_into_view_helpers.rb b/spec/support/shared/scroll_into_view_helpers.rb
index 79e3f24fb3e..f531f6062cd 100644
--- a/spec/support/shared/scroll_into_view_helpers.rb
+++ b/spec/support/shared/scroll_into_view_helpers.rb
@@ -27,9 +27,14 @@
#++
# Scrolls a native element into view using JS
-def scroll_to_element(element)
+# @param element [Capybara::Node::Element] the element to scroll into view
+# @param block [Symbol] (optional) Defines vertical alignment.
+# One of `:start`, `:center`, `:end`, or `:nearest`. Defaults to `:start`.
+# @param inline [Symbol] (optional) Defines horizontal alignment.
+# One of `:start`, `:center`, `:end`, or `:nearest`. Defaults to `:nearest`..
+def scroll_to_element(element, block: :start, inline: :nearest)
script = <<-JS
- arguments[0].scrollIntoView(true);
+ arguments[0].scrollIntoView({block: "#{block}", inline: "#{inline}"});
JS
if using_cuprite?
page.driver.execute_script(script, element.native)