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

Actually create weekdays before first request

Oliver Güntherceeba5538799
diff --git a/frontend/src/app/features/work-packages/components/wp-edit-form/work-package-filter-values.spec.ts b/frontend/src/app/features/work-packages/components/wp-edit-form/work-package-filter-values.spec.ts
index 8d0a974dde0..5e7da015058 100644
--- a/frontend/src/app/features/work-packages/components/wp-edit-form/work-package-filter-values.spec.ts
+++ b/frontend/src/app/features/work-packages/components/wp-edit-form/work-package-filter-values.spec.ts
@@ -170,7 +170,7 @@ describe('WorkPackageFilterValues', () => {
setupTestBed();
});
- it('it should not apply the first value (Regression #30817)', (() => {
+ it('it should not keep the second value (Regression #30817)', (() => {
subject.applyDefaultsFromFilters(changeset);
expect(changeset.changedAttributes.length).toEqual(0);
diff --git a/spec/features/work_packages/details/workdays_spec.rb b/spec/features/work_packages/details/workdays_spec.rb
index 115632d7c6a..a86dff41ea7 100644
--- a/spec/features/work_packages/details/workdays_spec.rb
+++ b/spec/features/work_packages/details/workdays_spec.rb
@@ -44,6 +44,7 @@ describe 'Work packages datepicker workdays',
let(:combined_date) { work_packages_page.edit_field(:combinedDate) }
before do
+ week_days
login_as(user)
work_packages_page.visit!
@@ -54,7 +55,7 @@ describe 'Work packages datepicker workdays',
end
context 'with default work days' do
- let!(:week_days) { create :week_days }
+ let(:week_days) { create :week_days }
it 'shows them as disabled' do
expect(page).to have_selector('.dayContainer', count: 2)
@@ -75,7 +76,7 @@ describe 'Work packages datepicker workdays',
end
context 'with all days marked as weekend' do
- let!(:week_days) do
+ let(:week_days) do
days = create(:week_days)
WeekDay.update_all(working: false)
diff --git a/spec/features/work_packages/timeline/timeline_dates_spec.rb b/spec/features/work_packages/timeline/timeline_dates_spec.rb
index 80089936f5c..15eb6079df8 100644
--- a/spec/features/work_packages/timeline/timeline_dates_spec.rb
+++ b/spec/features/work_packages/timeline/timeline_dates_spec.rb
@@ -44,6 +44,7 @@ RSpec.describe 'Work package timeline date formatting',
subject: 'My subject'
end
+ let(:week_days) { nil }
let(:wp_timeline) { Pages::WorkPackagesTimeline.new(project) }
let!(:query_tl) do
query = build(:query, user: current_user, project:)
@@ -66,6 +67,7 @@ RSpec.describe 'Work package timeline date formatting',
end
before do
+ week_days
login_as current_user
wp_timeline.visit_query query_tl
@@ -102,7 +104,7 @@ RSpec.describe 'Work package timeline date formatting',
context 'with weekdays defined' do
let(:current_user) { create :admin, language: 'en' }
- let!(:week_days) { create :week_days }
+ let(:week_days) { create :week_days }
it 'shows them as disabled' do
expect_date_week work_package.start_date.iso8601, '01'
diff --git a/spec/support/components/datepicker/datepicker.rb b/spec/support/components/datepicker/datepicker.rb
index c42b6717583..34306bc5d16 100644
--- a/spec/support/components/datepicker/datepicker.rb
+++ b/spec/support/components/datepicker/datepicker.rb
@@ -16,6 +16,16 @@ module Components
container.find(".flatpickr-calendar")
end
+ ##
+ # Clear all values
+ def clear!
+ focus_start_date
+ fill_in 'startDate', with: '', fill_options: { clear: :backspace }
+
+ focus_due_date
+ fill_in 'endDate', with: '', fill_options: { clear: :backspace }
+ end
+
def expect_visible
expect(container).to have_selector('.flatpickr-calendar .flatpickr-current-month', wait: 10)
end
diff --git a/spec/support/components/datepicker/work_package_datepicker.rb b/spec/support/components/datepicker/work_package_datepicker.rb
index faea4343e3b..d3e1a3fa96a 100644
--- a/spec/support/components/datepicker/work_package_datepicker.rb
+++ b/spec/support/components/datepicker/work_package_datepicker.rb
@@ -53,7 +53,6 @@ module Components
expect(container).to have_field('duration', with: value, wait: 10)
end
-
def start_date_field
container.find_field 'startDate'
end
@@ -82,16 +81,6 @@ module Components
expect(container).to have_field('endDate', with: value, wait: 20)
end
- ##
- # Clear all values
- def clear!
- focus_start_date
- fill_in 'startDate', with: '', fill_options: { clear: :backspace }
-
- focus_due_date
- fill_in 'endDate', with: '', fill_options: { clear: :backspace }
- end
-
def set_start_date(value)
focus_start_date
fill_in 'startDate', with: value, fill_options: { clear: :backspace }