[31247] Fixed updating planned costs due to missing fixed_date

https://community.openproject.com/wp/31247
pull/7750/head
Oliver Günther 5 years ago
parent 7923cc984d
commit a853fe32ae
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 2
      modules/costs/frontend/module/augment/cost-budget-subform.augment.service.ts
  2. 7
      modules/costs/spec/features/budgets/update_budget_spec.rb
  3. 10
      modules/costs/spec/support/pages/budget_form.rb

@ -97,7 +97,7 @@ export class CostBudgetSubformAugmentService {
private buildRefreshRequest(row:JQuery, row_identifier:string) { private buildRefreshRequest(row:JQuery, row_identifier:string) {
let request:any = { let request:any = {
element_id: row_identifier, element_id: row_identifier,
fixed_date: row.find('#cost_object_fixed_date').val() fixed_date: jQuery('#cost_object_fixed_date').val()
}; };
// Augment common values with specific values for this type // Augment common values with specific values for this type

@ -97,12 +97,19 @@ describe 'updating a budget', type: :feature, js: true do
budget_page.visit! budget_page.visit!
click_on 'Update' click_on 'Update'
budget_page.expect_planned_costs! type: :material, row: 1, expected: '150.00 EUR'
budget_page.expect_planned_costs! type: :labor, row: 1, expected: '125.00 EUR'
budget_page.edit_unit_costs! material_budget_item.id, units: 5, budget_page.edit_unit_costs! material_budget_item.id, units: 5,
comment: 'updated num stimpaks' comment: 'updated num stimpaks'
budget_page.edit_labor_costs! labor_budget_item.id, hours: 3, budget_page.edit_labor_costs! labor_budget_item.id, hours: 3,
user_name: user.name, user_name: user.name,
comment: 'updated treatment duration' comment: 'updated treatment duration'
# Test for updated planned costs (Regression #31247)
budget_page.expect_planned_costs! type: :material, row: 1, expected: '250.00 EUR'
budget_page.expect_planned_costs! type: :labor, row: 1, expected: '75.00 EUR'
click_on 'Submit' click_on 'Submit'
expect(budget_page).to have_content('Successful update') expect(budget_page).to have_content('Successful update')

@ -100,6 +100,16 @@ module Pages
@labor_rows = labor_rows + 1 @labor_rows = labor_rows + 1
end end
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
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
end
end
def unit_costs_at(num_row) def unit_costs_at(num_row)
unit_costs_container.all('tbody td.currency')[num_row - 1] unit_costs_container.all('tbody td.currency')[num_row - 1]
end end

Loading…
Cancel
Save