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 broken feature test
Christophe Bliardb5d320a12421
diff --git a/spec/features/work_packages/scheduling/scheduling_mode_spec.rb b/spec/features/work_packages/scheduling/scheduling_mode_spec.rbindex f7f908dc619..c63363e88f1 100644--- a/spec/features/work_packages/scheduling/scheduling_mode_spec.rb+++ b/spec/features/work_packages/scheduling/scheduling_mode_spec.rb@@ -52,6 +52,7 @@ RSpec.describe "scheduling mode", :js dolet!(:wp) docreate(:work_package,project:,+ subject: "wp",schedule_manually: false, # because parent of wp_child and follows wp_prestart_date: Date.parse("2016-01-01"),due_date: Date.parse("2016-01-05"),@@ -60,6 +61,7 @@ RSpec.describe "scheduling mode", :js dolet!(:wp_parent) docreate(:work_package,project:,+ subject: "wp_parent",schedule_manually: false, # because parent of wpstart_date: Date.parse("2016-01-01"),due_date: Date.parse("2016-01-05"))@@ -67,6 +69,7 @@ RSpec.describe "scheduling mode", :js dolet!(:wp_child) docreate(:work_package,project:,+ subject: "wp_child",schedule_manually: false, # because needed to have rescheduling workingstart_date: Date.parse("2016-01-01"),due_date: Date.parse("2016-01-05"),@@ -75,6 +78,7 @@ RSpec.describe "scheduling mode", :js dolet!(:wp_pre) docreate(:work_package,project:,+ subject: "wp_pre",start_date: Date.parse("2015-12-15"),due_date: Date.parse("2015-12-31")).tap do |pre|create(:follows_relation, from: wp, to: pre)@@ -83,6 +87,7 @@ RSpec.describe "scheduling mode", :js dolet!(:wp_suc) docreate(:work_package,project:,+ subject: "wp_suc",schedule_manually: false, # because parent of wp_suc_child and follows wpstart_date: Date.parse("2016-01-06"),due_date: Date.parse("2016-01-10"),@@ -93,6 +98,7 @@ RSpec.describe "scheduling mode", :js dolet!(:wp_suc_parent) docreate(:work_package,project:,+ subject: "wp_suc_parent",schedule_manually: false, # because parent of wp_sucstart_date: Date.parse("2016-01-06"),due_date: Date.parse("2016-01-10"))@@ -100,6 +106,7 @@ RSpec.describe "scheduling mode", :js dolet!(:wp_suc_child) docreate(:work_package,project:,+ subject: "wp_suc_child",schedule_manually: false, # because needed to have rescheduling workingstart_date: Date.parse("2016-01-06"),due_date: Date.parse("2016-01-10"),@@ -108,6 +115,13 @@ RSpec.describe "scheduling mode", :js dolet(:work_packages_page) { Pages::SplitWorkPackage.new(wp, project) }let(:activity_tab) { Components::WorkPackages::Activities.new(wp) }let(:combined_field) { work_packages_page.edit_field(:combinedDate) }+ # get a simplified table showing dates and durations for easier debugging.+ let(:query) do+ create(:query_with_view_work_packages_table,+ user: current_user,+ project:,+ column_names: ["id", "subject", "start_date", "due_date", "duration"])+ enddef expect_dates(work_package, start_date, due_date)work_package.reload@@ -118,7 +132,7 @@ RSpec.describe "scheduling mode", :js docurrent_user { create(:admin) }before do- work_packages_page.visit!+ work_packages_page.visit_query(query)work_packages_page.ensure_page_loadedend@@ -129,7 +143,7 @@ RSpec.describe "scheduling mode", :js do# work package is manually scheduledcombined_field.activate!(expect_open: false)combined_field.expect_active!- combined_field.toggle_scheduling_mode+ combined_field.toggle_scheduling_mode # toggle to manual modecombined_field.update(%w[2016-01-05 2016-01-10], save: false)combined_field.expect_duration 6combined_field.save!@@ -147,7 +161,8 @@ RSpec.describe "scheduling mode", :js doexpect_dates(wp, "2016-01-05", "2016-01-10")expect(wp.schedule_manually).to be_truthy- # is not moved because it is a child+ # is not moved because it wp_pre is an indirect predecessor through its+ # parent wp, so it needs to start right after wp_preexpect_dates(wp_child, "2016-01-01", "2016-01-05")# The due date is moved backwards because its child was moved@@ -167,36 +182,37 @@ RSpec.describe "scheduling mode", :js do# and all work packages that are dependent to be rescheduled again.combined_field.activate!(expect_open: false)combined_field.expect_active!- combined_field.toggle_scheduling_mode+ combined_field.toggle_scheduling_mode # toggle to automatic modecombined_field.save!work_packages_page.expect_and_dismiss_toaster message: "Successful update."- # Moved backward again as the child determines the dates again+ # wp_child had not been moved in the first place+ expect_dates(wp_child, "2016-01-01", "2016-01-05")++ # wp Moved backward again as the child determines the dates againexpect_dates(wp, "2016-01-01", "2016-01-05")expect(wp.schedule_manually).to be_falsey- # Had not been moved in the first place- expect_dates(wp_child, "2016-01-01", "2016-01-05")-- # As the child now again takes up the same time interval as the grandchild,- # the interval is shortened again.+ # As the child (wp) now again takes up the same time interval as the+ # grandchild (wp_child), the interval is shortened again.expect_dates(wp_parent, "2016-01-01", "2016-01-05")- # does not move backwards, as it just increases the gap between wp and wp_suc- expect_dates(wp_suc, "2016-01-11", "2016-01-15")+ # wp_suc_child moves backwards to start as soon as possible after its+ # indirect predecessor (wp) as it is in automatic scheduling mode+ expect_dates(wp_suc_child, "2016-01-06", "2016-01-10")- # does not move backwards either- expect_dates(wp_suc_parent, "2016-01-11", "2016-01-15")+ # wp_suc moves backwards as well because it follows its child dates (wp_suc_child)+ expect_dates(wp_suc, "2016-01-06", "2016-01-10")- # does not move backwards either because its parent did not move- expect_dates(wp_suc_child, "2016-01-11", "2016-01-15")+ # wp_suc_parent moves backwards as well because it follows its child dates (wp_suc)+ expect_dates(wp_suc_parent, "2016-01-06", "2016-01-10")# Switching back to manual scheduling but this time backward will lead to the work package# and all work packages that are dependent to be rescheduled again.combined_field.activate!(expect_open: false)combined_field.expect_active!- combined_field.toggle_scheduling_mode+ combined_field.toggle_scheduling_mode # toggle to manual mode# The calendar needs some time to get initialized.sleep 2@@ -212,21 +228,24 @@ RSpec.describe "scheduling mode", :js doexpect_dates(wp, "2015-12-20", "2015-12-31")expect(wp.schedule_manually).to be_truthy- # is not moved because it is a child+ # child is not moved because it dates depend on its indirect predecessor,+ # wp_pred, rather than on its parent, wp.expect_dates(wp_child, "2016-01-01", "2016-01-05")- # The start date is moved forward because its child was moved- # but the due date remains unchanged as its grandchild stays put.+ # wp_parent start date is moved backwards because its child (wp) was moved+ # backwards but the due date remains unchanged as its grandchild (wp_child)+ # stays put.expect_dates(wp_parent, "2015-12-20", "2016-01-05")- # does not move backwards, as it just increases the gap between wp and wp_suc- expect_dates(wp_suc, "2016-01-11", "2016-01-15")+ # wp_suc_child moves backwards to start as soon as possible after its+ # indirect predecessor (wp)+ expect_dates(wp_suc_child, "2016-01-01", "2016-01-05")- # does not move backwards either- expect_dates(wp_suc_parent, "2016-01-11", "2016-01-15")+ # wp_suc moves backwards to follow its child dates (wp_suc_child)+ expect_dates(wp_suc, "2016-01-01", "2016-01-05")- # does not move backwards either because its parent did not move- expect_dates(wp_suc_child, "2016-01-11", "2016-01-15")+ # wp_suc_parent moves backwards to follow its child dates (wp_suc)+ expect_dates(wp_suc_parent, "2016-01-01", "2016-01-05")# Switching back to automatic scheduling will lead to the work package# and all work packages that are dependent to be rescheduled again to@@ -238,24 +257,24 @@ RSpec.describe "scheduling mode", :js dowork_packages_page.expect_and_dismiss_toaster message: "Successful update."- # Moved backwards again as the child determines the dates again+ # child Had not been moved in the first place+ expect_dates(wp_child, "2016-01-01", "2016-01-05")++ # wp Moved forward again as the child determines the dates againexpect_dates(wp, "2016-01-01", "2016-01-05")expect(wp.schedule_manually).to be_falsey- # Had not been moved in the first place- expect_dates(wp_child, "2016-01-01", "2016-01-05")-- # As the child now again takes up the same time interval as the grandchild,- # the interval is shortened again.+ # As the child (wp) now again takes up the same time interval as the+ # grandchild (wp_child), the interval is shortened again.expect_dates(wp_parent, "2016-01-01", "2016-01-05")- # does not move- expect_dates(wp_suc, "2016-01-11", "2016-01-15")+ # wp_suc_child moves forward to start right after its indirect predecessor (wp)+ expect_dates(wp_suc_child, "2016-01-06", "2016-01-10")- # does not move either- expect_dates(wp_suc_parent, "2016-01-11", "2016-01-15")+ # wp_suc moves forwards to follow its child dates (wp_suc_child)+ expect_dates(wp_suc, "2016-01-06", "2016-01-10")- # does not move either because its parent did not move- expect_dates(wp_suc_child, "2016-01-11", "2016-01-15")+ # wp_suc_parent moves forwards to follow its child dates (wp_suc)+ expect_dates(wp_suc_parent, "2016-01-06", "2016-01-10")endenddiff --git a/spec/support/pages/work_packages/abstract_work_package.rb b/spec/support/pages/work_packages/abstract_work_package.rbindex bbf7f5e15df..bc31e362b1d 100644--- a/spec/support/pages/work_packages/abstract_work_package.rb+++ b/spec/support/pages/work_packages/abstract_work_package.rb@@ -45,6 +45,10 @@ module Pagesis_a?(AbstractWorkPackageCreate)end+ def visit_query(query)+ visit("#{path}?query_id=#{query.id}")+ end+def visit_tab!(tab)visit path(tab)end