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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fix flaky spec
Christophe Bliard17447f3cc8e8
diff --git a/modules/team_planner/spec/features/team_planner_add_existing_work_packages_spec.rb b/modules/team_planner/spec/features/team_planner_add_existing_work_packages_spec.rbindex 34429384b44..c6d85903af1 100644--- a/modules/team_planner/spec/features/team_planner_add_existing_work_packages_spec.rb+++ b/modules/team_planner/spec/features/team_planner_add_existing_work_packages_spec.rb@@ -70,6 +70,8 @@ RSpec.describe "Team planner add existing work packages",let(:add_existing_pane) { Components::AddExistingPane.new }let(:filters) { Components::WorkPackages::Filters.new }+ let(:this_tuesday) { start_of_week.next_occurring(:tuesday) }+ let(:this_thursday) { start_of_week.next_occurring(:thursday) }context "with full permissions", with_ee: %i[team_planner_view] dobefore do@@ -138,14 +140,14 @@ RSpec.describe "Team planner add existing work packages",add_existing_pane.expect_result second_wp# Drag it to the team planner...- add_existing_pane.drag_wp_by_pixel second_wp, 800, 0+ add_existing_pane.drag_wp_to_date(second_wp, this_tuesday)team_planner.expect_and_dismiss_toaster(message: "Successful update.")# ... and thus update its attributes. Thereby the duration is maintainedexpect(second_wp.reload).to have_attributes(- start_date: start_of_week.next_occurring(:tuesday),- due_date: start_of_week.next_occurring(:thursday),+ start_date: this_tuesday,+ due_date: this_thursday,assigned_to_id: user.id)@@ -154,14 +156,14 @@ RSpec.describe "Team planner add existing work packages",add_existing_pane.expect_result third_wp# Drag it to the team planner...- add_existing_pane.drag_wp_by_pixel third_wp, 800, 100+ add_existing_pane.drag_wp_to_date(third_wp, this_tuesday)team_planner.expect_and_dismiss_toaster(message: "Successful update.")# ... and thus update its attributes. Since no dates were set before, start and end date are set to the same dayexpect(third_wp.reload).to have_attributes(- start_date: start_of_week.next_occurring(:tuesday),- due_date: start_of_week.next_occurring(:tuesday),+ start_date: this_tuesday,+ due_date: this_tuesday,assigned_to_id: user.id)@@ -182,15 +184,15 @@ RSpec.describe "Team planner add existing work packages",add_existing_pane.expect_result third_wp# Drag it to the team planner...- add_existing_pane.drag_wp_by_pixel third_wp, 800, 0+ add_existing_pane.drag_wp_to_date third_wp, this_tuesdayteam_planner.expect_and_dismiss_toaster(message: "Successful update.")# ... and thus update its attributes. Thereby the duration is maintained# and the due date is set to 15 days from the start date (11 days of# duration + 2x2 non-working days for the weekends)expect(third_wp.reload).to have_attributes(- start_date: start_of_week.next_occurring(:tuesday),- due_date: start_of_week.next_occurring(:tuesday) + 14.days,+ start_date: this_tuesday,+ due_date: this_tuesday + 14.days,assigned_to_id: user.id)enddiff --git a/modules/team_planner/spec/support/components/add_existing_pane.rb b/modules/team_planner/spec/support/components/add_existing_pane.rbindex 10a31bbca40..f91eee78720 100644--- a/modules/team_planner/spec/support/components/add_existing_pane.rb+++ b/modules/team_planner/spec/support/components/add_existing_pane.rb@@ -67,11 +67,10 @@ module Componentsendend- def drag_wp_by_pixel(work_package, by_x, by_y)- source = page- .find("[data-test-selector='op-add-existing-pane--wp-#{work_package.id}']")-- drag_by_pixel(element: source, by_x:, by_y:)+ def drag_wp_to_date(work_package, date)+ wp_card = card(work_package)+ day_header = page.find(:columnheader, exact_text: date.strftime("%02d %A"))+ drag_n_drop_element(from: wp_card, to: day_header, offset_y: day_header.native.size.height)enddef card(work_package)