-
Notifications
You must be signed in to change notification settings - Fork 120
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
LG-15321: relax vendor redirect in test mode #11677
base: main
Are you sure you want to change the base?
Changes from 28 commits
56babf7
f609ac7
0540593
2348654
25fce5a
04256f5
2a6562c
50318a6
66cdf8c
8090280
ed14dd5
d6d733e
bd87c2e
cf90e59
68c6905
ce52e96
02910a8
1e5bbfd
4a48c23
1ea142b
7fc03f2
97b41c7
6e767ef
63ea14f
c37a578
ba163f7
58b949e
22e643b
e2fdc7e
4c00cf0
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 |
---|---|---|
|
@@ -211,6 +211,23 @@ | |
expect(document_capture_session.socure_docv_transaction_token) | ||
.to eq(docv_transaction_token) | ||
end | ||
|
||
context 'when we try to use this controller but we should be using the LN/mock version' do | ||
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. Can we add the test where the redirect to correct vendor is enabled, similar to the LN/mock test? 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. spec added to this context .. thanks @solipet 👍🏿 |
||
context 'when redirect to correct vendor is disabled' do | ||
let(:idv_vendor) { Idp::Constants::Vendors::LEXIS_NEXIS } | ||
before do | ||
allow(IdentityConfig.store) | ||
.to receive(:doc_auth_redirect_to_correct_vendor_disabled).and_return(true) | ||
end | ||
|
||
it 'redirects to the Socure controller' do | ||
get :show | ||
|
||
expect(response).to have_http_status 200 | ||
expect(response.body).to have_link(href: socure_capture_app_url) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -293,6 +293,11 @@ | |
docv_transaction_token: @docv_transaction_token, | ||
) | ||
|
||
# Confirm that we end up on the Socure page even if we try to | ||
# go to the LN / Mock one. | ||
visit idv_document_capture_url | ||
expect(page).to have_current_path(idv_socure_document_capture_url) | ||
Comment on lines
+296
to
+299
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. While this does test the redirect logic and avoids the cost of another run through the feature spec, it seems somewhat buried/hidden when included in
I guess we don't really have a test that is specific to the generic happy path? |
||
|
||
visit idv_socure_document_capture_update_path | ||
expect(DocAuthLog.find_by(user_id: @user.id).state).to be_nil | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,9 +68,9 @@ | |
visit idv_link_sent_url | ||
expect(page).to have_current_path(root_url) | ||
|
||
# Confirm that we end up on the LN / Mock page even if we try to | ||
# go to the Socure one. | ||
visit idv_hybrid_mobile_socure_document_capture_url | ||
# Confirm that we end up on the Socure page even if we try to | ||
# go to the LN / Mock one. | ||
visit idv_hybrid_mobile_document_capture_url | ||
Comment on lines
+71
to
+73
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. 🤦 - nice catch! |
||
expect(page).to have_current_path(idv_hybrid_mobile_socure_document_capture_url) | ||
|
||
# Confirm that clicking cancel and then coming back doesn't cause errors | ||
|
@@ -459,56 +459,48 @@ | |
end | ||
|
||
context 'with a network error requesting the capture app url' do | ||
before do | ||
allow_any_instance_of(Faraday::Connection).to receive(:post) | ||
.and_raise(Faraday::ConnectionFailed) | ||
end | ||
|
||
it 'shows the network error page on the phone and the link sent page on the desktop', | ||
js: true do | ||
user = nil | ||
shared_examples 'document request API failure' do | ||
it 'shows the network error page on the phone and the link sent page on the desktop', | ||
js: true do | ||
perform_in_browser(:desktop) do | ||
visit_idp_from_sp_with_ial2(sp) | ||
sign_up_and_2fa_ial1_user | ||
|
||
perform_in_browser(:desktop) do | ||
visit_idp_from_sp_with_ial2(sp) | ||
user = sign_up_and_2fa_ial1_user | ||
complete_doc_auth_steps_before_hybrid_handoff_step | ||
clear_and_fill_in(:doc_auth_phone, phone_number) | ||
click_send_link | ||
end | ||
|
||
complete_doc_auth_steps_before_hybrid_handoff_step | ||
clear_and_fill_in(:doc_auth_phone, phone_number) | ||
click_send_link | ||
end | ||
perform_in_browser(:mobile) do | ||
visit @sms_link | ||
|
||
perform_in_browser(:mobile) do | ||
visit @sms_link | ||
expect(page).to have_text(t('doc_auth.headers.general.network_error')) | ||
expect(page).to have_text(t('doc_auth.errors.general.new_network_error')) | ||
expect(@analytics).to have_logged_event(:idv_socure_document_request_submitted) | ||
end | ||
|
||
expect(page).to have_text(t('doc_auth.headers.general.network_error')) | ||
expect(page).to have_text(t('doc_auth.errors.general.new_network_error')) | ||
expect(@analytics).to have_logged_event(:idv_socure_document_request_submitted) | ||
perform_in_browser(:desktop) do | ||
expect(page).to have_current_path(idv_link_sent_path) | ||
end | ||
end | ||
end | ||
|
||
perform_in_browser(:desktop) do | ||
expect(page).to have_current_path(idv_link_sent_path) | ||
context 'Faraday connection error' do | ||
before do | ||
allow_any_instance_of(Faraday::Connection).to receive(:post) | ||
.and_raise(Faraday::ConnectionFailed) | ||
end | ||
|
||
it_behaves_like 'document request API failure' | ||
end | ||
end | ||
|
||
context 'invalid request', allow_browser_log: true do | ||
context 'getting the capture path w wrong api key' do | ||
context 'invalid request (ie: wrong api key)', allow_browser_log: true do | ||
before do | ||
user = user_with_2fa | ||
visit_idp_from_oidc_sp_with_ial2 | ||
sign_in_and_2fa_user(user) | ||
complete_doc_auth_steps_before_document_capture_step | ||
click_idv_continue | ||
DocAuth::Mock::DocAuthMockClient.reset! | ||
stub_docv_document_request(status: 401) | ||
end | ||
|
||
it 'correctly logs event', js: true do | ||
visit idv_socure_document_capture_path | ||
expect(@analytics).to have_logged_event( | ||
:idv_socure_document_request_submitted, | ||
) | ||
end | ||
it_behaves_like 'document request API failure' | ||
end | ||
end | ||
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.