Skip to content

Commit

Permalink
Lg 13876 continued feature tests (#11263)
Browse files Browse the repository at this point in the history
* updated tests to passing state

* Updated tests to pass split doc auth

* Cleaning test

* changelog: Upcoming Features, split doc auth, adding feature tests for more code coverage in prep for split doc auth FF enabling

* Removed old method

* Resolved conflicts and pr comments

* Resolving PR comment

* Added logic for review step, fixing tests

* Update spec/features/idv/analytics_spec.rb

Co-authored-by: Amir Reavis-Bey <amir.reavis-bey@gsa.gov>

* Updated test names

* Improving readability

* Removing hardline true

* Removing redudant tests

* Resolving PR comments

* Resolving PR comments

* Removing redundant code

* Resolving PR comments

* Updated doc capture tests

* Added check for submission with empty selfie

* Added empty file on initial submit check to shared example

* Removing unneeded method

* Adding hybrid flow selfie capture test from amir's branch

* Removed hybrid flow from doc capture and added to hybrid mobile spec

* Resolving rebase issues

* Fixing Rebase

---------

Co-authored-by: Amir Reavis-Bey <amir.reavis-bey@gsa.gov>
  • Loading branch information
2 people authored and MrNagoo committed Oct 3, 2024
1 parent 7557102 commit a51d9bb
Show file tree
Hide file tree
Showing 14 changed files with 1,692 additions and 544 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,13 @@ function DocumentCaptureReviewIssues({
]}
/>
)}
<DocumentsCaptureStep defaultSideProps={defaultSideProps} value={value} />
<DocumentsCaptureStep defaultSideProps={defaultSideProps} value={value} isReviewStep />
{isSelfieCaptureEnabled && (
<SelfieCaptureStep defaultSideProps={defaultSideProps} selfieValue={value.selfie} />
<SelfieCaptureStep
defaultSideProps={defaultSideProps}
selfieValue={value.selfie}
isReviewStep
/>
)}
<FormStepsButton.Submit />
<Cancel />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,25 +141,22 @@ function DocumentCapture({ onStepChange = () => {} }: DocumentCaptureProps) {
if (submissionError && formValues) {
initialValues = formValues;
}

// If the user got here by opting-in to in-person proofing, when skipDocAuth === true,
// then set steps to inPersonSteps
const isInPersonStepEnabled = skipDocAuth || skipDocAuthFromHandoff;
const inPersonSteps: FormStep[] =
inPersonURL === undefined
? []
: ([prepareFormStep, locationFormStep, flowPath === 'hybrid' && hybridFormStep].filter(
Boolean,
) as FormStep[]);
const reviewAfterFailedSteps = [reviewFormStep] as FormStep[];
const reviewWithInPersonSteps = reviewAfterFailedSteps.concat(inPersonSteps);
const afterSubmissionErrorSteps = docAuthSeparatePagesEnabled
? reviewAfterFailedSteps
: reviewWithInPersonSteps;
const defaultSteps: FormStep[] = submissionError ? afterSubmissionErrorSteps : documentsFormSteps;

// If the user got here by opting-in to in-person proofing, when skipDocAuth === true,
// then set steps to inPersonSteps
const isInPersonStepEnabled = skipDocAuth || skipDocAuthFromHandoff;
const steps: FormStep[] = isInPersonStepEnabled ? inPersonSteps : defaultSteps;

let steps = documentsFormSteps;
if (isInPersonStepEnabled) {
steps = inPersonSteps;
} else if (submissionError) {
steps = [reviewFormStep, ...inPersonSteps];
}
// If the user got here by opting-in to in-person proofing, when skipDocAuth === true;
// or opting-in ipp from handoff page, and selfie is required, when skipDocAuthFromHandoff === true
// then set stepIndicatorPath to VerifyFlowPath.IN_PERSON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ interface DocumentSideAcuantCaptureProps {
errors: FormStepError<{ front: string; back: string; selfie: string }>[];
onError: OnErrorCallback;
className?: string;
isReviewStep: boolean;
}

/**
Expand Down Expand Up @@ -52,13 +53,14 @@ function DocumentSideAcuantCapture({
errors,
onError,
className,
isReviewStep,
}: DocumentSideAcuantCaptureProps) {
const error = errors.find(({ field }) => field === side)?.error;
const { changeStepCanComplete } = useContext(FormStepsContext);
const { isSelfieCaptureEnabled, isSelfieDesktopTestMode, docAuthSeparatePagesEnabled } =
useContext(SelfieCaptureContext);
const isUploadAllowed = isSelfieDesktopTestMode || !isSelfieCaptureEnabled;
const stepCanComplete = docAuthSeparatePagesEnabled ? undefined : true;
const stepCanComplete = docAuthSeparatePagesEnabled && !isReviewStep ? undefined : true;
return (
<AcuantCapture
ref={registerField(side, { isRequired: true })}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,17 @@ export default function DocumentsAndSelfieStep({
t('doc_auth.tips.document_capture_id_text3'),
].concat(!isMobile ? [t('doc_auth.tips.document_capture_id_text4')] : [])}
/>
<DocumentsCaptureStep defaultSideProps={defaultSideProps} value={value} />
<DocumentsCaptureStep
defaultSideProps={defaultSideProps}
value={value}
isReviewStep={false}
/>
{isSelfieCaptureEnabled && (
<SelfieCaptureStep defaultSideProps={defaultSideProps} selfieValue={value.selfie} />
<SelfieCaptureStep
defaultSideProps={defaultSideProps}
selfieValue={value.selfie}
isReviewStep={false}
/>
)}
{isLastStep ? <FormStepsButton.Submit /> : <FormStepsButton.Continue />}
<Cancel />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ import DocumentSideAcuantCapture from './document-side-acuant-capture';
export function DocumentsCaptureStep({
defaultSideProps,
value,
isReviewStep = false,
}: {
defaultSideProps: DefaultSideProps;
value: Record<string, ImageValue>;
isReviewStep: boolean;
}) {
type DocumentSide = 'front' | 'back';
const documentsSides: DocumentSide[] = ['front', 'back'];
Expand All @@ -30,6 +32,7 @@ export function DocumentsCaptureStep({
key={side}
side={side}
value={value[side]}
isReviewStep={isReviewStep}
/>
))}
</>
Expand Down Expand Up @@ -81,7 +84,11 @@ export default function DocumentsStep({
t('doc_auth.tips.document_capture_id_text3'),
].concat(!isMobile ? [t('doc_auth.tips.document_capture_id_text4')] : [])}
/>
<DocumentsCaptureStep defaultSideProps={defaultSideProps} value={value} />
<DocumentsCaptureStep
defaultSideProps={defaultSideProps}
value={value}
isReviewStep={false}
/>
<FormStepsButton.Continue />
<Cancel />
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ import {
export function SelfieCaptureStep({
defaultSideProps,
selfieValue,
isReviewStep,
}: {
defaultSideProps: DefaultSideProps;
selfieValue: ImageValue;
isReviewStep: boolean;
}) {
const { t } = useI18n();
return (
Expand All @@ -45,6 +47,7 @@ export function SelfieCaptureStep({
key="selfie"
side="selfie"
value={selfieValue}
isReviewStep={isReviewStep}
/>
</>
);
Expand Down Expand Up @@ -72,7 +75,11 @@ export default function SelfieStep({
<>
{flowPath === 'hybrid' && <HybridDocCaptureWarning className="margin-bottom-4" />}
<PageHeading>{pageHeaderText}</PageHeading>
<SelfieCaptureStep defaultSideProps={defaultSideProps} selfieValue={value.selfie} />
<SelfieCaptureStep
defaultSideProps={defaultSideProps}
selfieValue={value.selfie}
isReviewStep={false}
/>
{isLastStep ? <FormStepsButton.Submit /> : <FormStepsButton.Continue />}
<Cancel />
</>
Expand Down
Loading

0 comments on commit a51d9bb

Please sign in to comment.