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 flaky test which fails when year has 53 weeks

Christophe Bliard529b1cf4a0c8
diff --git a/spec/features/work_packages/timeline/timeline_dates_spec.rb b/spec/features/work_packages/timeline/timeline_dates_spec.rb
index 766ee8bc8cf..bc186f8e11c 100644
--- a/spec/features/work_packages/timeline/timeline_dates_spec.rb
+++ b/spec/features/work_packages/timeline/timeline_dates_spec.rb
@@ -148,7 +148,11 @@ RSpec.describe 'Work package timeline date formatting',
it 'shows english ISO dates' do
expect(page).to have_selector('.wp-timeline--header-element', text: '01')
expect(page).to have_selector('.wp-timeline--header-element', text: '02')
- expect(page).to have_no_selector('.wp-timeline--header-element', text: '53')
+
+ # Most years do not have 53 weeks. Some do.
+ unless Date.current.beginning_of_year.saturday?
+ expect(page).not_to have_selector('.wp-timeline--header-element', text: '53')
+ end
# expect moment to return week 01 for start date and due date
expect_date_week work_package.start_date.iso8601, '01'