-
Notifications
You must be signed in to change notification settings - Fork 166
LG-12306: selfie standardflow check #10112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
52bd337
ddba7e8
22bf920
d503f4e
4cd65f9
7990e31
dd2f77c
b8f1931
79022fa
fa1d448
0c2e432
2723c73
e4b9192
4ae1ddf
07618f5
8a5127b
ea59e2f
580cea7
a1f7142
dd0547b
a2f35d2
630ce74
21e1da0
e5940cf
f538ae2
703ba27
d746033
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,6 +108,8 @@ def flow_policy | |
| end | ||
|
|
||
| def confirm_step_allowed | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it worth considering to inject |
||
| # set it everytime, since user may switch SP | ||
| idv_session.selfie_check_required = decorated_sp_session.selfie_required? | ||
|
Comment on lines
111
to
112
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍🏿 |
||
| return if flow_policy.controller_allowed?(controller: self.class) | ||
|
|
||
| redirect_to url_for_latest_step | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -168,6 +168,7 @@ def analytics_arguments | |
| irs_reproofing: irs_reproofing?, | ||
| redo_document_capture: params[:redo] ? true : nil, | ||
| skip_hybrid_handoff: idv_session.skip_hybrid_handoff, | ||
| selfie_check_required: idv_session.selfie_check_required, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍🏿 |
||
| }.merge(ab_test_analytics_buckets) | ||
| end | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,6 +55,7 @@ def analytics_arguments | |
| step: 'document_capture', | ||
| analytics_id: 'Doc Auth', | ||
| irs_reproofing: irs_reproofing?, | ||
| selfie_check_required: decorated_sp_session.selfie_required?, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍🏿 |
||
| }.merge( | ||
| ab_test_analytics_buckets, | ||
| ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,19 +20,52 @@ | |
| { sample_bucket1: :sample_value1, sample_bucket2: :sample_value2 } | ||
| end | ||
|
|
||
| # selfie related test flags | ||
| let(:doc_auth_selfie_capture_enabled) { false } | ||
| let(:sp_selfie_enabled) { false } | ||
| let(:flow_path) { 'standard' } | ||
|
|
||
| before do | ||
| stub_sign_in(user) | ||
| stub_up_to(:hybrid_handoff, idv_session: subject.idv_session) | ||
| stub_analytics | ||
| subject.idv_session.document_capture_session_uuid = document_capture_session_uuid | ||
|
|
||
| allow(controller.decorated_sp_session).to receive(:selfie_required?). | ||
| and_return(doc_auth_selfie_capture_enabled && sp_selfie_enabled) | ||
| subject.idv_session.flow_path = flow_path | ||
| allow(subject).to receive(:ab_test_analytics_buckets).and_return(ab_test_args) | ||
| end | ||
|
|
||
| describe '#step_info' do | ||
| it 'returns a valid StepInfo object' do | ||
| expect(Idv::DocumentCaptureController.step_info).to be_valid | ||
| end | ||
| context 'when selfie feature is enabled system wide' do | ||
| let(:doc_auth_selfie_capture_enabled) { true } | ||
| describe 'with sp selfie disabled' do | ||
| let(:sp_selfie_enabled) { false } | ||
| it 'does not satisfy precondition' do | ||
| expect(Idv::DocumentCaptureController.step_info.preconditions.is_a?(Proc)) | ||
| expect(subject).to receive(:render). | ||
| with(:show, locals: an_instance_of(Hash)).and_call_original | ||
| get :show | ||
| expect(response).to render_template :show | ||
| end | ||
| end | ||
| describe 'with sp selfie enabled' do | ||
| let(:sp_selfie_enabled) { true } | ||
| before do | ||
| allow(IdentityConfig.store).to receive(:doc_auth_selfie_desktop_test_mode). | ||
| and_return(false) | ||
| end | ||
| it 'does satisfy precondition' do | ||
| expect(Idv::DocumentCaptureController.step_info.preconditions.is_a?(Proc)) | ||
| expect(subject).not_to receive(:render).with(:show, locals: an_instance_of(Hash)) | ||
| get :show | ||
| expect(response).to redirect_to(idv_hybrid_handoff_path) | ||
| end | ||
| end | ||
| end | ||
| end | ||
|
|
||
| describe 'before_actions' do | ||
|
|
@@ -61,6 +94,7 @@ | |
| skip_hybrid_handoff: nil, | ||
| irs_reproofing: false, | ||
| step: 'document_capture', | ||
| selfie_check_required: sp_selfie_enabled && doc_auth_selfie_capture_enabled, | ||
| }.merge(ab_test_args) | ||
| end | ||
|
|
||
|
|
@@ -79,23 +113,44 @@ | |
| end | ||
|
|
||
| context 'when a selfie is requested' do | ||
| let(:doc_auth_selfie_capture_enabled) { true } | ||
| let(:sp_selfie_enabled) { true } | ||
| let(:desktop_selfie_enabled) { false } | ||
| before do | ||
| allow(subject).to receive(:decorated_sp_session). | ||
| and_return(double('decorated_session', { selfie_required?: true, sp_name: 'sp' })) | ||
| allow(IdentityConfig.store).to receive(:doc_auth_selfie_desktop_test_mode). | ||
| and_return(desktop_selfie_enabled) | ||
| end | ||
| describe 'when desktop selfie disabled' do | ||
| let(:desktop_selfie_enabled) { false } | ||
| it 'redirect back to handoff page' do | ||
| expect(subject).not_to receive(:render).with( | ||
| :show, | ||
| locals: hash_including( | ||
| document_capture_session_uuid: document_capture_session_uuid, | ||
| doc_auth_selfie_capture: true, | ||
| ), | ||
| ).and_call_original | ||
|
|
||
| get :show | ||
|
|
||
| expect(response).to redirect_to(idv_hybrid_handoff_path) | ||
| end | ||
| end | ||
|
|
||
| it 'renders the show template with selfie' do | ||
| expect(subject).to receive(:render).with( | ||
| :show, | ||
| locals: hash_including( | ||
| document_capture_session_uuid: document_capture_session_uuid, | ||
| doc_auth_selfie_capture: true, | ||
| ), | ||
| ).and_call_original | ||
|
|
||
| get :show | ||
|
|
||
| expect(response).to render_template :show | ||
| describe 'when desktop selfie enabled' do | ||
| let(:desktop_selfie_enabled) { true } | ||
| it 'allows capture' do | ||
| expect(subject).to receive(:render).with( | ||
| :show, | ||
| locals: hash_including( | ||
| document_capture_session_uuid: document_capture_session_uuid, | ||
| doc_auth_selfie_capture: true, | ||
| ), | ||
| ).and_call_original | ||
|
|
||
| get :show | ||
| expect(response).to render_template :show | ||
| end | ||
| end | ||
| end | ||
|
|
||
|
|
@@ -208,6 +263,7 @@ | |
| skip_hybrid_handoff: nil, | ||
| irs_reproofing: false, | ||
| step: 'document_capture', | ||
| selfie_check_required: sp_selfie_enabled && doc_auth_selfie_capture_enabled, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍🏿 |
||
| }.merge(ab_test_args) | ||
| end | ||
| let(:result) { { success: true, errors: {} } } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,18 +13,26 @@ | |
| end | ||
| let(:in_person_proofing) { false } | ||
| let(:ipp_opt_in_enabled) { false } | ||
| let(:doc_auth_selfie_capture_enabled) { false } | ||
| let(:sp_selfie_enabled) { false } | ||
|
|
||
| before do | ||
| allow(controller).to receive(:current_sp). | ||
| and_return(service_provider) | ||
| stub_sign_in(user) | ||
| stub_up_to(:agreement, idv_session: subject.idv_session) | ||
| stub_analytics | ||
| stub_attempts_tracker | ||
| allow(subject).to receive(:ab_test_analytics_buckets).and_return(ab_test_args) | ||
| allow(subject.idv_session).to receive(:service_provider).and_return(service_provider) | ||
| allow(subject.decorated_sp_session).to receive(:selfie_required?). | ||
| and_return(sp_selfie_enabled && doc_auth_selfie_capture_enabled) | ||
| allow(IdentityConfig.store).to receive(:in_person_proofing_enabled) { in_person_proofing } | ||
| allow(IdentityConfig.store).to receive(:in_person_proofing_opt_in_enabled) { | ||
| ipp_opt_in_enabled | ||
| } | ||
| allow(IdentityConfig.store).to receive(:doc_auth_selfie_capture_enabled). | ||
| and_return(doc_auth_selfie_capture_enabled) | ||
| end | ||
|
|
||
| describe '#step_info' do | ||
|
|
@@ -58,6 +66,7 @@ | |
| redo_document_capture: nil, | ||
| skip_hybrid_handoff: nil, | ||
| irs_reproofing: false, | ||
| selfie_check_required: sp_selfie_enabled && doc_auth_selfie_capture_enabled, | ||
| }.merge(ab_test_args) | ||
| end | ||
|
|
||
|
|
@@ -200,6 +209,8 @@ | |
|
|
||
| context 'opt in selection is nil' do | ||
| before do | ||
| allow(IdentityConfig.store).to receive(:doc_auth_selfie_desktop_test_mode). | ||
|
dawei-nava marked this conversation as resolved.
|
||
| and_return(false) | ||
| subject.idv_session.skip_doc_auth = nil | ||
| end | ||
|
|
||
|
|
@@ -221,6 +232,8 @@ | |
|
|
||
| context 'opted in to ipp flow' do | ||
| before do | ||
| allow(IdentityConfig.store).to receive(:doc_auth_selfie_desktop_test_mode). | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dawei-nava - do we still need this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @amirbey removed. |
||
| and_return(false) | ||
| subject.idv_session.skip_doc_auth = true | ||
| end | ||
|
|
||
|
|
@@ -244,6 +257,28 @@ | |
| end | ||
| end | ||
| end | ||
|
|
||
| context 'with selfie enabled system wide' do | ||
| let(:doc_auth_selfie_capture_enabled) { true } | ||
| describe 'when selfie is enabled for sp' do | ||
| let(:sp_selfie_enabled) { true } | ||
| it 'pass on correct flags and states and logs correct info' do | ||
| get :show | ||
| expect(response).to render_template :show | ||
| expect(@analytics).to have_logged_event(analytics_name, analytics_args) | ||
| expect(subject.idv_session.selfie_check_required).to eq(true) | ||
| end | ||
| end | ||
| describe 'when selfie is disabled for sp' do | ||
| let(:sp_selfie_enabled) { false } | ||
| it 'pass on correct flags and states and logs correct info' do | ||
| get :show | ||
| expect(response).to render_template :show | ||
| expect(subject.idv_session.selfie_check_required).to eq(false) | ||
| expect(@analytics).to have_logged_event(analytics_name, analytics_args) | ||
| end | ||
| end | ||
| end | ||
| end | ||
|
|
||
| describe '#update' do | ||
|
|
@@ -260,6 +295,7 @@ | |
| analytics_id: 'Doc Auth', | ||
| redo_document_capture: nil, | ||
| skip_hybrid_handoff: nil, | ||
| selfie_check_required: sp_selfie_enabled && doc_auth_selfie_capture_enabled, | ||
| irs_reproofing: false, | ||
| telephony_response: { | ||
| errors: {}, | ||
|
|
@@ -279,6 +315,10 @@ | |
|
|
||
| let(:document_capture_session_uuid) { '09228b6d-dd39-4925-bf82-b69104095517' } | ||
|
|
||
| before do | ||
| subject.idv_session.document_capture_session_uuid = document_capture_session_uuid | ||
| end | ||
|
|
||
| it 'invalidates future steps' do | ||
| expect(subject).to receive(:clear_future_steps!) | ||
|
|
||
|
|
@@ -292,10 +332,6 @@ | |
| expect(@analytics).to have_logged_event(analytics_name, analytics_args) | ||
| end | ||
|
|
||
| before do | ||
| subject.idv_session.document_capture_session_uuid = document_capture_session_uuid | ||
| end | ||
|
|
||
| it 'sends a doc auth link' do | ||
| expect(Telephony).to receive(:send_doc_auth_link).with( | ||
| hash_including( | ||
|
|
@@ -319,6 +355,7 @@ | |
| redo_document_capture: nil, | ||
| skip_hybrid_handoff: nil, | ||
| irs_reproofing: false, | ||
| selfie_check_required: doc_auth_selfie_capture_enabled && sp_selfie_enabled, | ||
| }.merge(ab_test_args) | ||
| end | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if I'm missing a setup step, but when I check out this branch and try running through the testing steps, I did not see the expected result.
Specifically, on desktop, I was not re-directed to the hybrid handoff page. Instead I was able to continue to the upload page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@night-jellyfish , you have to set
doc_auth_selfie_desktop_test_mode: falseThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh okay. I missed that note somehow. Thanks! I can try again later today if you'd like (quite a few meetings this am) but don't need to block it.