Skip to content
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-15193 verify socure rate limit display decrements correctly #11671

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion spec/features/idv/doc_auth/socure_document_capture_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down