Skip to content

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

Add edit budget page calculated cost expectations.

Dombi Attila8824a6d312de
diff --git a/modules/budgets/spec/features/budgets/update_budget_spec.rb b/modules/budgets/spec/features/budgets/update_budget_spec.rb
index 11ac0e5e4b8..2d5168ae376 100644
--- a/modules/budgets/spec/features/budgets/update_budget_spec.rb
+++ b/modules/budgets/spec/features/budgets/update_budget_spec.rb
@@ -55,10 +55,9 @@ RSpec.describe 'updating a budget', :js do
budget_page.visit!
click_on 'Update'
- budget_page.add_unit_costs! 3, comment: 'Stimpak'
- budget_page.add_labor_costs! 5, user_name: user.name, comment: 'treatment'
+ budget_page.add_unit_costs! 3, comment: 'Stimpak', expected_costs: '150.00 EUR'
+ budget_page.add_labor_costs! 5, user_name: user.name, comment: 'treatment', expected_costs: '125.00 EUR'
- sleep 1 # Wait for the cost fields to be calculated.
click_on 'Submit'
expect(budget_page).to have_content('Successful update')
diff --git a/modules/budgets/spec/support/pages/budget_form.rb b/modules/budgets/spec/support/pages/budget_form.rb
index d2ba6476a1e..d366675d989 100644
--- a/modules/budgets/spec/support/pages/budget_form.rb
+++ b/modules/budgets/spec/support/pages/budget_form.rb
@@ -34,18 +34,19 @@ module Pages
module BudgetForm
##
# Adds planned unit costs with the default cost type.
- def add_unit_costs!(num_units, comment: nil)
- edit_unit_costs! unit_rows, units: num_units, comment:, type: 'new'
+ def add_unit_costs!(num_units, comment: nil, expected_costs: nil)
+ edit_unit_costs! unit_rows, units: num_units, comment:, expected_costs:, type: 'new'
add_unit_costs_row!
end
##
# Adds planned labor costs with the default cost type.
- def add_labor_costs!(num_hours, user_name:, comment: nil)
+ def add_labor_costs!(num_hours, user_name:, comment: nil, expected_costs: nil)
edit_labor_costs!(labor_rows,
hours: num_hours,
user_name:,
comment:,
+ expected_costs:,
type: 'new')
add_labor_costs_row!
end
@@ -54,12 +55,13 @@ 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)
+ def edit_unit_costs!(id, units: nil, comment: nil, expected_costs: nil, type: :existing)
prefix = "#{unit_cost_attr_id(type)}_#{id}"
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?
+ expect(page).to have_css("##{prefix}_costs", text: expected_costs) if expected_costs.present?
end
def open_edit_planned_costs!(id, type:)
@@ -92,13 +94,15 @@ 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')
+ def edit_labor_costs!(id, hours: nil, user_name: nil, comment: nil, expected_costs: nil, type: 'existing')
prefix = "#{labor_cost_attr_id(type)}_#{id}"
options = { fill_options: { clear: :backspace } }
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, **options) if comment.present?
+
+ expect(page).to have_css("##{prefix}_costs", text: expected_costs) if expected_costs.present?
end
def add_unit_costs_row!