Skip to content

Commit

Permalink
Merge pull request #1257 from alphagov/add-publisher-test-for-db-access
Browse files Browse the repository at this point in the history
Add a Mainstream Publisher non-production test
  • Loading branch information
mtaylorgds authored Feb 14, 2024
2 parents 0bcbc4f + b807454 commit 42d39e8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
9 changes: 9 additions & 0 deletions features/apps/publisher.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,12 @@ Feature: Publisher
And I go to the "publisher" landing page
Then I should see "Publisher"
And I should see Publisher's publication index

@notproduction
Scenario: Can add and delete an artefact in publisher
When I go to the "publisher" landing page
And I try to login as a user
And I go to the "publisher" landing page
And I add an artefact
And I delete the artefact
Then I should see that the edition has been deleted
21 changes: 21 additions & 0 deletions features/step_definitions/publisher_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
When /^I add an artefact$/ do
click_link "Add artefact"
fill_in "Title", with: "Smokey Guide"
fill_in "Slug", with: "smokey-guide"
select "Guide", from: "Format"
click_button "Save and go to item"
expect(page).to have_selector("h1", text: "Smokey Guide")
end

When /^I delete the artefact$/ do
click_link "Admin"
click_button "Delete this edition – #1"
end

Then /^I should see that the edition has been deleted$/ do
expect(page).to have_content("Edition deleted")
end

Then /^I should see Publisher's publication index$/ do
expect(page).to have_selector("#publication-list-container")
end
4 changes: 0 additions & 4 deletions features/step_definitions/smokey_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,6 @@ def should_see(text)
@response = post_request "#{@host}#{path}", :payload => "#{payload}", dont_follow_redirects: true
end

Then /^I should see Publisher's publication index$/ do
expect(page).to have_selector("#publication-list-container")
end

Then /^JSON is returned$/ do
expect(JSON.parse(@response.body).class).to eq(Hash)
end
Expand Down

0 comments on commit 42d39e8

Please sign in to comment.