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
Add test for conflicting modifications in team panner
Henriette Darge002587c77520
diff --git a/modules/team_planner/spec/features/team_planner_error_handling_spec.rb b/modules/team_planner/spec/features/team_planner_error_handling_spec.rbindex f689e5125ba..28bf780ebd7 100644--- a/modules/team_planner/spec/features/team_planner_error_handling_spec.rb+++ b/modules/team_planner/spec/features/team_planner_error_handling_spec.rb@@ -34,7 +34,7 @@ require_relative './shared_context'describe 'Team planner error handling', type: :feature, js: true doinclude_context 'with team planner full access'- let!(:first_wp) do+ let!(:work_package) doFactoryBot.create :work_package,project: project,type: type,@@ -44,10 +44,10 @@ describe 'Team planner error handling', type: :feature, js: true doendlet!(:custom_field) do- FactoryBot.create(:work_package_custom_field,+ FactoryBot.create :work_package_custom_field,default_value: nil,is_for_all: true,- is_required: false)+ is_required: falseendlet(:type) { FactoryBot.create(:type, custom_fields: [custom_field]) }@@ -57,28 +57,59 @@ describe 'Team planner error handling', type: :feature, js: true doproject.types << typeproject.save!- custom_field.is_required = true- custom_field.save!-team_planner.visit!team_planner.add_assignee userteam_planner.within_lane(user) do- team_planner.expect_event first_wp, present: true+ team_planner.expect_event work_package, present: trueendendit 'cannot change the wp because of required fields not being set' do+ custom_field.is_required = true+ custom_field.save!+# Try to move the wpretry_block do- team_planner.drag_wp_by_pixel(first_wp, 150, 0)+ team_planner.drag_wp_by_pixel(work_package, 150, 0)end- team_planner.expect_toast(type: :error, message: 'Custom Field Nr. 1 can\'t be blank')+ team_planner.expect_toast(type: :error, message: "#{custom_field.name} can't be blank")team_planner.within_lane(user) do- team_planner.expect_event first_wp+ team_planner.expect_event work_package+ end+ end++ it 'cannot change the wp because of conflicting modifications' do+ # Try to move the wp+ retry_block do+ wp_strip = page.find('.fc-event', text: work_package.subject)++ page+ .driver+ .browser+ .action+ .move_to(wp_strip.native)+ .click_and_hold(wp_strip.native)+ .perform++ # Enforce a lockVersion conflict+ work_package.reload.touch++ page+ .driver+ .browser+ .action+ .move_by(150, 0)+ .release+ .performend++ team_planner.expect_toast(type: :error, message: I18n.t('api_v3.errors.code_409'))++ work_package.reload+ expect(work_package.start_date).to eq(Time.zone.today.beginning_of_week.next_occurring(:tuesday))endendenddiff --git a/modules/team_planner/spec/features/team_planner_user_interaction_spec.rb b/modules/team_planner/spec/features/team_planner_user_interaction_spec.rbindex bd93afcebce..64be66825fb 100644--- a/modules/team_planner/spec/features/team_planner_user_interaction_spec.rb+++ b/modules/team_planner/spec/features/team_planner_user_interaction_spec.rb@@ -126,7 +126,9 @@ describe 'Team planner drag&dop and resizing', type: :feature, js: true doend# Move the third WP to the empty row of the other user- team_planner.drag_wp_by_pixel(third_wp, 0, 100)+ retry_block do+ team_planner.drag_wp_by_pixel(third_wp, 0, 100)+ endteam_planner.expect_and_dismiss_toaster(message: I18n.t('js.notice_successful_update'))team_planner.within_lane(user) dodiff --git a/modules/team_planner/spec/support/pages/team_planner.rb b/modules/team_planner/spec/support/pages/team_planner.rbindex 1ea3b328a73..2e117113cef 100644--- a/modules/team_planner/spec/support/pages/team_planner.rb+++ b/modules/team_planner/spec/support/pages/team_planner.rb@@ -51,7 +51,9 @@ module Pagesenddef expect_empty_state(present: true)- expect(page).to have_conditional_selector(present, '.op-team-planner--no-data', text: 'Add assignees to set up your team planner.')+ expect(page).to have_conditional_selector(present,+ '.op-team-planner--no-data',+ text: 'Add assignees to set up your team planner.')enddef expect_assignee(user, present: true)@@ -138,20 +140,16 @@ module Pages.move_to(wp_strip.native).perform- if is_start_date- resizer = wp_strip.find('.fc-event-resizer-start')- else- resizer = wp_strip.find('.fc-event-resizer-end')- end+ resizer = is_start_date ? wp_strip.find('.fc-event-resizer-start') : wp_strip.find('.fc-event-resizer-end')drag_by_pixel(element: resizer, by_x: number_of_days * 170, by_y: 0) unless resizer.nil?end- def drag_wp_by_pixel(work_package, x, y)+ def drag_wp_by_pixel(work_package, by_x, by_y)source = page.find('.fc-event', text: work_package.subject)- drag_by_pixel(element: source, by_x: x, by_y: y)+ drag_by_pixel(element: source, by_x: by_x, by_y: by_y)enddef expect_wp_not_resizable(work_package)