Skip to content

Commit

Permalink
changelog: Upcoming Features, socure, reuse socure capture app urls
Browse files Browse the repository at this point in the history
  • Loading branch information
AShukla-GSA committed Nov 25, 2024
1 parent 3807b20 commit e052be3
Showing 1 changed file with 98 additions and 0 deletions.
98 changes: 98 additions & 0 deletions spec/features/idv/doc_auth/socure_document_capture_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,99 @@
end
end

context 'reuses valid capture app urls when appropriate', allow_browser_log: true do
before do
allow(IdentityConfig.store).to receive(:doc_auth_max_attempts).and_return(max_attempts)
(max_attempts - 1).times do
socure_docv_upload_documents(docv_transaction_token: @docv_transaction_token)
end
end

context 'successfully erases capture app url when flow is complete' do
before do
DocAuth::Mock::DocAuthMockClient.reset!
end

it 'proceeds to the next page with valid info' do
document_capture_session = DocumentCaptureSession.find_by(user_id: @user.id)
expect(page).to have_current_path(fake_socure_document_capture_app_url)
visit idv_socure_document_capture_path
expect(page).to have_current_path(idv_socure_document_capture_path)
document_capture_session.reload
expect(document_capture_session.socure_docv_capture_app_url).
to eq(fake_socure_document_capture_app_url)
socure_docv_upload_documents(
docv_transaction_token: @docv_transaction_token,
)
document_capture_session.reload
expect(document_capture_session.socure_docv_capture_app_url).to be_nil
end

it 'submits front ID, exits app, reuse capture app url' do
document_capture_session = DocumentCaptureSession.find_by(user_id: @user.id)
expect(page).to have_current_path(fake_socure_document_capture_app_url)
visit idv_socure_document_capture_path
expect(page).to have_current_path(idv_socure_document_capture_path)
document_capture_session.reload
expect(document_capture_session.socure_docv_capture_app_url).
to eq(fake_socure_document_capture_app_url)
socure_docv_send_webhook(
docv_transaction_token: @docv_transaction_token,
event_type: 'DOCUMENT_FRONT_UPLOADED',
)
document_capture_session.reload
expect(document_capture_session.socure_docv_capture_app_url).
to eq(fake_socure_document_capture_app_url)
visit idv_socure_document_capture_path
expect(page).to have_current_path(idv_socure_document_capture_path)
document_capture_session.reload
expect(document_capture_session.socure_docv_capture_app_url).
to eq(fake_socure_document_capture_app_url)
end

it 'decline TOS making session expire, generates new capture app' do
document_capture_session = DocumentCaptureSession.find_by(user_id: @user.id)
expect(page).to have_current_path(fake_socure_document_capture_app_url)
visit idv_socure_document_capture_path
expect(page).to have_current_path(idv_socure_document_capture_path)
document_capture_session.reload
expect(document_capture_session.socure_docv_capture_app_url).
to eq(fake_socure_document_capture_app_url)
socure_docv_send_webhook(
docv_transaction_token: @docv_transaction_token,
event_type: 'SESSION_EXPIRED',
)
document_capture_session.reload
expect(document_capture_session.socure_docv_capture_app_url).to be_nil
visit idv_socure_document_capture_path
expect(page).to have_current_path(idv_socure_document_capture_path)
document_capture_session.reload
expect(document_capture_session.socure_docv_capture_app_url).
to eq(fake_socure_document_capture_app_url)
end
it 'cancel idv making session complete, generates new capture app' do
document_capture_session = DocumentCaptureSession.find_by(user_id: @user.id)
expect(page).to have_current_path(fake_socure_document_capture_app_url)
visit idv_socure_document_capture_path
expect(page).to have_current_path(idv_socure_document_capture_path)
document_capture_session.reload
expect(document_capture_session.socure_docv_capture_app_url).
to eq(fake_socure_document_capture_app_url)
socure_docv_send_webhook(
docv_transaction_token: @docv_transaction_token,
event_type: 'SESSION_COMPLETE',
)
document_capture_session.reload
expect(document_capture_session.socure_docv_capture_app_url).to be_nil
visit idv_socure_document_capture_path
expect(page).to have_current_path(idv_socure_document_capture_path)
document_capture_session.reload
expect(document_capture_session.socure_docv_capture_app_url).
to eq(fake_socure_document_capture_app_url)
end
end
end

# ToDo post LG-14010
context 'network connection errors' do
xit 'catches network connection errors on document request', allow_browser_log: true do
Expand Down Expand Up @@ -131,6 +224,11 @@
socure_docv_upload_documents(
docv_transaction_token: @docv_transaction_token,
)
document_capture_session = DocumentCaptureSession.find_by(user_id: @user.id)
expect(document_capture_session).not_to be_nil
Rails.logger.debug do
"Cpature app url: #{document_capture_session.socure_docv_capture_app_url}"
end
visit idv_socure_document_capture_update_path
expect(page).to have_current_path(idv_ssn_url)

Expand Down

0 comments on commit e052be3

Please sign in to comment.