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

Adapt scenario 7 to actually click the datepicker

Oliver Günthere375a5311e9e
diff --git a/spec/features/work_packages/datepicker/datepicker_logic_spec.rb b/spec/features/work_packages/datepicker/datepicker_logic_spec.rb
index a974e014648..23cd226b49f 100644
--- a/spec/features/work_packages/datepicker/datepicker_logic_spec.rb
+++ b/spec/features/work_packages/datepicker/datepicker_logic_spec.rb
@@ -230,7 +230,7 @@ describe 'Datepicker modal logic test cases (WP #43539)',
end
end
- describe 'when all values set, changing start date (test case 7)' do
+ describe 'when all values set, changing start date in calendar (test case 7)' do
let(:current_attributes) do
{
start_date: Date.parse('2021-02-08'),
@@ -244,7 +244,9 @@ describe 'Datepicker modal logic test cases (WP #43539)',
datepicker.expect_due_date '2021-02-11'
datepicker.expect_duration 4
- datepicker.set_start_date '2021-02-09'
+ # With start date focused, change date in datepicker
+ datepicker.focus_start_date
+ datepicker.set_date '2021-02-09'
datepicker.expect_start_date '2021-02-09'
datepicker.expect_due_date '2021-02-11'
diff --git a/spec/support/components/datepicker/work_package_datepicker.rb b/spec/support/components/datepicker/work_package_datepicker.rb
index aaa14ace7b4..5ba75611ec9 100644
--- a/spec/support/components/datepicker/work_package_datepicker.rb
+++ b/spec/support/components/datepicker/work_package_datepicker.rb
@@ -67,25 +67,37 @@ module Components
container.find_field 'duration'
end
+ def focus_start_date
+ start_date_field.click
+ end
+
+ def focus_due_date
+ due_date_field.click
+ end
+
+ def focus_duration
+ due_date_field.click
+ end
+
def set_duration(value)
- duration_field.click
- duration_field.set value
+ focus_duration
+ fill_in 'duration', with: value, fill_options: { clear: :backspace }
# Focus a different field
start_date_field.click
end
def set_start_date(value)
- start_date_field.click
- start_date_field.set value
+ focus_start_date
+ fill_in 'startDate', with: value, fill_options: { clear: :backspace }
# Focus a different field
due_date_field.click
end
def set_due_date(value)
- due_date_field.click
- due_date_field.set value
+ focus_due_date
+ fill_in 'endDate', with: value, fill_options: { clear: :backspace }
# Focus a different field
start_date_field.click