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
update overview page feature spec
Ivan Kuchin45b436ac9164
diff --git a/spec/features/projects/life_cycle/overview_page/dialog/update_spec.rb b/spec/features/projects/life_cycle/overview_page/dialog/update_spec.rbindex e50c89747af..7ccc55c7dab 100644--- a/spec/features/projects/life_cycle/overview_page/dialog/update_spec.rb+++ b/spec/features/projects/life_cycle/overview_page/dialog/update_spec.rb@@ -46,6 +46,14 @@ RSpec.describe "Edit project phases on project overview page", :js, with_flag: {overview_page.visit_pageend+ def formatted_date_range(life_cycle)+ if life_cycle.range_set?+ [life_cycle.start_date, life_cycle.finish_date].map { I18n.l(it) }.join("\n-\n")+ else+ "-"+ end+ end+describe "with the dialog open" docontext "when all LifeCycleSteps are blank" dobefore do@@ -71,22 +79,23 @@ RSpec.describe "Edit project phases on project overview page", :js, with_flag: {context "when all LifeCycleSteps have a value" doit "shows all the Project::Phases and updates them correctly" do- # Set a value for life_cycle_initiating- dialog = overview_page.open_edit_dialog_for_life_cycle(life_cycle_initiating)+ life_cycle_initiating_was = life_cycle_initiating.dup+ life_cycle_planning_was = life_cycle_planning.dup+ life_cycle_executing_was = life_cycle_executing.dup+ life_cycle_closing_was = life_cycle_closing.dup- expect_angular_frontend_initialized+ # Set a value for life_cycle_initiating+ dialog = overview_page.open_edit_dialog_for_life_cycle(life_cycle_initiating, wait_angular: true)dialog.expect_input_for(life_cycle_initiating)- initiating_dates = [start_date - 1.week, start_date]-retry_block do# Retrying due to a race condition between filling the input vs submitting the form preview.original_dates = [life_cycle_initiating.start_date, life_cycle_initiating.finish_date]dialog.set_date_for(values: original_dates)page.driver.clear_network_traffic- dialog.set_date_for(values: initiating_dates)+ dialog.set_date_for(values: [start_date - 1.week, start_date])dialog.expect_caption(text: "Duration: 8 working days")# Ensure that only 1 ajax request is triggered after setting the date range.@@ -98,13 +107,16 @@ RSpec.describe "Edit project phases on project overview page", :js, with_flag: {dialog.expect_closed# Sidebar is refreshed with the updated values- overview_page.within_life_cycle_container(life_cycle_initiating) do- expect(page).to have_text initiating_dates.map { I18n.l(it) }.join("\n-\n")+ project_life_cycles.each do |life_cycle|+ life_cycle.reload++ overview_page.within_life_cycle_container(life_cycle) do+ expect(page).to have_text formatted_date_range(life_cycle)+ endend# Clear the value of life_cycle_planning- dialog = overview_page.open_edit_dialog_for_life_cycle(life_cycle_planning)- expect_angular_frontend_initialized+ dialog = overview_page.open_edit_dialog_for_life_cycle(life_cycle_planning, wait_angular: true)dialog.expect_input_for(life_cycle_planning)dialog.clear_date@@ -114,25 +126,18 @@ RSpec.describe "Edit project phases on project overview page", :js, with_flag: {dialog.expect_closed# Sidebar is refreshed with the updated values- ready_for_planning_dates = [- life_cycle_planning.start_date,- life_cycle_planning.finish_date- ].map { I18n.l(it) }.join("\n-\n")+ project_life_cycles.each do |life_cycle|+ life_cycle.reload- overview_page.within_life_cycle_container(life_cycle_planning) do- expect(page).to have_no_text ready_for_planning_dates+ overview_page.within_life_cycle_container(life_cycle) do+ expect(page).to have_text formatted_date_range(life_cycle)+ endendactivity_page.visit!activity_page.show_details- life_cycle_initiating_was = life_cycle_initiating.dup- life_cycle_initiating.reload-- life_cycle_planning_was = life_cycle_planning.dup- life_cycle_planning.reload-activity_page.within_journal(number: 1) doactivity_page.expect_activity("Initiating changed from " \"#{I18n.l life_cycle_initiating_was.start_date} - " \@@ -143,6 +148,18 @@ RSpec.describe "Edit project phases on project overview page", :js, with_flag: {activity_page.expect_activity("Planning date deleted " \"#{I18n.l life_cycle_planning_was.start_date} - " \"#{I18n.l life_cycle_planning_was.finish_date}")++ activity_page.expect_activity("Executing changed from " \+ "#{I18n.l life_cycle_executing_was.start_date} - " \+ "#{I18n.l life_cycle_executing_was.finish_date} to " \+ "#{I18n.l life_cycle_executing.start_date} - " \+ "#{I18n.l life_cycle_executing.finish_date}")++ activity_page.expect_activity("Closing changed from " \+ "#{I18n.l life_cycle_closing_was.start_date} - " \+ "#{I18n.l life_cycle_closing_was.finish_date} to " \+ "#{I18n.l life_cycle_closing.start_date} - " \+ "#{I18n.l life_cycle_closing.finish_date}")endendend@@ -156,9 +173,7 @@ RSpec.describe "Edit project phases on project overview page", :js, with_flag: {endit "allows saving and closing the dialog without the custom field validation to interfere" do- dialog = overview_page.open_edit_dialog_for_life_cycle(life_cycle_initiating)-- expect_angular_frontend_initialized+ dialog = overview_page.open_edit_dialog_for_life_cycle(life_cycle_initiating, wait_angular: true)# Saving the dialog is successfuldialog.submitdiff --git a/spec/features/projects/life_cycle/overview_page/shared_context.rb b/spec/features/projects/life_cycle/overview_page/shared_context.rbindex 6e47af778bb..8054a6fd7e3 100644--- a/spec/features/projects/life_cycle/overview_page/shared_context.rb+++ b/spec/features/projects/life_cycle/overview_page/shared_context.rb@@ -56,22 +56,22 @@ RSpec.shared_context "with seeded projects and phases" dolet(:life_cycle_planning) docreate :project_phase,definition: life_cycle_planning_definition,- start_date: start_date + 4.days,- finish_date: start_date + 7.days,+ start_date: start_date + 2.days,+ finish_date: start_date + 5.days,project:endlet(:life_cycle_executing) docreate :project_phase,definition: life_cycle_executing_definition,- start_date: start_date + 9.days,- finish_date: start_date + 10.days,+ start_date: start_date + 6.days,+ finish_date: start_date + 7.days,project:endlet(:life_cycle_closing) docreate :project_phase,definition: life_cycle_closing_definition,- start_date: start_date + 14.days,- finish_date: start_date + 18.days,+ start_date: start_date + 8.days,+ finish_date: start_date + 12.days,project:enddiff --git a/spec/support/pages/projects/show.rb b/spec/support/pages/projects/show.rbindex 1d52305260f..fd88538208c 100644--- a/spec/support/pages/projects/show.rb+++ b/spec/support/pages/projects/show.rb@@ -85,12 +85,16 @@ module Pageswait_for_size_animation_completion("[data-test-selector='async-dialog-content']")end- def open_edit_dialog_for_life_cycle(life_cycle)+ def open_edit_dialog_for_life_cycle(life_cycle, wait_angular: false)within_life_cycles_sidebar dopage.find("[data-test-selector='project-life-cycle-edit-button-#{life_cycle.id}']").clickend- Components::Projects::ProjectLifeCycles::EditDialog.new.tap(&:expect_open)+ Components::Projects::ProjectLifeCycles::EditDialog.new.tap do |dialog|+ dialog.expect_open++ expect_angular_frontend_initialized if wait_angular+ endenddef within_life_cycles_sidebar(&)