diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 696c364b..d1a07b12 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -113,6 +113,10 @@ =end config.add_setting :reload_page_wait_time, default: 60 + + config.before(:each) do + page.driver.clear_memory_cache + end end Capybara.configure do |config| diff --git a/spec/whitehall/publishing_document_spec.rb b/spec/whitehall/publishing_document_spec.rb index 47faa737..63e57287 100644 --- a/spec/whitehall/publishing_document_spec.rb +++ b/spec/whitehall/publishing_document_spec.rb @@ -33,7 +33,7 @@ def then_i_can_view_it_on_gov_uk def and_it_is_displayed_on_the_publication_finder publication_finder = find('a', text: "Publications", match: :first)[:href] reload_url_until_match(publication_finder, :has_text?, title) - click_link("Publications", match: :first) + visit(publication_finder) expect_rendering_application("whitehall") expect(page).to have_content(title) diff --git a/spec/whitehall/updating_document_spec.rb b/spec/whitehall/updating_document_spec.rb index a253ad81..28ea13b7 100644 --- a/spec/whitehall/updating_document_spec.rb +++ b/spec/whitehall/updating_document_spec.rb @@ -37,7 +37,7 @@ def then_i_can_view_the_updated_content_on_gov_uk def and_it_is_updated_on_the_publication_finder publication_finder = find('a', text: "Publications", match: :first)[:href] reload_url_until_match(publication_finder, :has_text?, updated_title) - click_link("Publications", match: :first) + visit(publication_finder) expect_rendering_application("whitehall") expect(page).to have_content(updated_title)