diff --git a/spec/features/idv/doc_auth/socure_document_capture_spec.rb b/spec/features/idv/doc_auth/socure_document_capture_spec.rb index 490f97ecc3d..e8b9e2004e7 100644 --- a/spec/features/idv/doc_auth/socure_document_capture_spec.rb +++ b/spec/features/idv/doc_auth/socure_document_capture_spec.rb @@ -27,6 +27,7 @@ @docv_transaction_token = stub_docv_document_request allow(IdentityConfig.store).to receive(:socure_docv_verification_data_test_mode) .and_return(socure_docv_verification_data_test_mode) + allow(IdentityConfig.store).to receive(:doc_auth_max_attempts).and_return(max_attempts) end context 'happy path', allow_browser_log: true do @@ -44,7 +45,6 @@ context 'rate limits calls to backend docauth vendor', 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 @@ -91,6 +91,37 @@ end end + context 'shows the correct attempts on error pages' do + before do + stub_docv_verification_data_fail_with( + docv_transaction_token: @docv_transaction_token, + errors: ['XXXX'], + ) + end + + it 'remaining attempts displayed is properly decremented' do + socure_docv_upload_documents( + docv_transaction_token: @docv_transaction_token, + ) + visit idv_socure_document_capture_update_path + expect(page).to have_content( + strip_tags( + t( + 'doc_auth.rate_limit_warning.plural_html', + remaining_attempts: max_attempts - 1, + ), + ), + ) + + visit idv_socure_document_capture_path + socure_docv_upload_documents( + docv_transaction_token: @docv_transaction_token, + ) + visit idv_socure_document_capture_update_path + expect(page).to have_content(strip_tags(t('doc_auth.rate_limit_warning.singular_html'))) + end + end + context 'reuses valid capture app urls when appropriate', allow_browser_log: true do context 'successfully erases capture app url when flow is complete' do it 'proceeds to the next page with valid info' do