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

Fix update budget specs.

Dombi Attila48b17e571549
diff --git a/modules/budgets/spec/features/budgets/update_budget_spec.rb b/modules/budgets/spec/features/budgets/update_budget_spec.rb
index 1260754d9b0..0fc84dff003 100644
--- a/modules/budgets/spec/features/budgets/update_budget_spec.rb
+++ b/modules/budgets/spec/features/budgets/update_budget_spec.rb
@@ -111,11 +111,13 @@ RSpec.describe 'updating a budget', :js do
budget_page.edit_unit_costs! material_budget_item.id,
units: 5,
- comment: 'updated num stimpaks'
+ comment: 'updated num stimpaks',
+ fill_options: { clear: :backspace }
budget_page.edit_labor_costs! labor_budget_item.id,
hours: 3,
user_name: user.name,
- comment: 'updated treatment duration'
+ comment: 'updated treatment duration',
+ fill_options: { clear: :backspace }
# 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.rb
index 6d58504710c..411b02a0759 100644
--- a/modules/budgets/spec/support/pages/budget_form.rb
+++ b/modules/budgets/spec/support/pages/budget_form.rb
@@ -54,11 +54,10 @@ 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, type: :existing, fill_options: {})
prefix = "#{unit_cost_attr_id(type)}_#{id}"
-
- fill_in "#{prefix}_units", with: units if units.present?
- fill_in "#{prefix}_comments", with: comment if comment.present?
+ fill_in("#{prefix}_units", with: units, fill_options:) if units.present?
+ fill_in("#{prefix}_comments", with: comment, fill_options:) if comment.present?
end
def open_edit_planned_costs!(id, type:)
@@ -91,12 +90,12 @@ 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, type: 'existing', fill_options: {})
prefix = "#{labor_cost_attr_id(type)}_#{id}"
- fill_in "#{prefix}_hours", with: hours if hours.present?
+ fill_in("#{prefix}_hours", with: hours, fill_options:) if hours.present?
select user_name, from: "#{prefix}_user_id" if user_name.present?
- fill_in "#{prefix}_comments", with: comment if comment.present?
+ fill_in("#{prefix}_comments", with: comment, fill_options:) if comment.present?
end
def add_unit_costs_row!
@@ -114,7 +113,7 @@ module Pages
def expect_planned_costs!(type:, row:, expected:)
raise "Unknown type: #{type}, allowed: labor, material" unless %i[labor material].include? type.to_sym
- retry_block do
+ retry_block(args: { tries: 3, base_interval: 1 }) do
container = page.all("##{type}_budget_items_fieldset td.currency.budget-table--fields")[row - 1]
actual = container.text
raise "Expected planned costs #{expected}, got #{actual}" unless expected == actual