From 18ae3b1ca63db76a84a6a22b4839b26ec9069f70 Mon Sep 17 00:00:00 2001 From: Mir Bhatia Date: Wed, 1 Apr 2026 17:08:54 +0200 Subject: [PATCH] Update specs to use new field name --- .../spec/features/time_entry_dialog_spec.rb | 46 +++++++++---------- modules/costs/spec/features/timer_spec.rb | 8 ++-- .../support/components/time_logging_modal.rb | 2 +- .../display_fields/spent_time_display_spec.rb | 2 +- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/modules/costs/spec/features/time_entry_dialog_spec.rb b/modules/costs/spec/features/time_entry_dialog_spec.rb index 20e816c096b..cf8a9363ed8 100644 --- a/modules/costs/spec/features/time_entry_dialog_spec.rb +++ b/modules/costs/spec/features/time_entry_dialog_spec.rb @@ -65,7 +65,7 @@ RSpec.describe "time entry dialog", :js do it "does not show fields to track start and end times" do time_logging_modal.shows_field("start_time", false) time_logging_modal.shows_field("end_time", false) - time_logging_modal.shows_field("hours", true) + time_logging_modal.shows_field("hours_display", true) end end @@ -75,7 +75,7 @@ RSpec.describe "time entry dialog", :js do time_logging_modal.requires_field("start_time", required: false) time_logging_modal.shows_field("end_time", true) time_logging_modal.requires_field("end_time", required: false) - time_logging_modal.shows_field("hours", true) + time_logging_modal.shows_field("hours_display", true) end end @@ -90,7 +90,7 @@ RSpec.describe "time entry dialog", :js do time_logging_modal.requires_field("start_time") time_logging_modal.shows_field("end_time", true) time_logging_modal.requires_field("end_time") - time_logging_modal.shows_field("hours", true) + time_logging_modal.shows_field("hours_display", true) end end end @@ -139,40 +139,40 @@ RSpec.describe "time entry dialog", :js do end it "normalizes the hour input" do - time_logging_modal.update_field("hours", "6h 45min") - time_logging_modal.has_field_with_value("hours", "6.75h") + time_logging_modal.update_field("hours_display", "6h 45min") + time_logging_modal.has_field_with_value("hours_display", "6.75h") - time_logging_modal.update_field("hours", "4:15") - time_logging_modal.has_field_with_value("hours", "4.25h") + time_logging_modal.update_field("hours_display", "4:15") + time_logging_modal.has_field_with_value("hours_display", "4.25h") - time_logging_modal.update_field("hours", "1m 2w 3d 4h 5m") - time_logging_modal.has_field_with_value("hours", "412.1h") + time_logging_modal.update_field("hours_display", "1m 2w 3d 4h 5m") + time_logging_modal.has_field_with_value("hours_display", "412.1h") - time_logging_modal.update_field("hours", "1.5") - time_logging_modal.has_field_with_value("hours", "1.5h") + time_logging_modal.update_field("hours_display", "1.5") + time_logging_modal.has_field_with_value("hours_display", "1.5h") - time_logging_modal.update_field("hours", "3,7") - time_logging_modal.has_field_with_value("hours", "3.7h") + time_logging_modal.update_field("hours_display", "3,7") + time_logging_modal.has_field_with_value("hours_display", "3.7h") end it "calculates the hours based on the start and end time" do time_logging_modal.update_time_field("start_time", hour: 10, minute: 0) time_logging_modal.update_time_field("end_time", hour: 12, minute: 30) - time_logging_modal.has_field_with_value("hours", "2.5h") + time_logging_modal.has_field_with_value("hours_display", "2.5h") end it "correctly handles when end_time < start_time (multiple days)" do time_logging_modal.update_time_field("start_time", hour: 10, minute: 0) time_logging_modal.update_time_field("end_time", hour: 9, minute: 45) - time_logging_modal.has_field_with_value("hours", "23.75h") + time_logging_modal.has_field_with_value("hours_display", "23.75h") time_logging_modal.shows_caption("+1 day") end it "correctly handles when hours > 24" do time_logging_modal.update_time_field("start_time", hour: 10, minute: 0) - time_logging_modal.update_field("hours", "50h") + time_logging_modal.update_field("hours_display", "50h") time_logging_modal.has_field_with_value("end_time", "12:00") time_logging_modal.shows_caption("+2 days") @@ -180,14 +180,14 @@ RSpec.describe "time entry dialog", :js do it "calculates the end time based on start time and hours" do time_logging_modal.update_time_field("start_time", hour: 10, minute: 0) - time_logging_modal.update_field("hours", "3h") + time_logging_modal.update_field("hours_display", "3h") time_logging_modal.has_field_with_value("end_time", "13:00") end it "calculates the start time based on end time and hours" do time_logging_modal.update_time_field("end_time", hour: 10, minute: 0) - time_logging_modal.update_field("hours", "3h") + time_logging_modal.update_field("hours_display", "3h") time_logging_modal.has_field_with_value("start_time", "07:00") end @@ -196,9 +196,9 @@ RSpec.describe "time entry dialog", :js do time_logging_modal.update_time_field("start_time", hour: 10, minute: 0) time_logging_modal.update_time_field("end_time", hour: 12, minute: 30) - time_logging_modal.has_field_with_value("hours", "2.5h") + time_logging_modal.has_field_with_value("hours_display", "2.5h") - time_logging_modal.update_field("hours", "6h") + time_logging_modal.update_field("hours_display", "6h") time_logging_modal.has_field_with_value("end_time", "16:00") end @@ -207,12 +207,12 @@ RSpec.describe "time entry dialog", :js do time_logging_modal.update_time_field("start_time", hour: 10, minute: 0) time_logging_modal.update_time_field("end_time", hour: 12, minute: 30) - time_logging_modal.has_field_with_value("hours", "2.5h") + time_logging_modal.has_field_with_value("hours_display", "2.5h") time_logging_modal.update_time_field("start_time", hour: 12, minute: 0) time_logging_modal.has_field_with_value("end_time", "14:30") - time_logging_modal.has_field_with_value("hours", "2.5h") + time_logging_modal.has_field_with_value("hours_display", "2.5h") end end @@ -230,7 +230,7 @@ RSpec.describe "time entry dialog", :js do find("#action-show-more-dropdown-menu .button").click find(".menu-item", text: "Log time").click time_logging_modal.is_visible(true) - time_logging_modal.update_field("hours", "2") + time_logging_modal.update_field("hours_display", "2") end it "I can create a time entry with a custom field value including validation" do diff --git a/modules/costs/spec/features/timer_spec.rb b/modules/costs/spec/features/timer_spec.rb index 5235eda5c55..6b860f5b84d 100644 --- a/modules/costs/spec/features/timer_spec.rb +++ b/modules/costs/spec/features/timer_spec.rb @@ -69,7 +69,7 @@ RSpec.describe "Work Package timer", :js, :selenium do time_logging_modal.is_visible true time_logging_modal.has_field_with_value "spent_on", Date.current.strftime - time_logging_modal.has_field_with_value "hours", /(\d\.)?\d+/ + time_logging_modal.has_field_with_value "hours_display", /(\d\.)?\d+/ time_logging_modal.activity_input_disabled_because_work_package_missing? false # wait for available_work_packages query to finish before saving time_logging_modal.expect_work_package(work_package_a) @@ -107,7 +107,7 @@ RSpec.describe "Work Package timer", :js, :selenium do page.within(".spot-modal") { click_on "Stop current timer" } time_logging_modal.is_visible true time_logging_modal.has_field_with_value "spent_on", Date.current.strftime - time_logging_modal.has_field_with_value "hours", /(\d\.)?\d+/ + time_logging_modal.has_field_with_value "hours_display", /(\d\.)?\d+/ time_logging_modal.activity_input_disabled_because_work_package_missing? false # wait for available_work_packages query to finish before saving time_logging_modal.expect_work_package(work_package_a) @@ -173,7 +173,7 @@ RSpec.describe "Work Package timer", :js, :selenium do time_logging_modal.is_visible true time_logging_modal.has_field_with_value "spent_on", Date.current.strftime - time_logging_modal.has_field_with_value "hours", /(\d\.)?\d+/ + time_logging_modal.has_field_with_value "hours_display", /(\d\.)?\d+/ time_logging_modal.activity_input_disabled_because_work_package_missing? false # wait for available_work_packages query to finish before saving time_logging_modal.expect_work_package(work_package_a) @@ -185,7 +185,7 @@ RSpec.describe "Work Package timer", :js, :selenium do timer_button.stop time_logging_modal.is_visible true time_logging_modal.has_field_with_value "spent_on", Date.current.strftime - time_logging_modal.has_field_with_value "hours", /(\d\.)?\d+/ + time_logging_modal.has_field_with_value "hours_display", /(\d\.)?\d+/ time_logging_modal.activity_input_disabled_because_work_package_missing? false # wait for available_work_packages query to finish before saving time_logging_modal.expect_work_package(work_package_a) diff --git a/spec/features/support/components/time_logging_modal.rb b/spec/features/support/components/time_logging_modal.rb index 943bb43e5db..dcd5fb7bf34 100644 --- a/spec/features/support/components/time_logging_modal.rb +++ b/spec/features/support/components/time_logging_modal.rb @@ -47,7 +47,7 @@ module Components def change_hours(value) within modal_container do - fill_in "time_entry_hours", with: value + fill_in "time_entry_hours_display", with: value end end diff --git a/spec/features/work_packages/display_fields/spent_time_display_spec.rb b/spec/features/work_packages/display_fields/spent_time_display_spec.rb index 781ea199c2f..21365f68394 100644 --- a/spec/features/work_packages/display_fields/spent_time_display_spec.rb +++ b/spec/features/work_packages/display_fields/spent_time_display_spec.rb @@ -55,7 +55,7 @@ RSpec.describe "Logging time within the work package view", :js, :with_cuprite d # Update the fields time_logging_modal.update_field "activity_id", activity.name time_logging_modal.update_field "spent_on", date.strftime("%Y-%m-%d") - time_logging_modal.update_field "hours", hours.to_s + time_logging_modal.update_field "hours_display", hours.to_s if log_for_user time_logging_modal.update_field "user_id", log_for_user.name