Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions features/bulk-republishing-content.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions features/step_definitions/bulk_republishing_content_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading