From ff6d11152472af24ca7637d59aa74339a2b8b8b2 Mon Sep 17 00:00:00 2001 From: Brittany Greaner Date: Mon, 14 Aug 2023 08:49:30 -0700 Subject: [PATCH 01/11] Test that after max retries, see expected heading Originally we were going to test that the tips copy wasn't shown. But now that we're deleting the copy from the repo entirely, expecting the tips not to be shown, in a way, would be keeping the tips in the repo. So instead, we are are adding a test to make sure we see what we expect on the mobile side. Implementation note: We have to freeze time; otherwise the `timeout` will cause the test to flicker. (Example: The test will look for "try again in 6 hours" but the page will say "try again in 5 hours and 59 minutes".) --- .../idv/doc_auth/document_capture_spec.rb | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/spec/features/idv/doc_auth/document_capture_spec.rb b/spec/features/idv/doc_auth/document_capture_spec.rb index c661fe5360b..f6a57cbbc56 100644 --- a/spec/features/idv/doc_auth/document_capture_spec.rb +++ b/spec/features/idv/doc_auth/document_capture_spec.rb @@ -174,6 +174,45 @@ expect(page).to have_current_path(idv_phone_url) end end + + it 'shows a failure message after the maximum amount of retries' do + perform_in_browser(:mobile) do + visit_idp_from_oidc_sp_with_ial2 + sign_in_and_2fa_user(user) + complete_doc_auth_steps_before_document_capture_step + + freeze_time do + timeout = distance_of_time_in_words( + RateLimiter.attempt_window_in_minutes(:idv_doc_auth).minutes, + ) + + final_failure_text = strip_tags( + t( + 'errors.doc_auth.rate_limited_text_html', + timeout: timeout, + ), + ) + + max_attempts.times do |time| + attach_images( + Rails.root.join( + 'spec', 'fixtures', + 'ial2_test_credential_wrong_doc_type.yml' + ), + ) + + submit_images + + if time == max_attempts - 1 + expect(page).to have_content(final_failure_text) + click_idv_exit + else + click_try_again + end + end + end + end + end end def expect_costing_for_document From e4a885d555713ea1d675fe88e8aaa7d971622328 Mon Sep 17 00:00:00 2001 From: Brittany Greaner Date: Tue, 15 Aug 2023 14:41:36 -0700 Subject: [PATCH 02/11] Rm CaptureTroubleshooting and CaptureAdvice --- .../components/capture-advice.jsx | 77 ------------- .../components/capture-troubleshooting.jsx | 55 --------- .../components/capture-advice-spec.jsx | 29 ----- .../capture-troubleshooting-spec.jsx | 104 ------------------ 4 files changed, 265 deletions(-) delete mode 100644 app/javascript/packages/document-capture/components/capture-advice.jsx delete mode 100644 app/javascript/packages/document-capture/components/capture-troubleshooting.jsx delete mode 100644 spec/javascript/packages/document-capture/components/capture-advice-spec.jsx delete mode 100644 spec/javascript/packages/document-capture/components/capture-troubleshooting-spec.jsx diff --git a/app/javascript/packages/document-capture/components/capture-advice.jsx b/app/javascript/packages/document-capture/components/capture-advice.jsx deleted file mode 100644 index 74c0a81a1bf..00000000000 --- a/app/javascript/packages/document-capture/components/capture-advice.jsx +++ /dev/null @@ -1,77 +0,0 @@ -import { useI18n } from '@18f/identity-react-i18n'; -import { getAssetPath } from '@18f/identity-assets'; -import Warning from './warning'; -import DocumentCaptureTroubleshootingOptions from './document-capture-troubleshooting-options'; - -/** @typedef {import('@18f/identity-components/troubleshooting-options').TroubleshootingOption} TroubleshootingOption */ - -/** - * @typedef CaptureAdviceProps - * - * @prop {() => void} onTryAgain - * @prop {boolean} isAssessedAsGlare - * @prop {boolean} isAssessedAsBlurry - */ - -/** - * @param {CaptureAdviceProps} props - */ -function CaptureAdvice({ onTryAgain, isAssessedAsGlare, isAssessedAsBlurry }) { - const { t } = useI18n(); - - return ( - - } - > -

- {isAssessedAsGlare && t('doc_auth.tips.capture_troubleshooting_glare')} - {isAssessedAsBlurry && t('doc_auth.tips.capture_troubleshooting_blurry')}{' '} - {t('doc_auth.tips.capture_troubleshooting_lead')} -

-
    -
  • - {t('doc_auth.tips.capture_troubleshooting_surface_image')} - {t('doc_auth.tips.capture_troubleshooting_surface')} -
  • -
  • - {t('doc_auth.tips.capture_troubleshooting_lighting_image')} - {t('doc_auth.tips.capture_troubleshooting_lighting')} -
  • -
  • - {t('doc_auth.tips.capture_troubleshooting_clean_image')} - {t('doc_auth.tips.capture_troubleshooting_clean')} -
  • -
-
- ); -} - -export default CaptureAdvice; diff --git a/app/javascript/packages/document-capture/components/capture-troubleshooting.jsx b/app/javascript/packages/document-capture/components/capture-troubleshooting.jsx deleted file mode 100644 index b65878113dc..00000000000 --- a/app/javascript/packages/document-capture/components/capture-troubleshooting.jsx +++ /dev/null @@ -1,55 +0,0 @@ -import { useContext, useState } from 'react'; -import { useDidUpdateEffect } from '@18f/identity-react-hooks'; -import { FormStepsContext } from '@18f/identity-form-steps'; -import FailedCaptureAttemptsContext from '../context/failed-capture-attempts'; -import AnalyticsContext from '../context/analytics'; -import CallbackOnMount from './callback-on-mount'; -import CaptureAdvice from './capture-advice'; - -/** @typedef {import('react').ReactNode} ReactNode */ - -/** - * @typedef CaptureTroubleshootingProps - * - * @prop {ReactNode} children - */ - -/** - * @param {CaptureTroubleshootingProps} props - */ -function CaptureTroubleshooting({ children }) { - const { trackEvent } = useContext(AnalyticsContext); - const [didShowTroubleshooting, setDidShowTroubleshooting] = useState(false); - const { failedCaptureAttempts, maxFailedAttemptsBeforeTips, lastAttemptMetadata } = useContext( - FailedCaptureAttemptsContext, - ); - const { onPageTransition } = useContext(FormStepsContext); - useDidUpdateEffect(onPageTransition, [didShowTroubleshooting]); - const { isAssessedAsGlare, isAssessedAsBlurry } = lastAttemptMetadata; - - function onCaptureTipsShown() { - trackEvent('IdV: Capture troubleshooting shown', lastAttemptMetadata); - - onPageTransition(); - } - - function onCaptureTipsDismissed() { - trackEvent('IdV: Capture troubleshooting dismissed'); - - setDidShowTroubleshooting(true); - } - - return failedCaptureAttempts >= maxFailedAttemptsBeforeTips && !didShowTroubleshooting ? ( - - - - ) : ( - <>{children} - ); -} - -export default CaptureTroubleshooting; diff --git a/spec/javascript/packages/document-capture/components/capture-advice-spec.jsx b/spec/javascript/packages/document-capture/components/capture-advice-spec.jsx deleted file mode 100644 index 4f8be728db4..00000000000 --- a/spec/javascript/packages/document-capture/components/capture-advice-spec.jsx +++ /dev/null @@ -1,29 +0,0 @@ -import userEvent from '@testing-library/user-event'; -import sinon from 'sinon'; -import { AnalyticsContext } from '@18f/identity-document-capture'; -import CaptureAdvice from '@18f/identity-document-capture/components/capture-advice'; -import { render } from '../../../support/document-capture'; - -describe('document-capture/components/capture-advice', () => { - it('logs warning events', async () => { - const trackEvent = sinon.spy(); - - const { getByRole } = render( - - {}} /> - , - ); - - expect(trackEvent).to.have.been.calledWith('IdV: warning shown', { - location: 'doc_auth_capture_advice', - remaining_attempts: undefined, - }); - - const button = getByRole('button'); - await userEvent.click(button); - - expect(trackEvent).to.have.been.calledWith('IdV: warning action triggered', { - location: 'doc_auth_capture_advice', - }); - }); -}); diff --git a/spec/javascript/packages/document-capture/components/capture-troubleshooting-spec.jsx b/spec/javascript/packages/document-capture/components/capture-troubleshooting-spec.jsx deleted file mode 100644 index 10e6e9b8419..00000000000 --- a/spec/javascript/packages/document-capture/components/capture-troubleshooting-spec.jsx +++ /dev/null @@ -1,104 +0,0 @@ -import sinon from 'sinon'; -import { useContext } from 'react'; -import userEvent from '@testing-library/user-event'; -import { - AnalyticsContext, - FailedCaptureAttemptsContext, - FailedCaptureAttemptsContextProvider, -} from '@18f/identity-document-capture'; -import CaptureTroubleshooting from '@18f/identity-document-capture/components/capture-troubleshooting'; -import { FormStepsContext } from '@18f/identity-form-steps'; -import { render } from '../../../support/document-capture'; - -describe('document-capture/context/capture-troubleshooting', () => { - it('shows children by default if not exceeded max failed attempts', () => { - const { getByText } = render( - - Default children - , - ); - - expect(getByText('Default children')).to.be.ok(); - }); - - it('shows capture advice if exceeded max failed attempts', () => { - const { getByText } = render( - - Default children - , - ); - - expect(() => getByText('Default children')).to.throw(); - expect(getByText('doc_auth.headings.capture_troubleshooting_tips')).to.be.ok(); - }); - - it('shows children again after clicking try again', async () => { - const { getByRole, getByText } = render( - - Default children - , - ); - - const tryAgainButton = getByRole('button', { name: 'idv.failure.button.warning' }); - await userEvent.click(tryAgainButton); - - expect(getByText('Default children')).to.be.ok(); - }); - - it('triggers content resets', async () => { - const onPageTransition = sinon.spy(); - function FailButton() { - return ( - - ); - } - const { getByRole } = render( - - - - - - - , - ); - - expect(onPageTransition).not.to.have.been.called(); - - const failButton = getByRole('button', { name: 'Fail' }); - await userEvent.click(failButton); - expect(onPageTransition).to.have.been.calledOnce(); - - const tryAgainButton = getByRole('button', { name: 'idv.failure.button.warning' }); - await userEvent.click(tryAgainButton); - expect(onPageTransition).to.have.been.calledTwice(); - }); - - it('logs events', async () => { - const trackEvent = sinon.spy(); - const { getByRole } = render( - - - Default children - - , - ); - - expect(trackEvent).to.have.been.calledTwice(); - expect(trackEvent).to.have.been.calledWith('IdV: Capture troubleshooting shown', { - isAssessedAsGlare: false, - isAssessedAsBlurry: false, - isAssessedAsUnsupported: false, - }); - - const tryAgainButton = getByRole('button', { name: 'idv.failure.button.warning' }); - await userEvent.click(tryAgainButton); - - expect(trackEvent.callCount).to.equal(4); - expect(trackEvent).to.have.been.calledWith('IdV: Capture troubleshooting dismissed'); - }); -}); From e63223f90e8f13e8e7883016dc1b6cb39e1dcf59 Mon Sep 17 00:00:00 2001 From: Brittany Greaner Date: Tue, 15 Aug 2023 14:41:21 -0700 Subject: [PATCH 03/11] Rm places calling CaptureTroubleshooting Includes removing imports that are now unused within the spec file --- .../components/documents-step.jsx | 5 +- .../components/documents-step-spec.jsx | 49 +------------------ 2 files changed, 3 insertions(+), 51 deletions(-) diff --git a/app/javascript/packages/document-capture/components/documents-step.jsx b/app/javascript/packages/document-capture/components/documents-step.jsx index 2ced6fbccdb..c00035b2e74 100644 --- a/app/javascript/packages/document-capture/components/documents-step.jsx +++ b/app/javascript/packages/document-capture/components/documents-step.jsx @@ -7,7 +7,6 @@ import HybridDocCaptureWarning from './hybrid-doc-capture-warning'; import DocumentSideAcuantCapture from './document-side-acuant-capture'; import DeviceContext from '../context/device'; import UploadContext from '../context/upload'; -import CaptureTroubleshooting from './capture-troubleshooting'; import DocumentCaptureTroubleshootingOptions from './document-capture-troubleshooting-options'; import TipList from './tip-list'; @@ -47,7 +46,7 @@ function DocumentsStep({ const { flowPath } = useContext(UploadContext); return ( - +
{flowPath === 'hybrid' && } {t('doc_auth.headings.document_capture')}

{t('doc_auth.info.document_capture_intro_acknowledgment')}

@@ -73,7 +72,7 @@ function DocumentsStep({ {isLastStep ? : } - +
); } diff --git a/spec/javascript/packages/document-capture/components/documents-step-spec.jsx b/spec/javascript/packages/document-capture/components/documents-step-spec.jsx index eaaf5941bcd..11b2239ab51 100644 --- a/spec/javascript/packages/document-capture/components/documents-step-spec.jsx +++ b/spec/javascript/packages/document-capture/components/documents-step-spec.jsx @@ -4,18 +4,13 @@ import { t } from '@18f/identity-i18n'; import { DeviceContext, ServiceProviderContextProvider, - FailedCaptureAttemptsContextProvider, - AcuantContextProvider, UploadContextProvider, } from '@18f/identity-document-capture'; import DocumentsStep from '@18f/identity-document-capture/components/documents-step'; -import { AcuantDocumentType } from '@18f/identity-document-capture/components/acuant-camera'; -import { render, useAcuant } from '../../../support/document-capture'; +import { render } from '../../../support/document-capture'; import { getFixtureFile } from '../../../support/file'; describe('document-capture/components/documents-step', () => { - const { initialize } = useAcuant(); - it('renders with front and back inputs', () => { const { getByLabelText } = render(); @@ -55,48 +50,6 @@ describe('document-capture/components/documents-step', () => { expect(() => getByText('doc_auth.tips.document_capture_id_text4')).not.to.throw(); }); - it('renders additional tips after failed attempts', async () => { - const { getByLabelText, getByText, findByRole } = render( - - - - {}} /> - - - , - ); - - initialize(); - const result = { sharpness: 100, image: { data: '' }, cardType: AcuantDocumentType.ID }; - - window.AcuantCameraUI.start.callsFake(({ onCropped }) => onCropped({ ...result, glare: 10 })); - await userEvent.click(getByLabelText('doc_auth.headings.document_capture_front')); - - // Reset after successful attempt. - window.AcuantCameraUI.start.callsFake(({ onCropped }) => onCropped({ ...result, glare: 80 })); - await userEvent.click(getByLabelText('doc_auth.headings.document_capture_front')); - - // Fail twice more to trigger troubleshooting. - window.AcuantCameraUI.start.callsFake(({ onCropped }) => onCropped({ ...result, glare: 10 })); - await userEvent.click(getByLabelText('doc_auth.headings.document_capture_front')); - await userEvent.click(getByLabelText('doc_auth.headings.document_capture_front')); - - getByText( - 'doc_auth.tips.capture_troubleshooting_glare doc_auth.tips.capture_troubleshooting_lead', - ); - - await userEvent.click(await findByRole('button', { name: 'idv.failure.button.warning' })); - - // Only show troubleshooting a single time, even after 2 more failed attempts. - await userEvent.click(getByLabelText('doc_auth.headings.document_capture_front')); - await userEvent.click(getByLabelText('doc_auth.headings.document_capture_front')); - expect(() => - getByText( - 'doc_auth.tips.capture_troubleshooting_glare doc_auth.tips.capture_troubleshooting_lead', - ), - ).to.throw(); - }); - it('renders troubleshooting options', () => { const { getByRole } = render( Date: Tue, 15 Aug 2023 14:21:04 -0700 Subject: [PATCH 04/11] Rm config --- .../context/failed-capture-attempts.tsx | 8 ----- app/javascript/packs/document-capture.tsx | 3 -- .../idv/shared/_document_capture.html.erb | 1 - config/application.yml.default | 1 - lib/identity_config.rb | 1 - .../context/failed-capture-attempts-spec.jsx | 30 +++++-------------- 6 files changed, 8 insertions(+), 36 deletions(-) diff --git a/app/javascript/packages/document-capture/context/failed-capture-attempts.tsx b/app/javascript/packages/document-capture/context/failed-capture-attempts.tsx index b55935a7091..378e6f5b5b9 100644 --- a/app/javascript/packages/document-capture/context/failed-capture-attempts.tsx +++ b/app/javascript/packages/document-capture/context/failed-capture-attempts.tsx @@ -25,10 +25,6 @@ interface FailedCaptureAttemptsContextInterface { */ onFailedSubmissionAttempt: () => void; - /** - * Number of failed attempts before showing tips - */ - maxFailedAttemptsBeforeTips: number; /** * The maximum number of failed Acuant capture attempts * before use of the native camera option is triggered @@ -78,7 +74,6 @@ const FailedCaptureAttemptsContext = createContext {}, maxCaptureAttemptsBeforeNativeCamera: Infinity, maxSubmissionAttemptsBeforeNativeCamera: Infinity, - maxFailedAttemptsBeforeTips: Infinity, lastAttemptMetadata: DEFAULT_LAST_ATTEMPT_METADATA, forceNativeCamera: false, }); @@ -87,14 +82,12 @@ FailedCaptureAttemptsContext.displayName = 'FailedCaptureAttemptsContext'; interface FailedCaptureAttemptsContextProviderProps { children: ReactNode; - maxFailedAttemptsBeforeTips: number; maxCaptureAttemptsBeforeNativeCamera: number; maxSubmissionAttemptsBeforeNativeCamera: number; } function FailedCaptureAttemptsContextProvider({ children, - maxFailedAttemptsBeforeTips, maxCaptureAttemptsBeforeNativeCamera, maxSubmissionAttemptsBeforeNativeCamera, }: FailedCaptureAttemptsContextProviderProps) { @@ -128,7 +121,6 @@ function FailedCaptureAttemptsContextProvider({ onFailedSubmissionAttempt, maxCaptureAttemptsBeforeNativeCamera, maxSubmissionAttemptsBeforeNativeCamera, - maxFailedAttemptsBeforeTips, lastAttemptMetadata, forceNativeCamera, }} diff --git a/app/javascript/packs/document-capture.tsx b/app/javascript/packs/document-capture.tsx index d70821ccd6e..40d5a17fa5a 100644 --- a/app/javascript/packs/document-capture.tsx +++ b/app/javascript/packs/document-capture.tsx @@ -24,7 +24,6 @@ import type { FlowPath, DeviceContextValue } from '@18f/identity-document-captur */ interface AppRootData { helpCenterRedirectUrl: string; - maxCaptureAttemptsBeforeTips: string; maxAttemptsBeforeNativeCamera: string; acuantSdkUpgradeABTestingEnabled: string; useAlternateSdk: string; @@ -72,7 +71,6 @@ const formData: Record = { const { helpCenterRedirectUrl: helpCenterRedirectURL, - maxCaptureAttemptsBeforeTips, maxCaptureAttemptsBeforeNativeCamera, maxSubmissionAttemptsBeforeNativeCamera, acuantVersion, @@ -142,7 +140,6 @@ const App = composeComponents( [ FailedCaptureAttemptsContextProvider, { - maxFailedAttemptsBeforeTips: Number(maxCaptureAttemptsBeforeTips), maxCaptureAttemptsBeforeNativeCamera: Number(maxCaptureAttemptsBeforeNativeCamera), maxSubmissionAttemptsBeforeNativeCamera: Number(maxSubmissionAttemptsBeforeNativeCamera), }, diff --git a/app/views/idv/shared/_document_capture.html.erb b/app/views/idv/shared/_document_capture.html.erb index 75c74637e52..41b1b41d88d 100644 --- a/app/views/idv/shared/_document_capture.html.erb +++ b/app/views/idv/shared/_document_capture.html.erb @@ -18,7 +18,6 @@ glare_threshold: IdentityConfig.store.doc_auth_client_glare_threshold, sharpness_threshold: IdentityConfig.store.doc_auth_client_sharpness_threshold, status_poll_interval_ms: IdentityConfig.store.poll_rate_for_verify_in_seconds * 1000, - max_capture_attempts_before_tips: IdentityConfig.store.doc_auth_max_capture_attempts_before_tips, max_capture_attempts_before_native_camera: IdentityConfig.store.doc_auth_max_capture_attempts_before_native_camera, max_submission_attempts_before_native_camera: IdentityConfig.store.doc_auth_max_submission_attempts_before_native_camera, acuant_sdk_upgrade_a_b_testing_enabled: acuant_sdk_upgrade_a_b_testing_enabled, diff --git a/config/application.yml.default b/config/application.yml.default index da29cc78035..53c502edb8c 100644 --- a/config/application.yml.default +++ b/config/application.yml.default @@ -90,7 +90,6 @@ doc_auth_error_dpi_threshold: 290 doc_auth_error_glare_threshold: 40 doc_auth_error_sharpness_threshold: 40 doc_auth_max_attempts: 5 -doc_auth_max_capture_attempts_before_tips: 20 doc_auth_max_capture_attempts_before_native_camera: 3 doc_auth_max_submission_attempts_before_native_camera: 3 doc_capture_request_valid_for_minutes: 15 diff --git a/lib/identity_config.rb b/lib/identity_config.rb index 49eceb82c3f..78f1b56f4d6 100644 --- a/lib/identity_config.rb +++ b/lib/identity_config.rb @@ -189,7 +189,6 @@ def self.build_store(config_map) config.add(:doc_auth_extend_timeout_by_minutes, type: :integer) config.add(:doc_auth_max_attempts, type: :integer) config.add(:doc_auth_max_capture_attempts_before_native_camera, type: :integer) - config.add(:doc_auth_max_capture_attempts_before_tips, type: :integer) config.add(:doc_auth_max_submission_attempts_before_native_camera, type: :integer) config.add(:doc_auth_s3_request_timeout, type: :integer) config.add(:doc_auth_vendor, type: :string) diff --git a/spec/javascript/packages/document-capture/context/failed-capture-attempts-spec.jsx b/spec/javascript/packages/document-capture/context/failed-capture-attempts-spec.jsx index f73218e9c2a..c40ae2483df 100644 --- a/spec/javascript/packages/document-capture/context/failed-capture-attempts-spec.jsx +++ b/spec/javascript/packages/document-capture/context/failed-capture-attempts-spec.jsx @@ -21,7 +21,6 @@ describe('document-capture/context/failed-capture-attempts', () => { 'onFailedCaptureAttempt', 'onFailedSubmissionAttempt', 'onResetFailedCaptureAttempts', - 'maxFailedAttemptsBeforeTips', 'maxCaptureAttemptsBeforeNativeCamera', 'maxSubmissionAttemptsBeforeNativeCamera', 'lastAttemptMetadata', @@ -31,7 +30,6 @@ describe('document-capture/context/failed-capture-attempts', () => { expect(result.current.onFailedSubmissionAttempt).to.be.a('function'); expect(result.current.onFailedCaptureAttempt).to.be.a('function'); expect(result.current.onResetFailedCaptureAttempts).to.be.a('function'); - expect(result.current.maxFailedAttemptsBeforeTips).to.be.a('number'); expect(result.current.maxCaptureAttemptsBeforeNativeCamera).to.be.a('number'); expect(result.current.lastAttemptMetadata).to.be.an('object'); }); @@ -40,9 +38,7 @@ describe('document-capture/context/failed-capture-attempts', () => { it('sets increments on onFailedCaptureAttempt', () => { const { result } = renderHook(() => useContext(FailedCaptureAttemptsContext), { wrapper: ({ children }) => ( - - {children} - + {children} ), }); @@ -53,7 +49,7 @@ describe('document-capture/context/failed-capture-attempts', () => { it('sets metadata from onFailedCaptureAttempt', () => { const { result } = renderHook(() => useContext(FailedCaptureAttemptsContext), { - wrapper: ({ children }) => {children}, + wrapper: ({ children }) => {children}, }); const metadata = { isAssessedAsGlare: true, isAssessedAsBlurry: false }; @@ -69,9 +65,7 @@ describe('FailedCaptureAttemptsContext testing of forceNativeCamera logic', () = it('Updating to a number of failed captures less than maxCaptureAttemptsBeforeNativeCamera will keep forceNativeCamera as false', () => { const { result, rerender } = renderHook(() => useContext(FailedCaptureAttemptsContext), { wrapper: ({ children }) => ( - - {children} - + {children} ), }); result.current.onFailedCaptureAttempt({ @@ -86,9 +80,7 @@ describe('FailedCaptureAttemptsContext testing of forceNativeCamera logic', () = it('Updating to a number of failed submissions less than maxSubmissionAttemptsBeforeNativeCamera will keep forceNativeCamera as false', () => { const { result, rerender } = renderHook(() => useContext(FailedCaptureAttemptsContext), { wrapper: ({ children }) => ( - - {children} - + {children} ), }); result.current.onFailedSubmissionAttempt(); @@ -100,9 +92,7 @@ describe('FailedCaptureAttemptsContext testing of forceNativeCamera logic', () = it('Updating failed captures to a number gte the maxCaptureAttemptsBeforeNativeCamera will set forceNativeCamera to true', () => { const { result, rerender } = renderHook(() => useContext(FailedCaptureAttemptsContext), { wrapper: ({ children }) => ( - - {children} - + {children} ), }); result.current.onFailedCaptureAttempt({ @@ -129,9 +119,7 @@ describe('FailedCaptureAttemptsContext testing of forceNativeCamera logic', () = it('Updating failed submissions to a number gte the maxSubmissionAttemptsBeforeNativeCamera will set forceNativeCamera to true', () => { const { result, rerender } = renderHook(() => useContext(FailedCaptureAttemptsContext), { wrapper: ({ children }) => ( - - {children} - + {children} ), }); result.current.onFailedSubmissionAttempt(); @@ -152,7 +140,6 @@ describe('FailedCaptureAttemptsContext testing of forceNativeCamera logic', () = {children} @@ -189,7 +176,7 @@ describe('maxCaptureAttemptsBeforeNativeCamera logging tests', () => { - + {acuantCaptureComponent} {children} @@ -218,7 +205,7 @@ describe('maxCaptureAttemptsBeforeNativeCamera logging tests', () => { - + {acuantCaptureComponent} {children} @@ -248,7 +235,6 @@ describe('maxCaptureAttemptsBeforeNativeCamera logging tests', () => { {acuantCaptureComponent} {children} From 8953b5fcf47a088f93843a4d2693be55cce70207 Mon Sep 17 00:00:00 2001 From: Brittany Greaner Date: Tue, 15 Aug 2023 15:00:27 -0700 Subject: [PATCH 05/11] Rm troubleshooting tips copy --- config/locales/doc_auth/en.yml | 13 ------------- config/locales/doc_auth/es.yml | 15 --------------- config/locales/doc_auth/fr.yml | 16 ---------------- 3 files changed, 44 deletions(-) diff --git a/config/locales/doc_auth/en.yml b/config/locales/doc_auth/en.yml index 3aede3dfe7f..9a0ed82f110 100644 --- a/config/locales/doc_auth/en.yml +++ b/config/locales/doc_auth/en.yml @@ -129,7 +129,6 @@ en: information below is incorrect, please %{link_html} of your state‑issued ID. capture_scan_warning_link: upload new photos - capture_troubleshooting_tips: Having trouble adding your state‑issued ID? document_capture: Add photos of your ID document_capture_back: Back of your ID document_capture_front: Front of your ID @@ -225,18 +224,6 @@ en: address. This takes about 3 to 7 business days.' welcome: 'You will need your:' tips: - capture_troubleshooting_blurry: The photo you added is too blurry. - capture_troubleshooting_clean: Make sure that the barcode is not damaged or - dirty and all the information on your ID can be read. - capture_troubleshooting_clean_image: Back of an ID - capture_troubleshooting_glare: The photo you added has glare. - capture_troubleshooting_lead: 'Here are some tips for taking a successful photo:' - capture_troubleshooting_lighting: Make sure there is plenty of light. Indirect - sunlight is best. Avoid glares, shadows and reflections. - capture_troubleshooting_lighting_image: Sun with a cloud - capture_troubleshooting_surface: Take a photo on a flat surface with a dark - background. Make sure the edges of your ID are clear. - capture_troubleshooting_surface_image: Front of an ID document_capture_header_text: 'For best results:' document_capture_hint: Must be a JPG or PNG document_capture_id_text1: Use a dark background diff --git a/config/locales/doc_auth/es.yml b/config/locales/doc_auth/es.yml index 9c58485dc0c..37e96066ac6 100644 --- a/config/locales/doc_auth/es.yml +++ b/config/locales/doc_auth/es.yml @@ -154,7 +154,6 @@ es: información que aparece a continuación es incorrecta, por favor, %{link_html} de su ID emitido por el estado. capture_scan_warning_link: suba nuevas fotos - capture_troubleshooting_tips: '¿Tiene problemas para agregar su identificación emitida por el estado?' document_capture: Incluir fotos de su identificación document_capture_back: Parte trasera de su documento de identidad document_capture_front: Parte delantera de su documento de identidad @@ -258,20 +257,6 @@ es: domicilio. Esto tarda entre 3 y 7 días laborables.' welcome: 'Necesitará su:' tips: - capture_troubleshooting_blurry: La foto que adjuntó está demasiado borrosa. - capture_troubleshooting_clean: Asegúrese de que el código de barras no esté - dañado o sucio y que se pueda leer toda la información de su - identificación. - capture_troubleshooting_clean_image: Parte posterior de un documento de identidad - capture_troubleshooting_glare: La foto que adjuntó tiene destellos. - capture_troubleshooting_lead: 'Estos son algunos consejos para tomar una buena foto:' - capture_troubleshooting_lighting: Asegúrese de que haya suficiente luz. Lo mejor - es usar luz solar indirecta. Evite destellos, sombras y reflejos. - capture_troubleshooting_lighting_image: Sol con nube - capture_troubleshooting_surface: Tome la foto en una superficie plana y con un - fondo oscuro. Asegúrese de que los bordes de su identificación sean - visibles. - capture_troubleshooting_surface_image: Parte frontal de un documento de identidad document_capture_header_text: 'Para obtener los mejores resultados:' document_capture_hint: Debe ser un JPG o PNG document_capture_id_text1: Use un fondo oscuro diff --git a/config/locales/doc_auth/fr.yml b/config/locales/doc_auth/fr.yml index 4f990b3a734..1a2c9ce03a2 100644 --- a/config/locales/doc_auth/fr.yml +++ b/config/locales/doc_auth/fr.yml @@ -161,7 +161,6 @@ fr: pièce d’identité. Si les informations ci-dessous sont incorrectes, veuillez %{link_html} de votre carte d’identité délivrée par l’État. capture_scan_warning_link: télécharger de nouvelles photos - capture_troubleshooting_tips: Vous rencontrez des difficultés pour ajouter votre pièce d’identité? document_capture: Ajoutez des photos de votre pièce d’identité document_capture_back: Verso de votre carte d’identité document_capture_front: Recto de votre carte d’identité @@ -268,21 +267,6 @@ fr: ouvrables.' welcome: 'Vous aurez besoin de votre:' tips: - capture_troubleshooting_blurry: La photo que vous avez ajoutée est trop floue. - capture_troubleshooting_clean: Assurez-vous que le code-barres ne soit pas - endommagé ou sale et que toutes les informations figurant sur votre - pièce d’identité soient lisibles. - capture_troubleshooting_clean_image: Verso de la carte d’identité - capture_troubleshooting_glare: La photo que vous avez ajoutée est éblouissante. - capture_troubleshooting_lead: 'Voici quelques conseils pour réussir votre photo:' - capture_troubleshooting_lighting: Assurez-vous que la luminosité soit - suffisante. La lumière indirecte du soleil est la meilleure. Évitez les - éblouissements, les ombres et les reflets. - capture_troubleshooting_lighting_image: Soleil avec nuage - capture_troubleshooting_surface: Prenez une photo sur une surface plane avec un - fond sombre. Assurez-vous que les bords de votre pièce d’identité soient - dégagés. - capture_troubleshooting_surface_image: Recto de la carte d’identité document_capture_header_text: 'Pour obtenir les meilleurs résultats:' document_capture_hint: Doit être un JPG ou PNG document_capture_id_text1: Utilisez un fond sombre From cc1784535e216e9bb8f152e28f88608f6925e7f0 Mon Sep 17 00:00:00 2001 From: Brittany Greaner Date: Wed, 16 Aug 2023 11:27:28 -0700 Subject: [PATCH 06/11] changelog: Internal, Doc Auth, Delete CaptureTroubleshooting Component and update tests From e383b3161c510662234f42359de319b78a743f72 Mon Sep 17 00:00:00 2001 From: Brittany Greaner Date: Wed, 16 Aug 2023 14:06:39 -0700 Subject: [PATCH 07/11] Remove unused var found by CI --- config/locales/idv/en.yml | 1 - config/locales/idv/es.yml | 1 - config/locales/idv/fr.yml | 1 - 3 files changed, 3 deletions(-) diff --git a/config/locales/idv/en.yml b/config/locales/idv/en.yml index 904b50b20d0..53349bd78e9 100644 --- a/config/locales/idv/en.yml +++ b/config/locales/idv/en.yml @@ -280,7 +280,6 @@ en: headings: missing_required_items: Are you missing one of these items? need_assistance: 'Need immediate assistance? Here’s how to get help:' - still_having_trouble: Still having trouble? options: contact_support: Contact %{app_name} Support doc_capture_tips: More tips for adding photos of your ID diff --git a/config/locales/idv/es.yml b/config/locales/idv/es.yml index dfc31224ba7..2f6cdba337f 100644 --- a/config/locales/idv/es.yml +++ b/config/locales/idv/es.yml @@ -291,7 +291,6 @@ es: headings: missing_required_items: '¿Le falta alguno de estos puntos?' need_assistance: '¿Necesita ayuda inmediata? Así es como puede obtener ayuda:' - still_having_trouble: '¿Sigue teniendo dificultades?' options: contact_support: Póngase en contacto con el servicio de asistencia de %{app_name} doc_capture_tips: Más consejos para agregar fotos de su identificación diff --git a/config/locales/idv/fr.yml b/config/locales/idv/fr.yml index b7eab6d861f..47316f25155 100644 --- a/config/locales/idv/fr.yml +++ b/config/locales/idv/fr.yml @@ -311,7 +311,6 @@ fr: missing_required_items: Est-ce qu’il vous manque un de ces éléments? need_assistance: 'Avez-vous besoin d’une assistance immédiate? Voici comment obtenir de l’aide:' - still_having_trouble: Vous rencontrez toujours des difficultés? options: contact_support: Contacter le service d’assistance de %{app_name} doc_capture_tips: Plus de conseils pour ajouter des photos de votre carte d’identité From 043e5eab23c442fc46a00ad1662bb1f3797af42d Mon Sep 17 00:00:00 2001 From: Brittany Greaner Date: Wed, 16 Aug 2023 14:06:50 -0700 Subject: [PATCH 08/11] Add allow_browser_log back into test Initially I found I needed this when I had the test running in the desktop context. But when I ran the test in the mobile context, I didn't seem to need it. I just saw the test flicker again with a console log error, so I am adding it back in to guard against future flickering. --- spec/features/idv/doc_auth/document_capture_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/idv/doc_auth/document_capture_spec.rb b/spec/features/idv/doc_auth/document_capture_spec.rb index f6a57cbbc56..b260f3b19ba 100644 --- a/spec/features/idv/doc_auth/document_capture_spec.rb +++ b/spec/features/idv/doc_auth/document_capture_spec.rb @@ -175,7 +175,7 @@ end end - it 'shows a failure message after the maximum amount of retries' do + it 'shows a failure message after the maximum amount of retries', allow_browser_log: true do perform_in_browser(:mobile) do visit_idp_from_oidc_sp_with_ial2 sign_in_and_2fa_user(user) From 54899c54440fe214d91017e860c9c53acf5865ae Mon Sep 17 00:00:00 2001 From: Brittany Greaner Date: Wed, 16 Aug 2023 15:34:11 -0700 Subject: [PATCH 09/11] Rm unused svg files --- app/assets/images/idv/capture-tips-clean.svg | 1 - app/assets/images/idv/capture-tips-lighting.svg | 1 - app/assets/images/idv/capture-tips-surface.svg | 1 - 3 files changed, 3 deletions(-) delete mode 100644 app/assets/images/idv/capture-tips-clean.svg delete mode 100644 app/assets/images/idv/capture-tips-lighting.svg delete mode 100644 app/assets/images/idv/capture-tips-surface.svg diff --git a/app/assets/images/idv/capture-tips-clean.svg b/app/assets/images/idv/capture-tips-clean.svg deleted file mode 100644 index 4a2211ea7e0..00000000000 --- a/app/assets/images/idv/capture-tips-clean.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/assets/images/idv/capture-tips-lighting.svg b/app/assets/images/idv/capture-tips-lighting.svg deleted file mode 100644 index d29950af403..00000000000 --- a/app/assets/images/idv/capture-tips-lighting.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/assets/images/idv/capture-tips-surface.svg b/app/assets/images/idv/capture-tips-surface.svg deleted file mode 100644 index 5a9bcb6edf9..00000000000 --- a/app/assets/images/idv/capture-tips-surface.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file From 4922146e115f74dced0e45a93f162b28a5ec349a Mon Sep 17 00:00:00 2001 From: Brittany Greaner Date: Wed, 16 Aug 2023 15:38:20 -0700 Subject: [PATCH 10/11] Use fragment instead of div --- .../packages/document-capture/components/documents-step.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/javascript/packages/document-capture/components/documents-step.jsx b/app/javascript/packages/document-capture/components/documents-step.jsx index c00035b2e74..1f13d73ec34 100644 --- a/app/javascript/packages/document-capture/components/documents-step.jsx +++ b/app/javascript/packages/document-capture/components/documents-step.jsx @@ -46,7 +46,7 @@ function DocumentsStep({ const { flowPath } = useContext(UploadContext); return ( -
+ <> {flowPath === 'hybrid' && } {t('doc_auth.headings.document_capture')}

{t('doc_auth.info.document_capture_intro_acknowledgment')}

@@ -72,7 +72,7 @@ function DocumentsStep({ {isLastStep ? : } -
+ ); } From 3bf8136ae4ba7e1e222363b09ef5bb804daaa696 Mon Sep 17 00:00:00 2001 From: Brittany Greaner Date: Thu, 17 Aug 2023 14:12:15 -0700 Subject: [PATCH 11/11] Delete redundant test --- .../idv/doc_auth/document_capture_spec.rb | 39 ------------------- 1 file changed, 39 deletions(-) diff --git a/spec/features/idv/doc_auth/document_capture_spec.rb b/spec/features/idv/doc_auth/document_capture_spec.rb index b260f3b19ba..c661fe5360b 100644 --- a/spec/features/idv/doc_auth/document_capture_spec.rb +++ b/spec/features/idv/doc_auth/document_capture_spec.rb @@ -174,45 +174,6 @@ expect(page).to have_current_path(idv_phone_url) end end - - it 'shows a failure message after the maximum amount of retries', allow_browser_log: true do - perform_in_browser(:mobile) do - visit_idp_from_oidc_sp_with_ial2 - sign_in_and_2fa_user(user) - complete_doc_auth_steps_before_document_capture_step - - freeze_time do - timeout = distance_of_time_in_words( - RateLimiter.attempt_window_in_minutes(:idv_doc_auth).minutes, - ) - - final_failure_text = strip_tags( - t( - 'errors.doc_auth.rate_limited_text_html', - timeout: timeout, - ), - ) - - max_attempts.times do |time| - attach_images( - Rails.root.join( - 'spec', 'fixtures', - 'ial2_test_credential_wrong_doc_type.yml' - ), - ) - - submit_images - - if time == max_attempts - 1 - expect(page).to have_content(final_failure_text) - click_idv_exit - else - click_try_again - end - end - end - end - end end def expect_costing_for_document