diff --git a/modules/costs/spec/features/timer_spec.rb b/modules/costs/spec/features/timer_spec.rb index 1f3045c48d04..52209da567a4 100644 --- a/modules/costs/spec/features/timer_spec.rb +++ b/modules/costs/spec/features/timer_spec.rb @@ -67,7 +67,7 @@ time_logging_modal.has_field_with_value "spentOn", Date.current.strftime time_logging_modal.has_field_with_value "hours", /(\d\.)?\d+/ - time_logging_modal.work_package_is_missing false + 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.subject) @@ -105,7 +105,7 @@ time_logging_modal.is_visible true time_logging_modal.has_field_with_value "spentOn", Date.current.strftime time_logging_modal.has_field_with_value "hours", /(\d\.)?\d+/ - time_logging_modal.work_package_is_missing false + 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.subject) @@ -170,7 +170,7 @@ time_logging_modal.is_visible true time_logging_modal.has_field_with_value "spentOn", Date.current.strftime time_logging_modal.has_field_with_value "hours", /(\d\.)?\d+/ - time_logging_modal.work_package_is_missing false + 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.subject) @@ -183,7 +183,7 @@ time_logging_modal.is_visible true time_logging_modal.has_field_with_value "spentOn", Date.current.strftime time_logging_modal.has_field_with_value "hours", /(\d\.)?\d+/ - time_logging_modal.work_package_is_missing false + 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.subject) diff --git a/modules/my_page/spec/features/my/time_entries_current_user_spec.rb b/modules/my_page/spec/features/my/time_entries_current_user_spec.rb index 61bf9925aac5..4b4ec4520053 100644 --- a/modules/my_page/spec/features/my/time_entries_current_user_spec.rb +++ b/modules/my_page/spec/features/my/time_entries_current_user_spec.rb @@ -193,7 +193,7 @@ time_logging_modal.is_visible true - time_logging_modal.work_package_is_missing true + time_logging_modal.activity_input_disabled_because_work_package_missing? true time_logging_modal.has_field_with_value "spentOn", (Date.current.beginning_of_week(:sunday) + 3.days).strftime @@ -210,7 +210,7 @@ time_logging_modal.update_work_package_field other_work_package.subject - time_logging_modal.work_package_is_missing false + time_logging_modal.activity_input_disabled_because_work_package_missing? false time_logging_modal.update_field "comment", "Comment for new entry" diff --git a/modules/reporting/spec/features/support/components/cost_reports_base_table.rb b/modules/reporting/spec/features/support/components/cost_reports_base_table.rb index e34585e4b11a..71a9c05cea2e 100644 --- a/modules/reporting/spec/features/support/components/cost_reports_base_table.rb +++ b/modules/reporting/spec/features/support/components/cost_reports_base_table.rb @@ -64,7 +64,7 @@ def edit_time_entry(row, hours:) time_logging_modal.is_visible true time_logging_modal.change_hours(hours) - # time_logging_modal.work_package_is_missing false + # time_logging_modal.activity_input_disabled_because_work_package_missing? false time_logging_modal.submit SeleniumHubWaiter.wait diff --git a/spec/features/support/components/time_logging_modal.rb b/spec/features/support/components/time_logging_modal.rb index 94d7aa70b4f2..c9b2833808c4 100644 --- a/spec/features/support/components/time_logging_modal.rb +++ b/spec/features/support/components/time_logging_modal.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -112,24 +114,13 @@ def perform_action(action) end end - def work_package_is_missing(missing) + def activity_input_disabled_because_work_package_missing?(missing) if missing - expect(page) - .to have_content(I18n.t("js.time_entry.work_package_required")) + expect(page).to have_field "input#time_entry_activity_id:disabled" + expect(page).to have_content(I18n.t("placeholder_activity_select_work_package_first")) else - expect(page) - .to have_no_content(I18n.t("js.time_entry.work_package_required")) - end - end - - def field_identifier(field_name) - case field_name - when "spent_on" - "wp-new-inline-edit--field-spentOn" - when "work_package" - "wp-new-inline-edit--field-workPackage" - when "user" - "wp-new-inline-edit--field-user" + expect(page).to have_field "input#time_entry_activity_id:enabled" + expect(page).to have_no_content(I18n.t("placeholder_activity_select_work_package_first")) end end diff --git a/spec/features/work_packages/table/context_menu/context_menu_shared_examples.rb b/spec/features/work_packages/table/context_menu/context_menu_shared_examples.rb index 60ad9ae7f9fe..3e37e7da0e6e 100644 --- a/spec/features/work_packages/table/context_menu/context_menu_shared_examples.rb +++ b/spec/features/work_packages/table/context_menu/context_menu_shared_examples.rb @@ -23,7 +23,7 @@ open_context_menu.call menu.choose("Log time") time_logging_modal.is_visible true - time_logging_modal.work_package_is_missing false + time_logging_modal.activity_input_disabled_because_work_package_missing? false time_logging_modal.perform_action "Cancel" # Open Move