diff --git a/lib/idp/constants.rb b/lib/idp/constants.rb index 0f2d44f86ca..e9b66cca1d7 100644 --- a/lib/idp/constants.rb +++ b/lib/idp/constants.rb @@ -94,7 +94,10 @@ module Vendors AAL2 = 2 AAL3 = 3 + MOCK_IDV_APPLICANT_FULL_STATE = 'Montana' + MOCK_IDV_APPLICANT_FULL_STATE_ID_JURISDICTION = 'North Dakota' MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION = 'ND' + MOCK_IDV_APPLICANT_STATE = 'MT' MOCK_IDV_APPLICANT = { address1: '1 FAKE RD', address2: nil, @@ -107,7 +110,7 @@ module Vendors last_name: 'MCFAKERSON', middle_name: nil, name_suffix: 'JR', - state: 'MT', + state: MOCK_IDV_APPLICANT_STATE, state_id_expiration: '2099-12-31', state_id_issued: '2019-12-31', state_id_jurisdiction: MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION, @@ -138,6 +141,7 @@ module Vendors MOCK_IDV_APPLICANT_WITH_SSN = MOCK_IDV_APPLICANT.merge(ssn: '900-66-1234').freeze + MOCK_IDV_APPLICANT_FULL_IDENTITY_DOC_ADDRESS_STATE = 'Virginia' MOCK_IDV_APPLICANT_STATE_ID_ADDRESS = MOCK_IDV_APPLICANT_WITH_SSN.merge( identity_doc_address1: '123 Way St', identity_doc_address2: '2nd Address Line', @@ -170,10 +174,5 @@ module Vendors MOCK_IDV_APPLICANT_SAME_ADDRESS_AS_ID_WITH_PHONE = MOCK_IDV_APPLICANT_SAME_ADDRESS_AS_ID.merge(phone: '12025551212').freeze - - MOCK_IDV_APPLICANT_FULL_STATE_ID_JURISDICTION = 'North Dakota' - MOCK_IDV_APPLICANT_FULL_STATE = 'Montana' - MOCK_IDV_APPLICANT_FULL_IDENTITY_DOC_ADDRESS_STATE = 'Virginia' - MOCK_IDV_APPLICANT_STATE = 'MT' end end diff --git a/spec/controllers/idv/in_person/address_controller_spec.rb b/spec/controllers/idv/in_person/address_controller_spec.rb index ed079de766a..638175330c0 100644 --- a/spec/controllers/idv/in_person/address_controller_spec.rb +++ b/spec/controllers/idv/in_person/address_controller_spec.rb @@ -5,6 +5,7 @@ include InPersonHelper let(:user) { build(:user) } + let(:pii_from_user) { Idp::Constants::MOCK_IPP_APPLICANT_SAME_ADDRESS_AS_ID_FALSE } before do allow(IdentityConfig.store).to receive(:usps_ipp_transliteration_enabled). @@ -12,7 +13,7 @@ stub_sign_in(user) stub_up_to(:hybrid_handoff, idv_session: subject.idv_session) subject.user_session['idv/in_person'] = { - pii_from_user: Idp::Constants::MOCK_IPP_APPLICANT_SAME_ADDRESS_AS_ID_FALSE.dup, + pii_from_user: pii_from_user, } subject.idv_session.ssn = nil stub_analytics @@ -30,11 +31,22 @@ :before, :set_usps_form_presenter, ) + expect(subject).to have_actions( + :before, + :confirm_in_person_state_id_step_complete, + ) + expect(subject).to have_actions( + :before, + :confirm_in_person_address_step_needed, + ) end context '#confirm_in_person_state_id_step_complete' do - it 'redirects to state id page if not complete' do + before do subject.user_session['idv/in_person'][:pii_from_user].delete(:identity_doc_address1) + end + + it 'redirects to state id page if not complete' do get :show expect(response).to redirect_to idv_in_person_state_id_url @@ -42,8 +54,10 @@ end context '#confirm_in_person_address_step_needed' do + before do + request.env['HTTP_REFERER'] = idv_in_person_verify_info_url + end it 'remains on page when referer is verify info' do - subject.request = idv_in_person_verify_info_url get :show expect(response).to render_template :show @@ -68,12 +82,15 @@ expect(response).to render_template :show end - it 'redirects to ssn page when address1 present' do - subject.user_session['idv/in_person'][:pii_from_user][:address1] = '123 Main St' - - get :show + context 'when address1 present' do + before do + subject.user_session['idv/in_person'][:pii_from_user][:address1] = '123 Main St' + end + it 'redirects to ssn page' do + get :show - expect(response).to redirect_to idv_in_person_ssn_url + expect(response).to redirect_to idv_in_person_ssn_url + end end it 'logs idv_in_person_proofing_address_visited' do @@ -101,10 +118,10 @@ describe '#update' do context 'valid address details' do - let(:address1) { '1 FAKE RD' } + let(:address1) { Idp::Constants::MOCK_IDV_APPLICANT[:address1] } let(:address2) { 'APT 1B' } - let(:city) { 'GREAT FALLS' } - let(:zipcode) { '59010-4444' } + let(:city) { Idp::Constants::MOCK_IDV_APPLICANT[:city] } + let(:zipcode) { Idp::Constants::MOCK_IDV_APPLICANT[:zipcode] } let(:state) { 'Montana' } let(:params) do { in_person_address: { diff --git a/spec/controllers/idv/in_person/state_id_controller_spec.rb b/spec/controllers/idv/in_person/state_id_controller_spec.rb index 731f64212f9..b24ab440209 100644 --- a/spec/controllers/idv/in_person/state_id_controller_spec.rb +++ b/spec/controllers/idv/in_person/state_id_controller_spec.rb @@ -225,15 +225,21 @@ expect(subject.user_session['idv/in_person'][:pii_from_user]).to_not have_key attr end - make_pii + build_pii_before_state_id_update - # pii includes address attrs on re-visiting state id pg + # since same_address_as_id was initially true, pii includes residential address attrs, + # which are the same as state id address attrs, on re-visiting state id pg expect(subject.user_session['idv/in_person'][:pii_from_user]).to include( - address1:, - address2:, - city:, - state:, - zipcode:, + identity_doc_address1:, + identity_doc_address2:, + identity_doc_city:, + identity_doc_address_state:, + identity_doc_zipcode:, + address1: identity_doc_address1, + address2: identity_doc_address2, + city: identity_doc_city, + state: identity_doc_address_state, + zipcode: identity_doc_zipcode, ) # On Verify, user changes response from "Yes,..." to @@ -285,7 +291,7 @@ expect(subject.user_session['idv/in_person'][:pii_from_user]).to_not have_key attr end - make_pii(same_address_as_id: 'false') + build_pii_before_state_id_update(same_address_as_id: 'false') # On Verify, user changes response from "No,..." to # "Yes, I live at the address on my state-issued ID @@ -322,7 +328,7 @@ end # User picks "No, I live at a different address" on state ID - make_pii(same_address_as_id: 'false') + build_pii_before_state_id_update(same_address_as_id: 'false') # On Verify, user does not changes response "No,..." put :update, params: params diff --git a/spec/factories/in_person_enrollments.rb b/spec/factories/in_person_enrollments.rb index bfb36296ea4..268164e51b2 100644 --- a/spec/factories/in_person_enrollments.rb +++ b/spec/factories/in_person_enrollments.rb @@ -49,9 +49,5 @@ trait :enhanced_ipp do sponsor_id { IdentityConfig.store.usps_eipp_sponsor_id } end - - trait :with_nil_sponsor_id do - sponsor_id { nil } - end end end diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 8199af755a0..15ed22e6303 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -279,6 +279,7 @@ user: user, ) create(:in_person_enrollment, :passed, user: user, profile: profile) + profile.in_person_verification_pending_at = nil end end diff --git a/spec/features/idv/analytics_spec.rb b/spec/features/idv/analytics_spec.rb index b224ab7321e..ce49724a1b1 100644 --- a/spec/features/idv/analytics_spec.rb +++ b/spec/features/idv/analytics_spec.rb @@ -160,7 +160,7 @@ }, biographical_info: { birth_year: 1938, - identity_doc_address_state: 'ND', + identity_doc_address_state: 'MT', state: 'MT', state_id_jurisdiction: 'ND', state_id_number: '#############', diff --git a/spec/features/idv/doc_auth/address_step_spec.rb b/spec/features/idv/doc_auth/address_step_spec.rb index ed8969a8409..f21a26795db 100644 --- a/spec/features/idv/doc_auth/address_step_spec.rb +++ b/spec/features/idv/doc_auth/address_step_spec.rb @@ -2,7 +2,6 @@ RSpec.feature 'doc auth verify step', :js do include IdvStepHelper - include DocAuthHelper let(:puerto_rico_address1_hint) do "#{t('forms.example')} 150 Calle A Apt 3" @@ -56,7 +55,10 @@ it 'allows the user to enter in a new address' do expect_step_indicator_current_step(t('step_indicator.flows.idv.verify_info')) expect(page).not_to have_content(t('forms.example')) - fill_out_address_form_ok + fill_in 'idv_form_address1', with: '123 Main St' + fill_in 'idv_form_city', with: 'Nowhere' + select 'Virginia', from: 'idv_form_state' + fill_in 'idv_form_zipcode', with: '66044' click_button t('forms.buttons.submit.update') expect(page).to have_current_path(idv_verify_info_path) diff --git a/spec/features/idv/doc_auth/verify_info_step_spec.rb b/spec/features/idv/doc_auth/verify_info_step_spec.rb index 661c75dc0f9..86960660722 100644 --- a/spec/features/idv/doc_auth/verify_info_step_spec.rb +++ b/spec/features/idv/doc_auth/verify_info_step_spec.rb @@ -7,17 +7,16 @@ let(:fake_analytics) { FakeAnalytics.new } let(:user) { user_with_2fa } - # values from Idp::Constants::MOCK_IDV_APPLICANT let(:fake_pii_details) do { - document_state: 'MT', - document_number: '1111111111111', - document_issued: '2019-12-31', - document_expiration: '2099-12-31', - first_name: 'FAKEY', - last_name: 'MCFAKERSON', - date_of_birth: '1938-10-06', - address: '1 FAKE RD', + document_state: MOCK_IDV_APPLICANT[:state], + document_number: MOCK_IDV_APPLICANT[:state_id_number], + document_issued: MOCK_IDV_APPLICANT[:state_id_issued], + document_expiration: MOCK_IDV_APPLICANT[:state_id_expiration], + first_name: MOCK_IDV_APPLICANT[:first_name], + last_name: MOCK_IDV_APPLICANT[:last_name], + date_of_birth: MOCK_IDV_APPLICANT[:dob], + address: MOCK_IDV_APPLICANT[:address1], } end @@ -247,7 +246,7 @@ context 'AAMVA' do let(:mock_state_id_jurisdiction) do - [Idp::Constants::MOCK_IDV_APPLICANT[:state_id_jurisdiction]] + [Idp::Constants::MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION] end context 'when the user lives in an AAMVA supported state' do diff --git a/spec/features/idv/in_person_spec.rb b/spec/features/idv/in_person_spec.rb index 68bd0646446..c5af6f91e50 100644 --- a/spec/features/idv/in_person_spec.rb +++ b/spec/features/idv/in_person_spec.rb @@ -56,7 +56,8 @@ expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ADDRESS1).twice expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ADDRESS2).twice expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_CITY).twice - expect(page).to have_text(Idp::Constants::MOCK_IDV_APPLICANT[:state_id_jurisdiction], count: 3) + expect(page).to have_text(Idp::Constants::MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION, count: 1) + expect(page).to have_text(Idp::Constants::MOCK_IDV_APPLICANT_STATE, count: 2) expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ZIPCODE).twice expect(page).to have_text(DocAuthHelper::GOOD_SSN_MASKED) @@ -428,12 +429,13 @@ expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ADDRESS1) expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ADDRESS2) expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_CITY) - expect(page).to have_text(Idp::Constants::MOCK_IDV_APPLICANT[:state_id_jurisdiction]).twice + expect(page).to have_text(Idp::Constants::MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION).once + expect(page).to have_text(Idp::Constants::MOCK_IDV_APPLICANT_STATE).twice expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ZIPCODE) expect(page).to have_text(InPersonHelper::GOOD_ADDRESS1) expect(page).to have_text(InPersonHelper::GOOD_CITY) expect(page).to have_text(InPersonHelper::GOOD_ZIPCODE) - expect(page).to have_text(Idp::Constants::MOCK_IDV_APPLICANT[:state]) + expect(page).to have_text(Idp::Constants::MOCK_IDV_APPLICANT_STATE) expect(page).to have_text(DocAuthHelper::GOOD_SSN_MASKED) complete_verify_step(user) diff --git a/spec/features/idv/in_person_threatmetrix_spec.rb b/spec/features/idv/in_person_threatmetrix_spec.rb index 799acbc5a98..6747cd4cbbc 100644 --- a/spec/features/idv/in_person_threatmetrix_spec.rb +++ b/spec/features/idv/in_person_threatmetrix_spec.rb @@ -99,8 +99,12 @@ def deactivate_profile_update_enrollment(status:) expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ADDRESS2).twice expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_CITY).twice expect(page).to have_text( - Idp::Constants::MOCK_IDV_APPLICANT[:state_id_jurisdiction], - count: 3, + Idp::Constants::MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION, + count: 1, + ) + expect(page).to have_text( + Idp::Constants::MOCK_IDV_APPLICANT_STATE, + count: 2, ) expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ZIPCODE).twice expect(page).to have_text(DocAuthHelper::GOOD_SSN_MASKED) diff --git a/spec/features/idv/steps/in_person/state_id_spec.rb b/spec/features/idv/steps/in_person/state_id_spec.rb index b9ae0d07f62..7572eba495b 100644 --- a/spec/features/idv/steps/in_person/state_id_spec.rb +++ b/spec/features/idv/steps/in_person/state_id_spec.rb @@ -86,7 +86,7 @@ expect(page).to have_field(t('components.memorable_date.year'), with: '1938') expect(page).to have_field( t('in_person_proofing.form.state_id.state_id_jurisdiction'), - with: Idp::Constants::MOCK_IDV_APPLICANT[:state_id_jurisdiction], + with: Idp::Constants::MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION, ) expect(page).to have_field( t('in_person_proofing.form.state_id.state_id_number'), @@ -110,7 +110,7 @@ ) expect(page).to have_field( t('in_person_proofing.form.state_id.identity_doc_address_state'), - with: Idp::Constants::MOCK_IDV_APPLICANT[:state_id_jurisdiction], + with: Idp::Constants::MOCK_IDV_APPLICANT_STATE, ) expect(page).to have_checked_field( t('in_person_proofing.form.state_id.same_address_as_id_yes'), diff --git a/spec/features/idv/steps/in_person/verify_info_spec.rb b/spec/features/idv/steps/in_person/verify_info_spec.rb index 528e6607973..29cf6a5eb1b 100644 --- a/spec/features/idv/steps/in_person/verify_info_spec.rb +++ b/spec/features/idv/steps/in_person/verify_info_spec.rb @@ -33,8 +33,12 @@ expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ADDRESS2).twice expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_CITY).twice expect(page).to have_text( - Idp::Constants::MOCK_IDV_APPLICANT[:state_id_jurisdiction], - count: 3, + Idp::Constants::MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION, + count: 1, + ) + expect(page).to have_text( + Idp::Constants::MOCK_IDV_APPLICANT_STATE, + count: 2, ) expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ZIPCODE).twice expect(page).to have_text(DocAuthHelper::GOOD_SSN_MASKED) diff --git a/spec/features/idv/steps/in_person_opt_in_ipp_spec.rb b/spec/features/idv/steps/in_person_opt_in_ipp_spec.rb index db8de8f064d..c9068552a2d 100644 --- a/spec/features/idv/steps/in_person_opt_in_ipp_spec.rb +++ b/spec/features/idv/steps/in_person_opt_in_ipp_spec.rb @@ -58,8 +58,12 @@ expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ADDRESS2).twice expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_CITY).twice expect(page).to have_text( - Idp::Constants::MOCK_IDV_APPLICANT[:state_id_jurisdiction], - count: 3, + Idp::Constants::MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION, + count: 1, + ) + expect(page).to have_text( + Idp::Constants::MOCK_IDV_APPLICANT_STATE, + count: 2, ) expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ZIPCODE).twice expect(page).to have_text(DocAuthHelper::GOOD_SSN_MASKED) @@ -175,8 +179,12 @@ expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ADDRESS2).twice expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_CITY).twice expect(page).to have_text( - Idp::Constants::MOCK_IDV_APPLICANT[:state_id_jurisdiction], - count: 3, + Idp::Constants::MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION, + count: 1, + ) + expect(page).to have_text( + Idp::Constants::MOCK_IDV_APPLICANT_STATE, + count: 2, ) expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ZIPCODE).twice expect(page).to have_text(DocAuthHelper::GOOD_SSN_MASKED) @@ -360,8 +368,12 @@ expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ADDRESS2).twice expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_CITY).twice expect(page).to have_text( - Idp::Constants::MOCK_IDV_APPLICANT[:state_id_jurisdiction], - count: 3, + Idp::Constants::MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION, + count: 1, + ) + expect(page).to have_text( + Idp::Constants::MOCK_IDV_APPLICANT_STATE, + count: 2, ) expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ZIPCODE).twice expect(page).to have_text(DocAuthHelper::GOOD_SSN_MASKED) diff --git a/spec/fixtures/artifacts/test-1.txt b/spec/fixtures/artifacts/test-1.txt deleted file mode 100644 index ba62c8ecf82..00000000000 --- a/spec/fixtures/artifacts/test-1.txt +++ /dev/null @@ -1 +0,0 @@ -local-test-1 diff --git a/spec/fixtures/artifacts/test-2.txt b/spec/fixtures/artifacts/test-2.txt deleted file mode 100644 index aa355c3cef3..00000000000 --- a/spec/fixtures/artifacts/test-2.txt +++ /dev/null @@ -1 +0,0 @@ -local-test-2 diff --git a/spec/fixtures/artifacts/test-3.txt b/spec/fixtures/artifacts/test-3.txt deleted file mode 100644 index 6a1440f4109..00000000000 --- a/spec/fixtures/artifacts/test-3.txt +++ /dev/null @@ -1 +0,0 @@ -local-test-3 diff --git a/spec/services/usps_in_person_proofing/enrollment_helper_spec.rb b/spec/services/usps_in_person_proofing/enrollment_helper_spec.rb index e0381815dd5..cb549770d51 100644 --- a/spec/services/usps_in_person_proofing/enrollment_helper_spec.rb +++ b/spec/services/usps_in_person_proofing/enrollment_helper_spec.rb @@ -2,6 +2,7 @@ RSpec.describe UspsInPersonProofing::EnrollmentHelper do include UspsIppHelper + include UspsIppServiceHelper let(:usps_mock_fallback) { false } let(:user) { build(:user) } @@ -43,7 +44,7 @@ end describe '#schedule_in_person_enrollment' do - context 'when the user does not have a establishing in person enrollment' do + context 'when the user does not have an establishing in person enrollment' do let(:user) { double('user', establishing_in_person_enrollment: nil) } it 'returns without error' do @@ -332,9 +333,7 @@ describe '#create_usps_enrollment' do let(:usps_mock_fallback) { true } - let(:enrollment) { create(:in_person_enrollment, :with_service_provider) } let(:usps_eipp_sponsor_id) { '314159265359' } - let(:is_enhanced_ipp) { true } let(:pii) do Pii::Attributes.new_from_hash( Idp::Constants::MOCK_IDV_APPLICANT, @@ -369,6 +368,7 @@ profile: nil, ) end + let(:is_enhanced_ipp) { true } it 'creates an enhanced ipp enrollment' do expect(proofer).to receive(:request_enroll).with(applicant, is_enhanced_ipp) @@ -382,31 +382,4 @@ end end end - - def transliterated_without_change(value) - UspsInPersonProofing::Transliterator::TransliterationResult.new( - changed?: false, - original: value, - transliterated: value, - unsupported_chars: [], - ) - end - - def transliterated(value) - UspsInPersonProofing::Transliterator::TransliterationResult.new( - changed?: true, - original: value, - transliterated: "transliterated_#{value}", - unsupported_chars: [], - ) - end - - def transliterated_with_failure(value) - UspsInPersonProofing::Transliterator::TransliterationResult.new( - changed?: true, - original: value, - transliterated: "transliterated_failed_#{value}", - unsupported_chars: [':'], - ) - end end diff --git a/spec/services/usps_in_person_proofing/proofer_spec.rb b/spec/services/usps_in_person_proofing/proofer_spec.rb index a31e7fe7d88..eae18260f75 100644 --- a/spec/services/usps_in_person_proofing/proofer_spec.rb +++ b/spec/services/usps_in_person_proofing/proofer_spec.rb @@ -1,19 +1,8 @@ require 'rails_helper' -def expect_facility_fields_to_be_present(facility) - expect(facility.address).to be_present - expect(facility.city).to be_present - expect(facility.name).to be_present - expect(facility.saturday_hours).to be_present - expect(facility.state).to be_present - expect(facility.sunday_hours).to be_present - expect(facility.weekday_hours).to be_present - expect(facility.zip_code_4).to be_present - expect(facility.zip_code_5).to be_present -end - RSpec.describe UspsInPersonProofing::Proofer do include UspsIppHelper + include UspsIppServiceHelper let(:subject) { UspsInPersonProofing::Proofer.new } let(:root_url) { 'http://my.root.url' } @@ -297,8 +286,6 @@ def expect_facility_fields_to_be_present(facility) end let(:is_enhanced_ipp) { false } let(:request_url) { "#{root_url}/ivs-ippaas-api/IPPRest/resources/rest/optInIPPApplicant" } - let(:usps_ipp_sponsor_id) { '42' } - let(:ipp_assurance_level) { '1.5' } before do stub_request_token diff --git a/spec/support/features/doc_auth_helper.rb b/spec/support/features/doc_auth_helper.rb index 264cee35488..bf374379bbd 100644 --- a/spec/support/features/doc_auth_helper.rb +++ b/spec/support/features/doc_auth_helper.rb @@ -9,7 +9,6 @@ module DocAuthHelper GOOD_SSN = (Idp::Constants::MOCK_IDV_APPLICANT_WITH_SSN[:ssn]).freeze GOOD_SSN_MASKED = '9**-**-***4'.freeze - SAMPLE_TMX_SUMMARY_REASON_CODE = { tmx_summary_reason_code: ['Identity_Negative_History'] }.freeze SSN_THAT_FAILS_RESOLUTION = '123-45-6666'.freeze SSN_THAT_RAISES_EXCEPTION = '000-00-0000'.freeze @@ -42,10 +41,6 @@ def click_send_link click_on t('forms.buttons.send_link') end - def click_upload_from_computer - click_on t('forms.buttons.upload_photos') - end - def complete_doc_auth_steps_before_welcome_step(expect_accessible: false) visit idv_welcome_url unless current_path == idv_welcome_url click_idv_continue if current_path == idv_mail_only_warning_path @@ -130,16 +125,6 @@ def complete_document_capture_step_with_yml(proofing_yml, expected_path: idv_ssn expect(page).to have_current_path(expected_path, wait: 10) end - def complete_doc_auth_steps_before_phone_otp_step(expect_accessible: false, with_selfie: false) - complete_doc_auth_steps_before_verify_step( - expect_accessible: expect_accessible, - with_selfie: with_selfie, - ) - click_idv_continue - expect_page_to_have_no_accessibility_violations(page) if expect_accessible - click_idv_continue - end - def mobile_device Browser.new(mobile_user_agent) end @@ -221,16 +206,6 @@ def complete_proofing_steps(with_selfie: false) click_agree_and_continue end - def mock_general_doc_auth_client_error(method) - DocAuth::Mock::DocAuthMockClient.mock_response!( - method: method, - response: DocAuth::Response.new( - success: false, - errors: { error: I18n.t('doc_auth.errors.general.no_liveness') }, - ), - ) - end - def mock_doc_auth_attention_with_barcode attention_with_barcode_response = instance_double( Faraday::Response, @@ -246,121 +221,12 @@ def mock_doc_auth_attention_with_barcode ) end - def mock_doc_auth_success_face_match_fail - failure_response = instance_double( - Faraday::Response, - status: 200, - body: LexisNexisFixtures.true_id_response_with_face_match_fail, - ) - DocAuth::Mock::DocAuthMockClient.mock_response!( - method: :get_results, - response: DocAuth::LexisNexis::Responses::TrueIdResponse.new( - failure_response, - DocAuth::LexisNexis::Config.new, - true, # liveness_checking_enabled - ), - ) - end - - def mock_doc_auth_failure_face_match_pass - failure_response = instance_double( - Faraday::Response, - status: 200, - body: LexisNexisFixtures.true_id_response_failure_with_face_match_pass, - ) - DocAuth::Mock::DocAuthMockClient.mock_response!( - method: :get_results, - response: DocAuth::LexisNexis::Responses::TrueIdResponse.new( - failure_response, - DocAuth::LexisNexis::Config.new, - true, # liveness_checking_enabled - ), - ) - end - - def mock_doc_auth_fail_face_match_fail - failure_response = instance_double( - Faraday::Response, - status: 200, - body: LexisNexisFixtures.true_id_response_failure_with_face_match_fail, - ) - DocAuth::Mock::DocAuthMockClient.mock_response!( - method: :get_results, - response: DocAuth::LexisNexis::Responses::TrueIdResponse.new( - failure_response, - DocAuth::LexisNexis::Config.new, - true, # liveness_checking_enabled - ), - ) - end - - def mock_doc_auth_pass_and_portrait_match_not_live - failure_response = instance_double( - Faraday::Response, - status: 200, - body: LexisNexisFixtures.true_id_response_success_with_portrait_match_not_live, - ) - DocAuth::Mock::DocAuthMockClient.mock_response!( - method: :get_results, - response: DocAuth::LexisNexis::Responses::TrueIdResponse.new( - failure_response, - DocAuth::LexisNexis::Config.new, - true, # liveness_checking_enabled - ), - ) - end - - def mock_doc_auth_pass_face_match_pass_no_address1 - response = instance_double( - Faraday::Response, - status: 200, - body: LexisNexisFixtures.true_id_response_success_with_liveness, - ) - DocAuth::Mock::DocAuthMockClient.mock_response!( - method: :get_results, - response: DocAuth::LexisNexis::Responses::TrueIdResponse.new( - response, - DocAuth::LexisNexis::Config.new, - true, # liveness_checking_enabled - ), - ) - end - - def mock_doc_auth_trueid_http_non2xx_status(status) - network_error_response = instance_double( - Faraday::Response, - status: status, - body: '{}', - ) - DocAuth::Mock::DocAuthMockClient.mock_response!( - method: :get_results, - response: DocAuth::LexisNexis::Responses::TrueIdResponse.new( - network_error_response, - DocAuth::LexisNexis::Config.new, - ), - ) - end - def verify_phone_otp choose_idv_otp_delivery_method_sms fill_in_code_with_last_phone_otp click_submit_default end - def fill_out_address_form_ok - fill_in 'idv_form_address1', with: '123 Main St' - fill_in 'idv_form_city', with: 'Nowhere' - select 'Virginia', from: 'idv_form_state' - fill_in 'idv_form_zipcode', with: '66044' - end - - def fill_out_address_form_resolution_fail - fill_in 'idv_form_address1', with: '123 Main St' - fill_in 'idv_form_city', with: 'Nowhere' - select 'Virginia', from: 'idv_form_state' - fill_in 'idv_form_zipcode', with: '00000' - end - def fill_out_address_form_fail fill_in 'idv_form_address1', with: '123 Main St' fill_in 'idv_form_city', with: 'Nowhere' @@ -368,10 +234,6 @@ def fill_out_address_form_fail fill_in 'idv_form_zipcode', with: '1' end - def fill_out_doc_auth_phone_form_ok(phone = '415-555-0199') - fill_in :doc_auth_phone, with: phone - end - def complete_all_idv_steps_with(threatmetrix:) allow(IdentityConfig.store).to receive(:otp_delivery_blocklist_maxretry).and_return(300) user = create(:user, :fully_registered) diff --git a/spec/support/features/idv_step_helper.rb b/spec/support/features/idv_step_helper.rb index 5833ef4d25d..c8765ed6100 100644 --- a/spec/support/features/idv_step_helper.rb +++ b/spec/support/features/idv_step_helper.rb @@ -64,10 +64,6 @@ def click_what_to_bring_link click_link t('in_person_proofing.body.barcode.learn_more') end - def visit_sp_from_in_person_ready_to_verify - click_sp_link_in_person_ready_to_verify - end - def sp_friendly_name 'Test SP' end @@ -76,7 +72,7 @@ def link_text t('in_person_proofing.body.barcode.return_to_partner_link', sp_name: sp_friendly_name) end - def click_sp_link_in_person_ready_to_verify + def visit_sp_from_in_person_ready_to_verify expect(page).to have_content(link_text) click_link(link_text) end @@ -107,14 +103,6 @@ def complete_idv_steps_with_gpo_before_confirmation_step(user = user_with_2fa) click_continue end - def complete_idv_steps_before_confirmation_step(address_verification_mechanism = :phone) - if address_verification_mechanism == :phone - complete_idv_steps_with_phone_before_confirmation_step - else - complete_idv_steps_with_gpo_before_confirmation_step - end - end - def complete_idv_steps_before_step(step, user = user_with_2fa) send(:"complete_idv_steps_before_#{step}_step", user) end @@ -146,14 +134,4 @@ def complete_idv_steps_before_ssn(user = user_with_2fa) fill_out_state_id_form_ok(same_address_as_id: true) click_idv_continue end - - private - - def stub_idv_session(**session_attributes) - allow(Idv::Session).to receive(:new).and_wrap_original do |original, kwargs| - result = original.call(**kwargs) - kwargs[:user_session][:idv].merge!(session_attributes) - result - end - end end diff --git a/spec/support/features/in_person_helper.rb b/spec/support/features/in_person_helper.rb index 41fbaef6b9c..81de665e188 100644 --- a/spec/support/features/in_person_helper.rb +++ b/spec/support/features/in_person_helper.rb @@ -47,7 +47,7 @@ def fill_out_state_id_form_ok(same_address_as_id: false, first_name: GOOD_FIRST_ fill_in t('in_person_proofing.form.state_id.address2'), with: GOOD_IDENTITY_DOC_ADDRESS2 fill_in t('in_person_proofing.form.state_id.city'), with: GOOD_IDENTITY_DOC_CITY fill_in t('in_person_proofing.form.state_id.zipcode'), with: GOOD_IDENTITY_DOC_ZIPCODE - select GOOD_STATE_ID_JURISDICTION, + select GOOD_STATE, from: t('in_person_proofing.form.state_id.identity_doc_address_state') if same_address_as_id choose t('in_person_proofing.form.state_id.same_address_as_id_yes') @@ -120,17 +120,6 @@ def complete_prepare_step(_user = nil) click_on t('forms.buttons.continue') end - def complete_state_id_step(_user = nil, same_address_as_id: true, first_name: GOOD_FIRST_NAME) - # Wait for page to load before attempting to fill out form - expect(page).to have_current_path(idv_in_person_state_id_path, wait: 10) - fill_out_state_id_form_ok(same_address_as_id: same_address_as_id, first_name:) - click_idv_continue - unless same_address_as_id - expect(page).to have_current_path(idv_in_person_address_path, wait: 10) - expect_in_person_step_indicator_current_step(t('step_indicator.flows.idv.verify_info')) - end - end - def complete_state_id_controller(_user = nil, same_address_as_id: true, first_name: GOOD_FIRST_NAME) # Wait for page to load before attempting to fill out form @@ -158,14 +147,6 @@ def complete_verify_step(_user = nil) click_idv_submit_default end - def complete_steps_before_state_id_step - sign_in_and_2fa_user - begin_in_person_proofing - complete_prepare_step - complete_location_step - expect(page).to have_current_path(idv_in_person_state_id_path, wait: 10) - end - def complete_steps_before_state_id_controller sign_in_and_2fa_user begin_in_person_proofing @@ -205,11 +186,6 @@ def complete_entire_ipp_flow(user = user_with_2fa, tmx_status = nil, same_addres end def expect_in_person_step_indicator_current_step(text) - expect_in_person_step_indicator - expect_step_indicator_current_step(text) - end - - def expect_in_person_step_indicator # Normally we're only concerned with the "current" step, but since some steps are shared between # flows, we also want to make sure that at least one of the in-person-specific steps exists in # the step indicator. @@ -217,20 +193,29 @@ def expect_in_person_step_indicator '.step-indicator__step', text: t('step_indicator.flows.idv.find_a_post_office'), ) + expect_step_indicator_current_step(text) end - def make_pii(same_address_as_id: 'true') + def build_pii_before_state_id_update(same_address_as_id: 'true') pii_from_user[:same_address_as_id] = same_address_as_id pii_from_user[:identity_doc_address1] = identity_doc_address1 pii_from_user[:identity_doc_address2] = identity_doc_address2 pii_from_user[:identity_doc_city] = identity_doc_city pii_from_user[:identity_doc_address_state] = identity_doc_address_state pii_from_user[:identity_doc_zipcode] = identity_doc_zipcode - pii_from_user[:address1] = address1 - pii_from_user[:address2] = address2 - pii_from_user[:city] = city - pii_from_user[:state] = state - pii_from_user[:zipcode] = zipcode + if same_address_as_id == 'true' + pii_from_user[:address1] = identity_doc_address1 + pii_from_user[:address2] = identity_doc_address2 + pii_from_user[:city] = identity_doc_city + pii_from_user[:state] = identity_doc_address_state + pii_from_user[:zipcode] = identity_doc_zipcode + else + pii_from_user[:address1] = address1 + pii_from_user[:address2] = address2 + pii_from_user[:city] = city + pii_from_user[:state] = state + pii_from_user[:zipcode] = zipcode + end end def mark_in_person_enrollment_passed(user) diff --git a/spec/support/features/verify_step_helper.rb b/spec/support/features/verify_step_helper.rb deleted file mode 100644 index 2f4c7eaf831..00000000000 --- a/spec/support/features/verify_step_helper.rb +++ /dev/null @@ -1,19 +0,0 @@ -module VerifyStepHelper - include InPersonHelper - - def expect_good_state_id_address - expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ADDRESS1) - expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ADDRESS2) - expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_CITY) - expect(page).to have_text(Idp::Constants::MOCK_IDV_APPLICANT[:state_id_jurisdiction]) - expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ZIPCODE) - end - - def expect_good_address - expect(page).to have_text(InPersonHelper::GOOD_ADDRESS1) - expect(page).to have_content(t('idv.form.address2')) - expect(page).to have_text(InPersonHelper::GOOD_CITY) - expect(page).to have_text(Idp::Constants::MOCK_IDV_APPLICANT[:state]) - expect(page).to have_text(InPersonHelper::GOOD_ZIPCODE) - end -end diff --git a/spec/support/geocoder_stubs.rb b/spec/support/geocoder_stubs.rb deleted file mode 100644 index 4a5a58728dc..00000000000 --- a/spec/support/geocoder_stubs.rb +++ /dev/null @@ -1,41 +0,0 @@ -Geocoder.configure(ip_lookup: :test) - -Geocoder::Lookup::Test.add_stub( - '1.2.3.4', [ - { - 'city' => 'foo', - 'country' => 'United States', - 'state_code' => '', - }, - ] -) - -Geocoder::Lookup::Test.add_stub( - '159.142.31.80', [ - { - 'city' => 'Arlington', - 'country' => 'United States', - 'state_code' => 'VA', - }, - ] -) - -Geocoder::Lookup::Test.add_stub( - '4.3.2.1', [ - { - 'city' => '', - 'country' => '', - 'state_code' => '', - }, - ] -) - -Geocoder::Lookup::Test.add_stub( - '127.0.0.1', [ - { - 'city' => '', - 'country' => 'United States', - 'state_code' => '', - }, - ] -) diff --git a/spec/support/usps_ipp_service_helper.rb b/spec/support/usps_ipp_service_helper.rb new file mode 100644 index 00000000000..0b5c9cdd7a8 --- /dev/null +++ b/spec/support/usps_ipp_service_helper.rb @@ -0,0 +1,40 @@ +module UspsIppServiceHelper + def expect_facility_fields_to_be_present(facility) + expect(facility.address).to be_present + expect(facility.city).to be_present + expect(facility.name).to be_present + expect(facility.saturday_hours).to be_present + expect(facility.state).to be_present + expect(facility.sunday_hours).to be_present + expect(facility.weekday_hours).to be_present + expect(facility.zip_code_4).to be_present + expect(facility.zip_code_5).to be_present + end + + def transliterated_without_change(value) + UspsInPersonProofing::Transliterator::TransliterationResult.new( + changed?: false, + original: value, + transliterated: value, + unsupported_chars: [], + ) + end + + def transliterated(value) + UspsInPersonProofing::Transliterator::TransliterationResult.new( + changed?: true, + original: value, + transliterated: "transliterated_#{value}", + unsupported_chars: [], + ) + end + + def transliterated_with_failure(value) + UspsInPersonProofing::Transliterator::TransliterationResult.new( + changed?: true, + original: value, + transliterated: "transliterated_failed_#{value}", + unsupported_chars: [':'], + ) + end +end