From f30c077cbf1a6eb06099b93cc9fd69f1fdcbc030 Mon Sep 17 00:00:00 2001 From: Ryan MacGillivray Date: Mon, 19 Feb 2018 13:42:04 +0000 Subject: [PATCH] Update to clear page cache before each test run This protects against potential cache pollution from other tests that were previously observed with Whitehall. As such we have switched these to use the old method rather than the workaround --- spec/spec_helper.rb | 4 ++++ spec/whitehall/publishing_document_spec.rb | 2 +- spec/whitehall/updating_document_spec.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) 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)