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 flaky spec

Christophe Bliard0aba09bdd72f
diff --git a/spec/support/components/datepicker/datepicker.rb b/spec/support/components/datepicker/datepicker.rb
index 85fdf8f9320..90cd4f19f6b 100644
--- a/spec/support/components/datepicker/datepicker.rb
+++ b/spec/support/components/datepicker/datepicker.rb
@@ -43,6 +43,7 @@ module Components
def clear!
set_field(container.find_field("work_package[start_date]"), "", wait_for_changes_to_be_applied: false)
set_field(container.find_field("work_package[due_date]"), "", wait_for_changes_to_be_applied: false)
+ wait_for_changes_to_be_applied_after_setting_field
end
def expect_visible
@@ -229,9 +230,13 @@ module Components
end
if wait_for_changes_to_be_applied
- sleep 0.75 # input debounce
- wait_for_network_idle
+ wait_for_changes_to_be_applied_after_setting_field
end
end
+
+ def wait_for_changes_to_be_applied_after_setting_field
+ sleep 0.75 # input debounce
+ wait_for_network_idle
+ end
end
end
diff --git a/spec/support/components/datepicker/work_package_datepicker.rb b/spec/support/components/datepicker/work_package_datepicker.rb
index 7b2e8e0d2d4..2be4cdbd7ed 100644
--- a/spec/support/components/datepicker/work_package_datepicker.rb
+++ b/spec/support/components/datepicker/work_package_datepicker.rb
@@ -7,9 +7,8 @@ module Components
include MonthRangeSelection
def clear!
- super
-
set_field(duration_field, "", wait_for_changes_to_be_applied: false)
+ super
end
def expect_banner_text(text, **)