From 95723841b731a23647e820b8bc26a93058d82b6c Mon Sep 17 00:00:00 2001 From: Alkesh Vaghmaria Date: Fri, 2 Aug 2024 17:22:12 +0100 Subject: [PATCH] fix backlink and enter another email address link --- .../provider/claims/check_your_email.html.erb | 4 +--- .../provider/happy_path_spec.rb | 23 +++++++++++++++---- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/app/views/early_years_payment/provider/claims/check_your_email.html.erb b/app/views/early_years_payment/provider/claims/check_your_email.html.erb index 57dca77837..0e53e748a4 100644 --- a/app/views/early_years_payment/provider/claims/check_your_email.html.erb +++ b/app/views/early_years_payment/provider/claims/check_your_email.html.erb @@ -1,7 +1,5 @@ <% content_for(:page_title, page_title(t("early_years_payment_provider.check_your_email_page.title"), journey: current_journey_routing_name)) %> -<% @backlink_path = landing_page_path %> -

@@ -18,7 +16,7 @@

If you do not receive the email, check your spam or junk folder. - If you cannot find the email, <%= govuk_link_to "send another link", "" %> or <%= govuk_link_to "enter another email address", "" %>. + If you cannot find the email, <%= govuk_link_to "send another link", "" %> or <%= govuk_link_to "enter another email address", @backlink_path %>.

diff --git a/spec/features/early_years_payment/provider/happy_path_spec.rb b/spec/features/early_years_payment/provider/happy_path_spec.rb index 27ff142731..f56870bbb0 100644 --- a/spec/features/early_years_payment/provider/happy_path_spec.rb +++ b/spec/features/early_years_payment/provider/happy_path_spec.rb @@ -2,6 +2,8 @@ RSpec.feature "Early years payment provider" do let(:journey_session) { Journeys::EarlyYearsPayment::Provider::Session.last } + let(:mail) { ActionMailer::Base.deliveries.last } + let(:otp) { mail[:personalisation].unparsed_value[:one_time_password] } scenario "happy path claim" do when_early_years_payment_provider_journey_configuration_exists @@ -18,8 +20,7 @@ expect(page).to have_content("Check your email") expect(page).to have_content("We have sent an email to johndoe@example.com") - mail = ActionMailer::Base.deliveries.last - otp = mail[:personalisation].unparsed_value[:one_time_password] + expect(mail.to).to eq ["johndoe@example.com"] expect(otp).to match(/\A\d{6}\Z/) visit claim_path(Journeys::EarlyYearsPayment::Provider::ROUTING_NAME, :consent, code: otp) @@ -29,7 +30,21 @@ click_button "Continue" end - scenario "send another link" + scenario "enter another email address" do + when_early_years_payment_provider_journey_configuration_exists + + visit landing_page_path(Journeys::EarlyYearsPayment::Provider::ROUTING_NAME) + click_link "Start now" - scenario "enter another email address" + fill_in "Email address", with: "johndoe@example.com" + click_on "Submit" + click_on "enter another email address" + + fill_in "Email address", with: "janedoe@example.com" + click_on "Submit" + + expect(page).to have_content("We have sent an email to janedoe@example.com") + + expect(mail.to).to eq ["janedoe@example.com"] + end end