From 891349ec20ba9a389cd3e39ab70562e9c8b0f187 Mon Sep 17 00:00:00 2001 From: Will Clarke Date: Mon, 14 Oct 2024 16:35:36 +0100 Subject: [PATCH] add test for banner on return to outgoings --- app/controllers/results_controller.rb | 6 ------ spec/flows/early_result_spec.rb | 23 +++++++++++------------ 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/app/controllers/results_controller.rb b/app/controllers/results_controller.rb index d3b0631de..12f0bb7d0 100644 --- a/app/controllers/results_controller.rb +++ b/app/controllers/results_controller.rb @@ -16,12 +16,6 @@ def early_result_redirect def show # ee_banner @early_eligibility_selection can be removed when FF is removed @early_result_type = session_data.dig("early_result", "type") - - # Testing back button spec - # pp @early_result_type - # puts FeatureFlags.enabled?(:ee_banner, session_data) - # pp session_data - @early_eligibility_selection = session_data.fetch("early_eligibility_selection", nil) @model = CalculationResult.new(session_data) # we'll need to move this tracking point or do something with it diff --git a/spec/flows/early_result_spec.rb b/spec/flows/early_result_spec.rb index 3db7fb8db..c6f237221 100644 --- a/spec/flows/early_result_spec.rb +++ b/spec/flows/early_result_spec.rb @@ -109,18 +109,17 @@ expect(page).to have_content "Your client's key eligibility totals" end - # Something must be missing in the session data because the back button sends us to the start page - # in the test but not on the actual service. - # however the early_result and feature flag session data is available - # it "when I go straight to results and use the back button it shows the banner" do - # confirm_screen("outgoings") - # expect(page).to have_content("Gross monthly income limit exceeded") - # click_on "Go to results page" - # expect(page).to have_current_path(/\A\/check-result/) - # expect(page).to have_content "Your client's key eligibility totals" - # click_on "Back" - # expect(page).to have_content("Gross monthly income limit exceeded by") - # end + it "when I go straight to results and use the back button it shows the banner" do + confirm_screen("outgoings") + outgoings_url = current_path + expect(page).to have_content("Gross monthly income limit exceeded") + click_on "Go to results page" + expect(page).to have_current_path(/\A\/check-result/) + expect(page).to have_content "Your client's key eligibility totals" + visit outgoings_url # simulates using the back button to return to outgoings + expect(page).to have_content("Gross monthly income limit exceeded by") + expect(page).to have_content("Go to results page") + end context "when the early eligibility changes" do it "back links and banner work as expected" do