Skip to content

Commit

Permalink
Early Years Practitioner mobile number
Browse files Browse the repository at this point in the history
  • Loading branch information
alkesh committed Oct 9, 2024
1 parent 3aab625 commit c1e5e91
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class SlugSequence
email-address
email-verification
provide-mobile-number
mobile-number
mobile-verification
check-your-answers
].freeze

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
check your answers page placeholder
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
require "rails_helper"

RSpec.feature "Early years payment practitioner mobile number" do
let(:claim) do
create(
:claim,
policy: Policies::EarlyYearsPayments,
reference: "foo",
practitioner_email_address: "[email protected]"
)
end
let(:otp_code) { "123456" }
let(:journey_session) { Journeys::EarlyYearsPayment::Provider::Start::Session.last }

before do
allow(NotifySmsMessage).to receive(:new).with(
phone_number: "07700900001",
template_id: NotifySmsMessage::OTP_PROMPT_TEMPLATE_ID,
personalisation: {
otp: otp_code
}
).and_return(instance_double(NotifySmsMessage, deliver!: true))
allow(OneTimePassword::Generator).to receive(:new).and_return(instance_double(OneTimePassword::Generator, code: otp_code))
allow(OneTimePassword::Validator).to receive(:new).and_return(instance_double(OneTimePassword::Validator, valid?: true))
end

scenario "Enter and validate mobile number" do
when_early_years_payment_practitioner_journey_configuration_exists

when_personal_details_entered_up_to_email_address

expect(page).to have_content("Would you like to provide your mobile number?")
choose "Yes"
click_on "Continue"

fill_in "Mobile number", with: "07700900001"
click_on "Continue"

fill_in "Enter the 6-digit passcode", with: otp_code
click_on "Confirm"
expect(journey_session.answers.mobile_number).to eq "07700900001"
expect(journey_session.answers.mobile_verified).to be true
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

RSpec.feature "Early years payment provider" do
let(:email_address) { "[email protected]" }
let(:journey_session) { Journeys::EarlyYearsPayment::Provider::Authenticated::Session.last }
let(:mail) { ActionMailer::Base.deliveries.last }
let(:magic_link) { mail[:personalisation].unparsed_value[:magic_link] }
let!(:nursery) { create(:eligible_ey_provider, primary_key_contact_email_address: email_address) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

RSpec.feature "Early years payment provider" do
let(:email_address) { "[email protected]" }
let(:journey_session) { Journeys::EarlyYearsPayment::Provider::Authenticated::Session.last }
let(:mail) { ActionMailer::Base.deliveries.last }
let(:magic_link) { mail[:personalisation].unparsed_value[:magic_link] }
let!(:nursery) { create(:eligible_ey_provider, primary_key_contact_email_address: email_address) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require "rails_helper"

RSpec.feature "Early years payment provider" do
let(:journey_session) { Journeys::EarlyYearsPayment::Provider::Start::Session.last }
let(:mail) { ActionMailer::Base.deliveries.last }
let(:magic_link) { mail[:personalisation].unparsed_value[:magic_link] }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
require "rails_helper"

RSpec.feature "Early years payment provider" do
let(:journey_session) { Journeys::EarlyYearsPayment::Provider::Start::Session.last }

scenario "entering an email address which is not on the whitelist" do
when_early_years_payment_provider_start_journey_configuration_exists
when_eligible_ey_provider_exists
Expand Down
33 changes: 33 additions & 0 deletions spec/support/steps/early_years_practitioner_journey.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
def when_personal_details_entered_up_to_email_address
visit "/early-years-payment-practitioner/find-reference?skip_landing_page=true&[email protected]"
fill_in "Claim reference number", with: claim.reference
click_button "Submit"

click_on "Continue"
click_on "Continue"
click_on "Continue"
click_on "Continue"

fill_in "First name", with: "John"
fill_in "Last name", with: "Doe"
fill_in "Day", with: "28"
fill_in "Month", with: "2"
fill_in "Year", with: "1988"
fill_in "National Insurance number", with: "PX321499A"
click_on "Continue"

fill_in "House number or name", with: "57"
fill_in "Building and street", with: "Walthamstow Drive"
fill_in "Town or city", with: "Derby"
fill_in "County", with: "City of Derby"
fill_in "Postcode", with: "DE22 4BS"
click_on "Continue"

fill_in "claim-email-address-field", with: "[email protected]"
click_on "Continue"

mail = ActionMailer::Base.deliveries.last
otp_in_mail_sent = mail[:personalisation].unparsed_value[:one_time_password]
fill_in "claim-one-time-password-field", with: otp_in_mail_sent
click_on "Confirm"
end

0 comments on commit c1e5e91

Please sign in to comment.