Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Commit

Permalink
Move expect_rendering_application above expect_url_matches_*_gov_uk
Browse files Browse the repository at this point in the history
It is possible for PhantomJS to be loading the rendered version, but
for Capybara to have gone past the `expect(page).to have_content`
as the publishing application already has the content.

By moving the `expect_rendering_application` above the call to
`expect_url_matches_live_gov_uk` Capybara will use its built in
repeated find functionality to ensure the frontend has loaded.

https://ci.integration.publishing.service.gov.uk/job/publishing-e2e-tests/job/run-tests-continually/1128/
  • Loading branch information
adrianclay committed Feb 13, 2018
1 parent c126f95 commit fb24c28
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion spec/contacts_admin/publish_a_contact_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ def then_i_can_view_it_on_gov_uk
reload_url_until_match(url, :has_text?, "Contact HMRC")

click_link title
expect_rendering_application("government-frontend")
expect(page).to have_content(title)
expect_url_matches_live_gov_uk
expect_rendering_application("government-frontend")
end

def and_i_can_view_it_on_finder
Expand Down
2 changes: 1 addition & 1 deletion spec/contacts_admin/updating_a_contact_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ def then_i_can_view_it_on_gov_uk
reload_url_until_match(url, :has_text?, "Contact HMRC")

click_link new_title
expect_rendering_application("government-frontend")
expect(page).to have_content(new_title)
expect_url_matches_live_gov_uk
expect_rendering_application("government-frontend")
end

def and_i_can_view_it_on_finder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ def when_i_tag_the_guide_with_the_taxon
def then_the_taxon_on_gov_uk_links_to_the_guide
reload_url_until_match(@taxon_url, :has_text?, guide_title)
visit(@taxon_url)
expect_rendering_application("collections")
expect(page).to have_content(taxon_title)
expect(page).to have_content(guide_title)
expect_url_matches_live_gov_uk
expect_rendering_application("collections")
end
end
2 changes: 1 addition & 1 deletion spec/content_tagger/create_draft_taxon_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def then_i_can_preview_it_on_draft_gov_uk
reload_url_until_status_code(url, 200)

click_link "/" + slug
expect_rendering_application("collections")
expect(page).to have_content(title)
expect_url_matches_draft_gov_uk
expect_rendering_application("collections")
end
end
2 changes: 1 addition & 1 deletion spec/content_tagger/linking_related_content_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ def then_the_related_content_is_linked_to_from_the_guide
reload_url_until_match(@guide_url, :has_text?, related_content_title)
visit(@guide_url)

expect_rendering_application("frontend")
related_content_link = find_link(related_content_title)[:href]

expect(related_content_link).to eq(@related_content_url)
expect_url_matches_live_gov_uk
expect_rendering_application("frontend")
end

def create_and_publish_guide(slug:, title:)
Expand Down
2 changes: 1 addition & 1 deletion spec/content_tagger/publishing_taxon_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def then_i_can_view_it_on_gov_uk
reload_url_until_status_code(url, 200)

click_link "/" + slug
expect_rendering_application("collections")
expect(page).to have_content(title)
expect_url_matches_live_gov_uk
expect_rendering_application("collections")
end
end
2 changes: 1 addition & 1 deletion spec/content_tagger/removing_taxon_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def and_i_remove_one_by_redirecting_to_the_other
def then_visiting_the_removed_taxon_redirects_to_the_other_taxon
reload_url_until_status_code(@redirected_taxon_url, 301, keep_retrying_while: [200])
visit @redirected_taxon_url
expect(current_url).to eq(@redirection_destination_url)
expect_rendering_application("collections")
expect(current_url).to eq(@redirection_destination_url)
end

private
Expand Down
2 changes: 1 addition & 1 deletion spec/content_tagger/updating_taxon_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ def then_i_can_view_it_on_gov_uk
reload_url_until_match(url, :has_text?, updated_content)

click_link "/" + slug
expect_rendering_application("collections")
expect(page).to have_content(title)
expect(page).to have_content(updated_content)
expect_url_matches_live_gov_uk
expect_rendering_application("collections")
end
end
2 changes: 1 addition & 1 deletion spec/manuals_publisher/creating_draft_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def then_i_can_preview_it_on_draft_gov_uk
reload_url_until_status_code(url, 200)

click_link "Preview draft"
expect_rendering_application("manuals-frontend")
expect(page).to have_content(title)
expect_url_matches_draft_gov_uk
expect_rendering_application("manuals-frontend")
end
end
2 changes: 1 addition & 1 deletion spec/manuals_publisher/publish_live_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def then_i_can_view_it_on_gov_uk
reload_url_until_status_code(url, 200)

click_link "View on website"
expect_rendering_application("manuals-frontend")
expect(page).to have_content(title)
expect_url_matches_live_gov_uk
expect_rendering_application("manuals-frontend")
end
end
2 changes: 1 addition & 1 deletion spec/manuals_publisher/removing_content_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ def then_the_removed_section_redirects_to_the_root_page

visit removed_section_url

expect_rendering_application("manuals-frontend")
expect(current_url).to eq(url)
expect(page).to have_content(title)
expect_url_matches_live_gov_uk
expect_rendering_application("manuals-frontend")
end

def removed_section_url
Expand Down
2 changes: 1 addition & 1 deletion spec/manuals_publisher/update_published_content_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ def then_the_manual_contents_page_links_to_the_new_section_on_gov_uk
reload_url_until_match(url, :has_text?, section_title)

click_link "View on website"
expect_rendering_application("manuals-frontend")
expect(page).to have_content(title)
expect(page).to have_content(section_title)
expect_url_matches_live_gov_uk
expect_rendering_application("manuals-frontend")
end

def and_the_update_log_has_the_change_note
Expand Down
2 changes: 1 addition & 1 deletion spec/manuals_publisher/upload_attachment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def then_i_can_access_the_attachment_through_the_draft
reload_url_until_match(section_url, :has_text?, attachment_title)

click_link(section_title)
expect_url_matches_draft_gov_uk
expect_rendering_application("manuals-frontend")
expect_url_matches_draft_gov_uk

attachment_link = find_link(attachment_title)[:href]
reload_url_until_status_code(attachment_link, 200)
Expand Down
2 changes: 1 addition & 1 deletion spec/publisher/creating_draft_content_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ def then_i_can_preview_it_on_draft_gov_uk_and_was_rendered_by_frontend
wait_for_draft_to_be_published

click_link("Preview")
expect_rendering_application("frontend")
expect(page).to have_content(title)
expect_url_matches_draft_gov_uk
expect_rendering_application("frontend")
end

def wait_for_draft_to_be_published
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ def then_i_can_view_it_on_gov_uk
wait_for_artefact_to_be_published

click_link("View this on the GOV.UK website")
expect_rendering_application("government-frontend")
expect(page).to have_content(title)
expect_url_matches_live_gov_uk
expect_rendering_application("government-frontend")
end

def and_i_can_view_it_on_finder
Expand Down

0 comments on commit fb24c28

Please sign in to comment.