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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Better test assertions and documentation
Christophe Bliard0df023e49ed6
diff --git a/spec/features/work_packages/datepicker/datepicker_follows_relation_spec.rb b/spec/features/work_packages/datepicker/datepicker_follows_relation_spec.rbindex 84963d954ee..96de26afb86 100644--- a/spec/features/work_packages/datepicker/datepicker_follows_relation_spec.rb+++ b/spec/features/work_packages/datepicker/datepicker_follows_relation_spec.rb@@ -73,7 +73,7 @@ RSpec.describe "Datepicker logic on follow relationships", :js, with_settings: {# shows the current date again. We need to wait for it to be reinitialized# before showing another date. Ideally the flatpickr should not be# reinitialized if it does not need to (dates not changed for instance).- datepicker.expect_disabled Date.current+ datepicker.expect_visible_day Date.currentdatepicker.show_date "2024-02-05"datepicker.expect_disabled Date.parse("2024-02-05")diff --git a/spec/support/components/datepicker/datepicker.rb b/spec/support/components/datepicker/datepicker.rbindex a8e46495d79..3b3da64564a 100644--- a/spec/support/components/datepicker/datepicker.rb+++ b/spec/support/components/datepicker/datepicker.rb@@ -152,35 +152,38 @@ module Componentsend##- # Expect the given date to be non working+ # Expect the given date to be visible+ def expect_visible_day(date)+ label = date.strftime("%B %-d, %Y")+ expect(page).to have_css(".flatpickr-day[aria-label='#{label}']")+ end++ ##+ # Expect the given date to be visible and a non-working daydef expect_non_working(date)label = date.strftime("%B %-d, %Y")- expect(page).to have_css(".flatpickr-day.flatpickr-non-working-day[aria-label='#{label}']",- wait: 20)+ expect(page).to have_css(".flatpickr-day.flatpickr-non-working-day[aria-label='#{label}']")end##- # Expect the given date to be non working+ # Expect the given date to be visible and a working daydef expect_working(date)label = date.strftime("%B %-d, %Y")- expect(page).to have_css(".flatpickr-day:not(.flatpickr-non-working-day)[aria-label='#{label}']",- wait: 20)+ expect(page).to have_css(".flatpickr-day:not(.flatpickr-non-working-day)[aria-label='#{label}']")end##- # Expect the given date to be non working+ # Expect the given date to be visible and disableddef expect_disabled(date)label = date.strftime("%B %-d, %Y")- expect(page).to have_css(".flatpickr-day.flatpickr-disabled[aria-label='#{label}']",- wait: 20)+ expect(page).to have_css(".flatpickr-day.flatpickr-disabled[aria-label='#{label}']")end##- # Expect the given date to be non working+ # Expect the given date to be visible and enableddef expect_not_disabled(date)label = date.strftime("%B %-d, %Y")- expect(page).to have_css(".flatpickr-day:not(.flatpickr-disabled)[aria-label='#{label}']",- wait: 20)+ expect(page).to have_css(".flatpickr-day:not(.flatpickr-disabled)[aria-label='#{label}']")endprotected