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
Wait before saving budget specs
Dombi Attilaadee4051a3ee
diff --git a/modules/budgets/spec/features/budgets/update_budget_spec.rb b/modules/budgets/spec/features/budgets/update_budget_spec.rbindex 0fc84dff003..11ac0e5e4b8 100644--- a/modules/budgets/spec/features/budgets/update_budget_spec.rb+++ b/modules/budgets/spec/features/budgets/update_budget_spec.rb@@ -58,6 +58,7 @@ RSpec.describe 'updating a budget', :js dobudget_page.add_unit_costs! 3, comment: 'Stimpak'budget_page.add_labor_costs! 5, user_name: user.name, comment: 'treatment'+ sleep 1 # Wait for the cost fields to be calculated.click_on 'Submit'expect(budget_page).to have_content('Successful update')@@ -111,13 +112,11 @@ RSpec.describe 'updating a budget', :js dobudget_page.edit_unit_costs! material_budget_item.id,units: 5,- comment: 'updated num stimpaks',- fill_options: { clear: :backspace }+ comment: 'updated num stimpaks'budget_page.edit_labor_costs! labor_budget_item.id,hours: 3,user_name: user.name,- comment: 'updated treatment duration',- fill_options: { clear: :backspace }+ comment: 'updated treatment duration'# Test for updated planned costs (Regression #31247)budget_page.expect_planned_costs! type: :material, row: 1, expected: '250.00 EUR'diff --git a/modules/budgets/spec/support/pages/budget_form.rb b/modules/budgets/spec/support/pages/budget_form.rbindex 411b02a0759..d2ba6476a1e 100644--- a/modules/budgets/spec/support/pages/budget_form.rb+++ b/modules/budgets/spec/support/pages/budget_form.rb@@ -54,10 +54,12 @@ module Pages# Adds planned unit costs with the default cost type.## @param type [String] Either 'existing' (default) or 'new'- def edit_unit_costs!(id, units: nil, comment: nil, type: :existing, fill_options: {})+ def edit_unit_costs!(id, units: nil, comment: nil, type: :existing)prefix = "#{unit_cost_attr_id(type)}_#{id}"- fill_in("#{prefix}_units", with: units, fill_options:) if units.present?- fill_in("#{prefix}_comments", with: comment, fill_options:) if comment.present?+ options = { fill_options: { clear: :backspace } }++ fill_in("#{prefix}_units", with: units, **options) if units.present?+ fill_in("#{prefix}_comments", with: comment, **options) if comment.present?enddef open_edit_planned_costs!(id, type:)@@ -90,12 +92,13 @@ module Pages# Adds planned labor costs with the default cost type.## @param type [String] Either 'existing' (default) or 'new'- def edit_labor_costs!(id, hours: nil, user_name: nil, comment: nil, type: 'existing', fill_options: {})+ def edit_labor_costs!(id, hours: nil, user_name: nil, comment: nil, type: 'existing')prefix = "#{labor_cost_attr_id(type)}_#{id}"+ options = { fill_options: { clear: :backspace } }- fill_in("#{prefix}_hours", with: hours, fill_options:) if hours.present?+ fill_in("#{prefix}_hours", with: hours, **options) if hours.present?select user_name, from: "#{prefix}_user_id" if user_name.present?- fill_in("#{prefix}_comments", with: comment, fill_options:) if comment.present?+ fill_in("#{prefix}_comments", with: comment, **options) if comment.present?enddef add_unit_costs_row!@@ -113,7 +116,7 @@ module Pagesdef expect_planned_costs!(type:, row:, expected:)raise "Unknown type: #{type}, allowed: labor, material" unless %i[labor material].include? type.to_sym- retry_block(args: { tries: 3, base_interval: 1 }) do+ retry_block(args: { tries: 3, base_interval: 5 }) docontainer = page.all("##{type}_budget_items_fieldset td.currency.budget-table--fields")[row - 1]actual = container.textraise "Expected planned costs #{expected}, got #{actual}" unless expected == actual