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 update_ancestors_spec for split view create

Aaron Contreras75e36e442572
diff --git a/spec/features/work_packages/update_ancestors_spec.rb b/spec/features/work_packages/update_ancestors_spec.rb
index 67427a0d3ae..7a0afe6ce4e 100644
--- a/spec/features/work_packages/update_ancestors_spec.rb
+++ b/spec/features/work_packages/update_ancestors_spec.rb
@@ -157,7 +157,11 @@ RSpec.describe "Update ancestors", :js, :with_cuprite do
context_menu.choose(I18n.t("js.relation_buttons.add_new_child"))
split_view_create = Pages::SplitWorkPackageCreate.new(project:)
- split_view_create.set_attributes({ subject: "new child", estimatedTime: 3, remainingTime: 1 })
+ split_view_create.set_attributes({ subject: "new child" })
+ # Need a better way to deal with interacting with the
+ # Progress Modal due to the intermediate updates it is
+ # capable of.
+ split_view_create.set_progress_attributes({ estimatedTime: 3, remainingTime: 1 })
split_view_create.save!
split_view_create.expect_and_dismiss_toaster message: "Successful creation"
diff --git a/spec/support/edit_fields/progress_edit_field.rb b/spec/support/edit_fields/progress_edit_field.rb
index f51ba78e285..049fd0a246b 100644
--- a/spec/support/edit_fields/progress_edit_field.rb
+++ b/spec/support/edit_fields/progress_edit_field.rb
@@ -76,6 +76,14 @@ class ProgressEditField < EditField
expect(page).to have_no_css(MODAL_SELECTOR)
end
+ # Spot drop modals don't have a span tag that can be
+ # interacted with. Hence, we adapt the display_selector
+ # to conform to the spot-drop-modal's element that can
+ # be interacted with.
+ def display_selector
+ ".inline-edit--active-field"
+ end
+
private
attr_reader :field_name
diff --git a/spec/support/pages/work_packages/abstract_work_package.rb b/spec/support/pages/work_packages/abstract_work_package.rb
index 496f23831f0..3d72c2220af 100644
--- a/spec/support/pages/work_packages/abstract_work_package.rb
+++ b/spec/support/pages/work_packages/abstract_work_package.rb
@@ -208,6 +208,15 @@ module Pages
end
end
+ def set_progress_attributes(key_value_map, save_intermediate_updates: true, save: !create_page?)
+ key_value_map.each_with_index.map do |(key, value)|
+ field = work_package_field(key)
+ field.update(value, save: save_intermediate_updates)
+ end
+
+ ensure_no_conflicting_modifications if save
+ end
+
def work_package_field(key)
case key
when /customField(\d+)$/