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 modules/costs/spec/features/timer_spec

Christophe Bliardf563f5849a97
diff --git a/modules/costs/spec/features/timer_spec.rb b/modules/costs/spec/features/timer_spec.rb
index a2738b05b30..42e64f40743 100644
--- a/modules/costs/spec/features/timer_spec.rb
+++ b/modules/costs/spec/features/timer_spec.rb
@@ -68,6 +68,8 @@ RSpec.describe 'Work Package timer', js: true do
time_logging_modal.has_field_with_value 'spentOn', Date.current.strftime
time_logging_modal.has_field_with_value 'hours', /(\d\.)?\d+/
time_logging_modal.work_package_is_missing false
+ # wait for available_work_packages query to finish before saving
+ time_logging_modal.expect_work_package(work_package_a.subject)
time_logging_modal.perform_action 'Save'
time_logging_modal.is_visible false
@@ -104,6 +106,8 @@ RSpec.describe 'Work Package timer', js: true do
time_logging_modal.has_field_with_value 'spentOn', Date.current.strftime
time_logging_modal.has_field_with_value 'hours', /(\d\.)?\d+/
time_logging_modal.work_package_is_missing false
+ # wait for available_work_packages query to finish before saving
+ time_logging_modal.expect_work_package(work_package_a.subject)
time_logging_modal.perform_action 'Save'
@@ -167,6 +171,8 @@ RSpec.describe 'Work Package timer', js: true do
time_logging_modal.has_field_with_value 'spentOn', Date.current.strftime
time_logging_modal.has_field_with_value 'hours', /(\d\.)?\d+/
time_logging_modal.work_package_is_missing false
+ # wait for available_work_packages query to finish before saving
+ time_logging_modal.expect_work_package(work_package_a.subject)
time_logging_modal.perform_action 'Save'
wp_view_b.expect_and_dismiss_toaster message: I18n.t(:notice_successful_update)
@@ -178,6 +184,8 @@ RSpec.describe 'Work Package timer', js: true do
time_logging_modal.has_field_with_value 'spentOn', Date.current.strftime
time_logging_modal.has_field_with_value 'hours', /(\d\.)?\d+/
time_logging_modal.work_package_is_missing false
+ # wait for available_work_packages query to finish before saving
+ time_logging_modal.expect_work_package(work_package_a.subject)
time_logging_modal.perform_action 'Save'
wp_view_b.expect_and_dismiss_toaster message: I18n.t(:notice_successful_update)