diff --git a/app/controllers/idv/sessions_controller.rb b/app/controllers/idv/sessions_controller.rb index 529416729e4..51d17250806 100644 --- a/app/controllers/idv/sessions_controller.rb +++ b/app/controllers/idv/sessions_controller.rb @@ -12,6 +12,7 @@ def destroy location: location_params[:location], ) user_session['idv/doc_auth'] = {} + user_session['idv/in_person'] = {} idv_session.clear Pii::Cacher.new(current_user, user_session).delete redirect_to idv_url diff --git a/spec/controllers/idv/sessions_controller_spec.rb b/spec/controllers/idv/sessions_controller_spec.rb index d4a5b1108ff..6d0f7d567b1 100644 --- a/spec/controllers/idv/sessions_controller_spec.rb +++ b/spec/controllers/idv/sessions_controller_spec.rb @@ -17,6 +17,7 @@ allow(idv_session).to receive(:clear) allow(subject).to receive(:idv_session).and_return(idv_session) controller.user_session['idv/doc_auth'] = flow_session + controller.user_session['idv/in_person'] = flow_session controller.user_session[:decrypted_pii] = pii end @@ -26,6 +27,7 @@ delete :destroy expect(controller.user_session['idv/doc_auth']).to be_blank + expect(controller.user_session['idv/in_person']).to be_blank expect(controller.user_session[:decrypted_pii]).to be_blank end diff --git a/spec/features/idv/in_person_spec.rb b/spec/features/idv/in_person_spec.rb index f0bbd0e7599..52137820091 100644 --- a/spec/features/idv/in_person_spec.rb +++ b/spec/features/idv/in_person_spec.rb @@ -17,6 +17,7 @@ it 'works for a happy path', allow_browser_log: true do user = user_with_2fa + sign_in_and_2fa_user(user) begin_in_person_proofing(user) # location page @@ -107,12 +108,26 @@ expect(page).to have_current_path(idv_in_person_ready_to_verify_path) end + it 'allows the user to cancel and start over from the beginning', allow_browser_log: true do + sign_in_and_2fa_user + begin_in_person_proofing + complete_all_in_person_proofing_steps + + click_link t('links.cancel') + click_on t('idv.cancel.actions.start_over') + + expect(page).to have_current_path(idv_doc_auth_welcome_step) + begin_in_person_proofing + complete_all_in_person_proofing_steps + end + context 'verify address by mail (GPO letter)' do before do allow(FeatureManagement).to receive(:reveal_gpo_code?).and_return(true) end it 'requires address verification before showing instructions', allow_browser_log: true do + sign_in_and_2fa_user begin_in_person_proofing complete_all_in_person_proofing_steps click_on t('idv.troubleshooting.options.verify_by_mail') @@ -134,6 +149,7 @@ end it 'lets the user clear and start over from gpo confirmation', allow_browser_log: true do + sign_in_and_2fa_user begin_in_person_proofing complete_all_in_person_proofing_steps click_on t('idv.troubleshooting.options.verify_by_mail') diff --git a/spec/support/features/in_person_helper.rb b/spec/support/features/in_person_helper.rb index 387385c2816..4d028801b0a 100644 --- a/spec/support/features/in_person_helper.rb +++ b/spec/support/features/in_person_helper.rb @@ -34,8 +34,7 @@ def fill_out_address_form_ok choose t('in_person_proofing.form.address.same_address_choice_yes') end - def begin_in_person_proofing(user = user_with_2fa) - sign_in_and_2fa_user(user) + def begin_in_person_proofing(_user = user_with_2fa) complete_doc_auth_steps_before_document_capture_step mock_doc_auth_attention_with_barcode attach_and_submit_images