diff --git a/spec/features/idv/analytics_spec.rb b/spec/features/idv/analytics_spec.rb index 203b39d2333..0c3c2ec7838 100644 --- a/spec/features/idv/analytics_spec.rb +++ b/spec/features/idv/analytics_spec.rb @@ -278,7 +278,7 @@ complete_review_step(user) acknowledge_and_confirm_personal_key visit_help_center - visit_sp + visit_sp_from_in_person_ready_to_verify end it 'records all of the events', allow_browser_log: true do diff --git a/spec/features/idv/end_to_end_idv_spec.rb b/spec/features/idv/end_to_end_idv_spec.rb index c6f0f633a02..cacc5ca23bf 100644 --- a/spec/features/idv/end_to_end_idv_spec.rb +++ b/spec/features/idv/end_to_end_idv_spec.rb @@ -2,16 +2,13 @@ RSpec.describe 'Identity verification', :js do include IdvStepHelper + include InPersonHelper - # Needed specs: - # unsupervised proofing happy path mobile only - # hybrid mobile end to end (edit hybrid_mobile_spec) - # verify by mail - # in person proofing + let(:sp) { :oidc } scenario 'Unsupervised proofing happy path desktop' do try_to_skip_ahead_before_signing_in - visit_idp_from_sp_with_ial2(:oidc) + visit_idp_from_sp_with_ial2(sp) user = sign_up_and_2fa_ial1_user validate_welcome_page @@ -50,12 +47,67 @@ validate_personal_key_page acknowledge_and_confirm_personal_key - validate_idv_completed_page + validate_idv_completed_page(user) click_agree_and_continue validate_return_to_sp end + context 'with an sp that allows in person proofing' do + before do + allow(IdentityConfig.store).to receive(:in_person_proofing_enabled).and_return(true) + + ServiceProvider.find_by(issuer: service_provider_issuer(sp)). + update(in_person_proofing_enabled: true) + end + + scenario 'In person proofing verify by mail', allow_browser_log: true do + visit_idp_from_sp_with_ial2(sp) + user = sign_up_and_2fa_ial1_user + + begin_in_person_proofing + complete_all_in_person_proofing_steps(user) + + enter_gpo_flow + gpo_step + + complete_review_step(user) + + validate_come_back_later_page + complete_come_back_later + validate_return_to_sp + + visit sign_out_url + user.reload + + visit_idp_from_sp_with_ial2(sp) + + sign_in_live_with_2fa(user) + + complete_gpo_verification(user) + expect(user.identity_verified?).to be(false) + + acknowledge_and_confirm_personal_key + + expect(page).to have_current_path(idv_in_person_ready_to_verify_path) + visit_sp_from_in_person_ready_to_verify + + visit sign_out_url + user.reload + + mark_in_person_enrollment_passed(user) + + # sign in + visit_idp_from_sp_with_ial2(sp) + sign_in_live_with_2fa(user) + + validate_idv_completed_page(user) + click_agree_and_continue + + validate_return_to_sp + end + end + def validate_welcome_page expect(page).to have_current_path(idv_welcome_path) @@ -220,12 +272,18 @@ def validate_review_submit(user) expect(GpoConfirmation.count).to eq(0) end + def validate_come_back_later_page + expect(page).to have_current_path(idv_come_back_later_path) + expect_in_person_gpo_step_indicator_current_step(t('step_indicator.flows.idv.get_a_letter')) + end + def validate_personal_key_page expect(current_path).to eq idv_personal_key_path expect(page).to have_content(t('forms.personal_key_partial.acknowledgement.header')) end - def validate_idv_completed_page + def validate_idv_completed_page(user) + expect(user.identity_verified?).to be(true) expect(current_path).to eq sign_up_completed_path expect(page).to have_content t( 'titles.sign_up.completion_ial2', diff --git a/spec/features/idv/steps/gpo_step_spec.rb b/spec/features/idv/steps/gpo_step_spec.rb index 739d4777dfb..808c7b83fef 100644 --- a/spec/features/idv/steps/gpo_step_spec.rb +++ b/spec/features/idv/steps/gpo_step_spec.rb @@ -27,14 +27,6 @@ context 'the user has sent a letter but not verified an OTP' do let(:user) { user_with_2fa } - let(:otp) { 'ABC123' } - let(:gpo_confirmation_code) do - create( - :gpo_confirmation_code, - profile: User.find(user.id).pending_profile, - otp_fingerprint: Pii::Fingerprinter.fingerprint(otp), - ) - end it 'allows the user to resend a letter and redirects to the come back later step', :js do complete_idv_and_return_to_gpo_step @@ -64,9 +56,7 @@ expect(page).to have_current_path(idv_gpo_verify_path) # complete verification: end to end gpo test - gpo_confirmation_code - fill_in t('forms.verify_profile.name'), with: otp - click_button t('forms.verify_profile.submit') + complete_gpo_verification(user) expect(user.identity_verified?).to be(true) @@ -77,14 +67,12 @@ it 'does not 500' do create(:profile, :with_pii, user: user, gpo_verification_pending_at: 1.day.ago) create(:piv_cac_configuration, user: user, x509_dn_uuid: 'helloworld', name: 'My PIV Card') - gpo_confirmation_code signin_with_piv(user) fill_in t('account.index.password'), with: user.password click_button t('forms.buttons.submit.default') - fill_in t('forms.verify_profile.name'), with: otp - click_button t('forms.verify_profile.submit') + complete_gpo_verification(user) expect(user.identity_verified?).to be(true) diff --git a/spec/support/features/doc_auth_helper.rb b/spec/support/features/doc_auth_helper.rb index 69126ab51cf..b41033c9835 100644 --- a/spec/support/features/doc_auth_helper.rb +++ b/spec/support/features/doc_auth_helper.rb @@ -149,6 +149,22 @@ def complete_doc_auth_steps_before_link_sent_step click_send_link end + def complete_gpo_verification(user) + otp = 'ABC123' + create( + :gpo_confirmation_code, + profile: User.find(user.id).pending_profile, + otp_fingerprint: Pii::Fingerprinter.fingerprint(otp), + ) + fill_in t('forms.verify_profile.name'), with: otp + click_button t('forms.verify_profile.submit') + end + + def complete_come_back_later + # Exit Login.gov and return to SP + click_on t('idv.cancel.actions.exit', app_name: APP_NAME) + end + def complete_all_doc_auth_steps(expect_accessible: false) complete_doc_auth_steps_before_verify_step(expect_accessible: expect_accessible) complete_verify_step diff --git a/spec/support/features/idv_step_helper.rb b/spec/support/features/idv_step_helper.rb index 448a85b1960..4f14215840b 100644 --- a/spec/support/features/idv_step_helper.rb +++ b/spec/support/features/idv_step_helper.rb @@ -64,8 +64,8 @@ def click_what_to_bring_link click_link t('in_person_proofing.body.barcode.learn_more') end - def visit_sp - click_sp_link + def visit_sp_from_in_person_ready_to_verify + click_sp_link_in_person_ready_to_verify end def sp_friendly_name @@ -76,7 +76,7 @@ def link_text t('in_person_proofing.body.barcode.return_to_partner_link', sp_name: sp_friendly_name) end - def click_sp_link + def click_sp_link_in_person_ready_to_verify expect(page).to have_content(sp_text) click_link(link_text) end diff --git a/spec/support/features/in_person_helper.rb b/spec/support/features/in_person_helper.rb index 01ed1149994..e0358b43b19 100644 --- a/spec/support/features/in_person_helper.rb +++ b/spec/support/features/in_person_helper.rb @@ -220,4 +220,11 @@ def make_pii(same_address_as_id: 'true') pii_from_user[:state] = state pii_from_user[:zipcode] = zipcode end + + def mark_in_person_enrollment_passed(user) + enrollment = user.in_person_enrollments.last + expect(enrollment).to_not be_nil + enrollment.profile.activate_after_passing_in_person + enrollment.update(status: :passed) + end end diff --git a/spec/support/features/session_helper.rb b/spec/support/features/session_helper.rb index 1d5e01617a8..064e8e5f96a 100644 --- a/spec/support/features/session_helper.rb +++ b/spec/support/features/session_helper.rb @@ -158,8 +158,9 @@ def begin_sign_up_with_sp_and_ial(ial2:) def sign_up_and_set_password user = sign_up - fill_in t('forms.password'), with: VALID_PASSWORD - fill_in t('components.password_confirmation.confirm_label'), with: VALID_PASSWORD + user.password = VALID_PASSWORD + fill_in t('forms.password'), with: user.password + fill_in t('components.password_confirmation.confirm_label'), with: user.password click_button t('forms.buttons.continue') user end diff --git a/spec/support/sp_auth_helper.rb b/spec/support/sp_auth_helper.rb index 9ab28ad509f..7d6a41b9784 100644 --- a/spec/support/sp_auth_helper.rb +++ b/spec/support/sp_auth_helper.rb @@ -54,11 +54,7 @@ def create_in_person_ial2_account_go_back_to_sp_and_sign_out(sp) visit sign_out_url user.reload - # Mark IPP as passed - enrollment = user.in_person_enrollments.last - expect(enrollment).to_not be_nil - enrollment.profile.activate_after_passing_in_person - enrollment.update(status: :passed) + mark_in_person_enrollment_passed(user) visit_idp_from_sp_with_ial2(sp)