Skip to content

Commit

Permalink
Merge pull request #9839 from alphagov/content-modelling/refactor-cuc…
Browse files Browse the repository at this point in the history
…umber

Content modelling/refactor cucumber
  • Loading branch information
pezholio authored Jan 23, 2025
2 parents a835647 + 398eb8c commit 0102936
Show file tree
Hide file tree
Showing 19 changed files with 555 additions and 563 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,7 @@ Feature: Edit a content object

@enable-sidekiq-test-mode
Scenario: GDS editor can override a previously scheduled object
When I am updating a content block
And I schedule the change for 7 days in the future
And I add an internal note
And I add a change note
When I review and confirm my answers are correct
Given I have scheduled a change for 7 days in the future
When I revisit the edit page
Then I should see a warning telling me there is a scheduled change
When I make the changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ Feature: Schedule a content object

@disable-sidekiq-test-mode
Scenario: GDS Editor immediately publishes a scheduled content object
When I am updating a content block
And I schedule the change for 7 days in the future
And I add an internal note
And I add a change note
When I review and confirm my answers are correct
Given I have scheduled a change for 7 days in the future
When I click to view the content block
And I click to edit the schedule
And I choose to publish the change now
Expand All @@ -24,11 +20,7 @@ Feature: Schedule a content object

@disable-sidekiq-test-mode
Scenario: GDS Editor reschedules a content object
When I am updating a content block
And I schedule the change for 7 days in the future
And I add an internal note
And I add a change note
When I review and confirm my answers are correct
Given I have scheduled a change for 7 days in the future
When I click to view the content block
And I click to edit the schedule
And I schedule the change for 5 days in the future
Expand All @@ -39,23 +31,15 @@ Feature: Schedule a content object

@disable-sidekiq-test-mode
Scenario: GDS Editor tries to reschedule a content object without choosing to schedule
When I am updating a content block
And I schedule the change for 7 days in the future
And I add an internal note
And I add a change note
When I review and confirm my answers are correct
Given I have scheduled a change for 7 days in the future
When I click to view the content block
And I click to edit the schedule
And I save and continue
Then I should see an error message telling me that schedule publishing cannot be blank

@disable-sidekiq-test-mode
Scenario: GDS editor cancels the rescheduling of an object
When I am updating a content block
And I schedule the change for 7 days in the future
And I add an internal note
And I add a change note
When I review and confirm my answers are correct
Given I have scheduled a change for 7 days in the future
When I click to view the content block
And I click to edit the schedule
And I click the cancel link
Expand All @@ -64,11 +48,7 @@ Feature: Schedule a content object

@disable-sidekiq-test-mode
Scenario: GDS editor cancels the rescheduling of an object on the confirmation page
When I am updating a content block
And I schedule the change for 7 days in the future
And I add an internal note
And I add a change note
When I review and confirm my answers are correct
Given I have scheduled a change for 7 days in the future
When I click to view the content block
And I click to edit the schedule
And I schedule the change for 5 days in the future
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ Feature: Schedule a content object

@disable-sidekiq-test-mode
Scenario: GDS Editor publishes a new version of a previously scheduled content object
When I am updating a content block
And I schedule the change for 7 days in the future
And I add an internal note
And I add a change note
When I review and confirm my answers are correct
Given I have scheduled a change for 7 days in the future
When I am updating a content block
And I choose to publish the change now
And I save and continue
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Then("I should see a back link to the select schema page") do
expect(page).to have_link("Back", href: content_block_manager.new_content_block_manager_content_block_document_path)
end

Then("I should see a back link to the document page") do
expect(page).to have_link(
"Back",
href: content_block_manager.content_block_manager_content_block_document_path(@content_block.document),
)
end

Then("I should see a back link to the show page") do
match_data = URI.parse(page.current_url).path.match(%r{content-block-editions/(\d+)/edit$})
id = match_data[1] unless match_data.nil?
expect(id).not_to be_nil, "Could not find an existing content block edition ID in the URL"
expect(page).to have_link("Back", href: content_block_manager.content_block_manager_content_block_edition_path(id))
end

Then(/^I should see a back link to the "([^"]*)" step$/) do |step|
link = if step == "edit"
content_block_manager.new_content_block_manager_content_block_document_edition_path(@content_block.document)
else
content_block_manager.content_block_manager_content_block_workflow_path(
@content_block.document.editions.last,
step:,
)
end
expect(page).to have_link("Back", href: link)
end

Then("I should see a back link to the document list page") do
expect(page).to have_link("Back", href: content_block_manager.content_block_manager_content_block_documents_path)
end
Loading

0 comments on commit 0102936

Please sign in to comment.