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 tests for work package field in time entry dialog

Klaus Zanders84cc980ecd7c
diff --git a/modules/costs/spec/features/timer_spec.rb b/modules/costs/spec/features/timer_spec.rb
index 0165bfa407e..d3260ffda5e 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.has_field_with_value "hours", /(\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.subject)
+ time_logging_modal.expect_work_package(work_package_a)
time_logging_modal.submit
time_logging_modal.is_visible false
@@ -106,7 +106,7 @@ RSpec.describe "Work Package timer", :js, :selenium do
time_logging_modal.has_field_with_value "hours", /(\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.subject)
+ time_logging_modal.expect_work_package(work_package_a)
time_logging_modal.submit
@@ -171,7 +171,7 @@ RSpec.describe "Work Package timer", :js, :selenium do
time_logging_modal.has_field_with_value "hours", /(\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.subject)
+ time_logging_modal.expect_work_package(work_package_a)
time_logging_modal.submit
time_logging_modal.is_visible false
@@ -183,7 +183,7 @@ RSpec.describe "Work Package timer", :js, :selenium do
time_logging_modal.has_field_with_value "hours", /(\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.subject)
+ time_logging_modal.expect_work_package(work_package_a)
time_logging_modal.submit
time_logging_modal.is_visible false
diff --git a/modules/dashboards/spec/features/time_entries_spec.rb b/modules/dashboards/spec/features/time_entries_spec.rb
index fd16372ef43..9974b00bead 100644
--- a/modules/dashboards/spec/features/time_entries_spec.rb
+++ b/modules/dashboards/spec/features/time_entries_spec.rb
@@ -122,7 +122,7 @@ RSpec.describe "Time entries widget on dashboard", :js, :with_cuprite do
time_logging_modal.is_visible true
- time_logging_modal.expect_work_package work_package.subject
+ time_logging_modal.expect_work_package work_package
time_logging_modal.update_field "hours", 4
diff --git a/spec/features/support/components/time_logging_modal.rb b/spec/features/support/components/time_logging_modal.rb
index 75c89faad08..970cdc2f5bd 100644
--- a/spec/features/support/components/time_logging_modal.rb
+++ b/spec/features/support/components/time_logging_modal.rb
@@ -75,15 +75,16 @@ module Components
end
end
- def expect_work_package(subject)
+ def expect_work_package(work_package)
+ title = "#{work_package.type.name} ##{work_package.id} #{work_package.subject}"
within modal_container do
- expect(page).to have_css("opce-user-autocompleter > .ng-value", text: subject, wait: 10)
+ expect(page).to have_css("opce-autocompleter[data-resource*=work_packages] > .ng-value", text: title, wait: 10)
end
end
def expect_user(user)
within modal_container do
- expect(page).to have_css(".ng-value", text: user.name, wait: 10)
+ expect(page).to have_css("opce-user-autocompleter > .ng-value", text: user.name, wait: 10)
end
end