diff --git a/features/bulk-republishing-content.feature b/features/bulk-republishing-content.feature index e8c9562bdaf..49416bdd32b 100644 --- a/features/bulk-republishing-content.feature +++ b/features/bulk-republishing-content.feature @@ -55,6 +55,13 @@ Feature: Bulk republishing content Given Case Studies exist When I select all of type "CaseStudy" for republishing Then I can see all of type "CaseStudy" have been queued for republishing + + Scenario: Republish editionable content types since specific date and time + Given Case Studies exist that were updated around "2024-01-10" + When I select all of type "CaseStudy" for republishing + And I input a date of "2024-01-10" + Then I can see all of type "CaseStudy" have been queued for republishing + Then I can see a date input Scenario: Republish all documents by organisation Given a published organisation "An Existing Organisation" exists diff --git a/features/step_definitions/bulk_republishing_content_steps.rb b/features/step_definitions/bulk_republishing_content_steps.rb index 0c68b3ad500..30e17be6902 100644 --- a/features/step_definitions/bulk_republishing_content_steps.rb +++ b/features/step_definitions/bulk_republishing_content_steps.rb @@ -133,6 +133,16 @@ 2.times { create(:case_study) } end +Given(/Case Studies exist that were updated around "^\d{4}-\d{2}-\d{2}$"$/) do |date| + dates = [Date.parse(date), Date.parse(date) + 2, Date.parse(date) + 1, Date.parse(date) - 5, Date.parse(date) + 2, Date.parse(date) + 3] + dates.map do |d| + create( + :published_case_study, + updated_at: d, + ) + end +end + When(/^I select all of type "([^"]*)" for republishing$/) do |content_type| visit admin_republishing_index_path find("#all-by-type").click @@ -142,6 +152,18 @@ click_button("Confirm republishing") end +When(/^I select all of type "([^"]*)" updated since "^\d{4}-\d{2}-\d{2}$" for republishing$/) do |content_type, date| + visit admin_republishing_index_path + find("#all-by-type").click + select content_type, from: "content_type" + fill_in "Day", with: Date.parse(date).day + fill_in "Month", with: Date.parse(date).month + fill_in "Year", with: Date.parse(date).year + click_button("Continue") + fill_in "What is the reason for republishing?", with: "It needs republishing" + click_button("Confirm republishing") +end + Then(/^I can see all of type "([^"]*)" have been queued for republishing$/) do |content_type| expect(page).to have_selector(".gem-c-success-alert", text: "All by type '#{content_type}' have been queued for republishing") end