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

working-days spec: fix spec failing depending on the day of the week

Sebastian Fiedlschuster4832c130614c
diff --git a/spec/features/admin/working_days_spec.rb b/spec/features/admin/working_days_spec.rb
index 8d7090c958e..4c3c3c90ec7 100644
--- a/spec/features/admin/working_days_spec.rb
+++ b/spec/features/admin/working_days_spec.rb
@@ -199,13 +199,17 @@ describe 'Working Days', js: true do
fill_in 'name', with: 'My holiday'
end
- date1 = Time.zone.today.next_week.next_occurring(:monday)
+ date1 = Time.zone.today.next_week.next_occurring(:monday) + 1.week
datepicker.set_date date1
page.within('[data-qa-selector="op-datepicker-modal"]') do
click_on 'Save'
end
+ expect(page).to have_no_text "A non-working day for this date exists already. " \
+ "There can only be one non-working day created for " \
+ "each unique date."
+
expect(page).to have_selector('.fc-list-event-title', text: 'My holiday')
# Add a second day
@@ -215,13 +219,17 @@ describe 'Working Days', js: true do
fill_in 'name', with: 'Another important day'
end
- date2 = Time.zone.today.next_week.next_occurring(:tuesday)
+ date2 = Time.zone.today.next_week.next_occurring(:tuesday) + 1.week
datepicker.set_date date2
page.within('[data-qa-selector="op-datepicker-modal"]') do
click_on 'Save'
end
+ expect(page).to have_no_text "A non-working day for this date exists already. " \
+ "There can only be one non-working day created for " \
+ "each unique date."
+
click_on 'Apply changes'
click_on 'Save and reschedule'