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

Get tests running by waiting for the controller to be loaded before starting to change things. Further some selectors have been fixed

Henriette Darge19dacbae6b74
diff --git a/app/components/work_packages/date_picker/dialog_content_component.html.erb b/app/components/work_packages/date_picker/dialog_content_component.html.erb
index 07abe2992cd..a847b3656ad 100644
--- a/app/components/work_packages/date_picker/dialog_content_component.html.erb
+++ b/app/components/work_packages/date_picker/dialog_content_component.html.erb
@@ -55,13 +55,15 @@
collection.with_component(Primer::Alpha::Dialog::Footer.new) do
component_collection do |footer|
- footer.with_component(Primer::ButtonComponent.new(data: { action: "work-packages--date-picker--preview#cancel" })) do
+ footer.with_component(Primer::ButtonComponent.new(data: { action: "work-packages--date-picker--preview#cancel" },
+ test_selector: "op-datepicker-modal--action")) do
I18n.t("button_cancel")
end
footer.with_component(Primer::ButtonComponent.new(scheme: :primary,
type: :submit,
form: DIALOG_FORM_ID,
+ test_selector: "op-datepicker-modal--action",
disabled: !schedulable?)) do
I18n.t("button_save")
end
diff --git a/spec/support/components/datepicker/datepicker.rb b/spec/support/components/datepicker/datepicker.rb
index 01ef8d1f311..73de18bbcc5 100644
--- a/spec/support/components/datepicker/datepicker.rb
+++ b/spec/support/components/datepicker/datepicker.rb
@@ -45,10 +45,15 @@ module Components
def expect_visible
expect(container).to have_css(".flatpickr-calendar .flatpickr-current-month", wait: 10)
+
+ # For whatever reason, the stimulus controller in the WorkPackage Datepicker needs some time to be loaded.
+ # So please, do not remove this line.
+ wait_for_network_idle
end
def expect_not_visible
expect(container).to have_no_css(".flatpickr-calendar .flatpickr-current-month", wait: 10)
+ wait_for_network_idle
end
##
diff --git a/spec/support/components/datepicker/work_package_datepicker.rb b/spec/support/components/datepicker/work_package_datepicker.rb
index b54d31319c5..f04c1596244 100644
--- a/spec/support/components/datepicker/work_package_datepicker.rb
+++ b/spec/support/components/datepicker/work_package_datepicker.rb
@@ -20,28 +20,23 @@ module Components
##
# Expect duration
def expect_duration(value)
- value =
- if value.is_a?(Regexp)
- value
- elsif value.nil? || value == ""
- ""
- else
- I18n.t("js.units.day", count: value)
- end
+ if value.nil? || value == ""
+ value = ""
+ end
expect(container).to have_field("work_package[duration]", with: value, wait: 10)
end
def milestone_date_field
- container.find_field "date"
+ container.find_field "work_package[start_date]"
end
def start_date_field
- container.find_field "startDate"
+ container.find_field "work_package[start_date]"
end
def due_date_field
- container.find_field "endDate"
+ container.find_field "work_package[due_date]"
end
def focus_milestone_date
@@ -147,10 +142,6 @@ module Components
container.find_field "scheduling", visible: :all
end
- def ignore_non_working_days_input
- container.find_field "weekdays_only", visible: :all
- end
-
def expect_ignore_non_working_days_disabled
expect(container).to have_field("weekdays_only", disabled: true)
end