From 1753a1dddf8a777b61b31a7e95d46fd916626eb6 Mon Sep 17 00:00:00 2001 From: Chris Alexander Date: Mon, 12 Aug 2024 15:02:19 -0600 Subject: [PATCH] feature/8866-add-step-x-and-moved-to-step-date (#9297) --- VAMobile/e2e/tests/Claims.e2e.ts | 31 ++++++++++++------- VAMobile/e2e/tests/utils.ts | 13 ++++++++ .../ClaimsAndAppealsListView.test.tsx | 14 ++++++--- .../ClaimsAndAppealsListView.tsx | 14 +++++++++ VAMobile/src/store/api/demo/mocks/claims.json | 2 +- VAMobile/src/translations/en/common.json | 2 ++ 6 files changed, 59 insertions(+), 17 deletions(-) diff --git a/VAMobile/e2e/tests/Claims.e2e.ts b/VAMobile/e2e/tests/Claims.e2e.ts index d4b79c148d8..4fbfcd55e27 100644 --- a/VAMobile/e2e/tests/Claims.e2e.ts +++ b/VAMobile/e2e/tests/Claims.e2e.ts @@ -8,18 +8,24 @@ import { openClaims, openClaimsHistory, resetInAppReview, + scrollToIDThenTap, toggleRemoteConfigFlag, } from './utils' export const ClaimsE2eIdConstants = { ALERT_FILE_REQUEST_BUTTON_ID: 'Review file requests', - CLAIM_1_ID: 'Compensation Received December 05, 2021', - CLAIM_2_ID: 'Compensation Received December 04, 2021', - CLAIM_3_ID: 'Compensation Received July 20, 2021', - CLAIM_4_ID: 'Compensation More information needed Received January 01, 2021', - CLAIM_5_ID: 'Compensation Received March 22, 2019', - CLAIM_6_ID: 'Dependency Received January 01, 2016', - CLOSED_CLAIM_DECISION_LETTER_ID: 'Compensation Decision letter ready Received January 01, 2021', + CLAIM_1_ID: + 'Compensation Received December 05, 2021 Step 1 of 5: Claim received Moved to this step on December 05, 2021', + CLAIM_2_ID: 'Compensation Received December 04, 2021 Step 5 of 5: Complete Moved to this step on December 04, 2021', + CLAIM_3_ID: 'Compensation Received July 20, 2021 Step 2 of 5: Initial review Moved to this step on July 20, 2021', + CLAIM_4_ID: + 'Compensation More information needed Received January 01, 2021 Step 3 of 8: Evidence gathering Moved to this step on May 05, 2021', + CLAIM_5_ID: + 'Compensation Received March 22, 2019 Step 3 of 5: Evidence gathering, review, and decision Moved to this step on July 18, 2019', + CLAIM_6_ID: + 'Dependency Received January 01, 2016 Step 3 of 5: Evidence gathering, review, and decision Moved to this step on July 30, 2016', + CLOSED_CLAIM_DECISION_LETTER_ID: + 'Compensation Decision letter ready Received January 01, 2021 Step 5 of 5: Complete Moved to this step on April 09, 2021', CLAIM_3_STATUS_STEP_1_ID: 'Step 1. Claim received. Complete.', CLAIM_3_STATUS_STEP_2_ID: 'Step 2. Initial review. Current step. Step 1 complete.', CLAIM_3_STATUS_STEP_3_ID: 'Step 3. Evidence gathering, review, and decision. Incomplete.', @@ -44,6 +50,7 @@ export const ClaimsE2eIdConstants = { ACCEPTED_FILE_TYPES_TEXT: 'PDF (unlocked), GIF, JPEG, JPG, BMP, TXT', MAXIMUM_FILE_SIZE_LABEL: '50 megabytes', CLAIMS_DETAILS_SCREEN_ID: 'ClaimDetailsScreen', + CLAIMS_HISTORY_SCREEN_ID: 'claimsHistoryID', } beforeAll(async () => { @@ -67,7 +74,7 @@ describe('Claims Screen', () => { }) it('Verify the claim status detail page (8-step claim)', async () => { - await element(by.id(ClaimsE2eIdConstants.CLAIM_4_ID)).tap() + await scrollToIDThenTap(ClaimsE2eIdConstants.CLAIM_4_ID, ClaimsE2eIdConstants.CLAIMS_HISTORY_SCREEN_ID) await expect(element(by.text('Status'))).toExist() await expect(element(by.text('Files'))).toExist() await expect(element(by.id(ClaimsE2eIdConstants.CLAIM_4_STATUS_STEP_1_ID))).toExist() @@ -83,7 +90,7 @@ describe('Claims Screen', () => { }) it('Verify the claim status detail page (5-step claim)', async () => { - await element(by.id(ClaimsE2eIdConstants.CLAIM_3_ID)).tap() + await scrollToIDThenTap(ClaimsE2eIdConstants.CLAIM_3_ID, ClaimsE2eIdConstants.CLAIMS_HISTORY_SCREEN_ID) await expect(element(by.text('Status'))).toExist() await expect(element(by.text('Files'))).toExist() await expect(element(by.id(ClaimsE2eIdConstants.CLAIM_3_STATUS_STEP_1_ID))).toExist() @@ -302,7 +309,7 @@ describe('Claims Screen', () => { it('should verify details of claim on step 3 w/ waiver', async () => { await waitFor(element(by.id(ClaimsE2eIdConstants.CLAIM_5_ID))) .toBeVisible() - .whileElement(by.id('claimsHistoryID')) + .whileElement(by.id(ClaimsE2eIdConstants.CLAIMS_HISTORY_SCREEN_ID)) .scroll(100, 'down') await element(by.id(ClaimsE2eIdConstants.CLAIM_5_ID)).tap() await expect( @@ -328,7 +335,7 @@ describe('Claims Screen', () => { await openClaimsHistory() await waitFor(element(by.id(ClaimsE2eIdConstants.CLAIM_6_ID))) .toBeVisible() - .whileElement(by.id('claimsHistoryID')) + .whileElement(by.id(ClaimsE2eIdConstants.CLAIMS_HISTORY_SCREEN_ID)) .scroll(100, 'down') await element(by.id(ClaimsE2eIdConstants.CLAIM_6_ID)).tap() await expect( @@ -339,7 +346,7 @@ describe('Claims Screen', () => { }) it('should verify details of claim on step 5', async () => { - await element(by.id('claimsHistoryID')).scrollTo('top') + await element(by.id(ClaimsE2eIdConstants.CLAIMS_HISTORY_SCREEN_ID)).scrollTo('top') await element(by.id(ClaimsE2eIdConstants.CLAIM_2_ID)).tap() await element(by.id(ClaimsE2eIdConstants.CLAIMS_DETAILS_SCREEN_ID)).scrollTo('bottom') await element(by.id('Step 5. Complete. Complete.')).tap() diff --git a/VAMobile/e2e/tests/utils.ts b/VAMobile/e2e/tests/utils.ts index a6d920ecaa0..248f78d83fb 100644 --- a/VAMobile/e2e/tests/utils.ts +++ b/VAMobile/e2e/tests/utils.ts @@ -144,6 +144,19 @@ export async function scrollToThenTap(text: string, containerID: string) { await element(by.text(text)).tap() } +/* Scroll down inside container until specified testID is found, then tap the testID + * + * @param scrollToID - testID of the item to scroll to + * @param containerID - testID of the container + */ +export async function scrollToIDThenTap(scrollToID: string, containerID: string) { + await waitFor(element(by.id(scrollToID))) + .toBeVisible() + .whileElement(by.id(containerID)) + .scroll(200, 'down') + await element(by.id(scrollToID)).tap() +} + /*This function will open, check for, and dismiss the leaving app popup from a specified launching point * * @param matchString - string of the text or id to match diff --git a/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimsAndAppealsListView/ClaimsAndAppealsListView.test.tsx b/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimsAndAppealsListView/ClaimsAndAppealsListView.test.tsx index 02b778158ec..e42535a973f 100644 --- a/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimsAndAppealsListView/ClaimsAndAppealsListView.test.tsx +++ b/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimsAndAppealsListView/ClaimsAndAppealsListView.test.tsx @@ -62,10 +62,10 @@ const mockPayload: ClaimsAndAppealsListPayload = { completed: false, decisionLetterSent: false, dateFiled: '2020-10-04', - updatedAt: '2020-10-04', + updatedAt: '2020-11-18', displayTitle: 'Dependency', - phase: 4, - claimTypeCode: '', + phase: 6, + claimTypeCode: '010LCOMP', documentsNeeded: false, developmentLetterSent: false, }, @@ -126,10 +126,16 @@ context('ClaimsAndAppealsListView', () => { await waitFor(() => expect(screen.getByText('Dependency')).toBeTruthy()) await waitFor(() => expect(screen.getByText('Received October 04, 2020')).toBeTruthy()) + await waitFor(() => expect(screen.getByText('Step 6 of 8: Preparing decision letter')).toBeTruthy()) + await waitFor(() => expect(screen.getByText('Moved to this step on November 18, 2020')).toBeTruthy()) await waitFor(() => expect(screen.getByText('Compensation')).toBeTruthy()) await waitFor(() => expect(screen.getByText('More information needed')).toBeTruthy()) await waitFor(() => expect(screen.getByText('Received October 01, 2020')).toBeTruthy()) + await waitFor(() => + expect(screen.getByText('Step 3 of 5: Evidence gathering, review, and decision')).toBeTruthy(), + ) + await waitFor(() => expect(screen.getByText('Moved to this step on October 05, 2020')).toBeTruthy()) initializeTestInstance('CLOSED') await waitFor(() => expect(screen.getByText('Your closed claims, decision reviews, and appeals')).toBeTruthy()) @@ -150,7 +156,7 @@ context('ClaimsAndAppealsListView', () => { await waitFor(() => fireEvent.press( screen.getByRole('menuitem', { - name: 'Compensation More information needed Received October 01, 2020', + name: 'Compensation More information needed Received October 01, 2020 Step 3 of 5: Evidence gathering, review, and decision Moved to this step on October 05, 2020', }), ), ) diff --git a/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimsAndAppealsListView/ClaimsAndAppealsListView.tsx b/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimsAndAppealsListView/ClaimsAndAppealsListView.tsx index 57ac3fe8b70..fc0d93fa8aa 100644 --- a/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimsAndAppealsListView/ClaimsAndAppealsListView.tsx +++ b/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimsAndAppealsListView/ClaimsAndAppealsListView.tsx @@ -19,6 +19,7 @@ import { import { ClaimType } from 'constants/claims' import { NAMESPACE } from 'constants/namespaces' import { getTestIDFromTextLines, testIdProps } from 'utils/accessibility' +import { getUserPhase, isDisabilityCompensationClaim } from 'utils/claims' import { capitalizeWord, formatDateMMMMDDYYYY } from 'utils/formattingUtils' import { useRouteNavigation, useTheme } from 'utils/hooks' import { featureEnabled } from 'utils/remoteConfig' @@ -100,6 +101,19 @@ function ClaimsAndAppealsListView({ claimType, scrollViewRef }: ClaimsAndAppeals textLines.push({ text: t('claimDetails.receivedOn', { date: formatDateMMMMDDYYYY(attributes.dateFiled) }) }) + if (type === ClaimOrAppealConstants.claim) { + const isDisabilityClaim = isDisabilityCompensationClaim(attributes.claimTypeCode || '') + const current = isDisabilityClaim ? attributes.phase : getUserPhase(Number(attributes.phase)) + const total = isDisabilityClaim ? 8 : 5 + const stepXofY = t('stepXofY', { current, total }) + + const translationStepString = isDisabilityClaim ? '8step' : '5step' + const stepName = t(`claimPhase.${translationStepString}.heading.phase${current}`) + + textLines.push({ text: `${stepXofY}: ${stepName}` }) + textLines.push({ text: t('movedToThisStepOn', { date: formatDateMMMMDDYYYY(attributes.updatedAt) }) }) + } + const position = (page - 1) * perPage + index + 1 const a11yValue = t('listPosition', { position, total: totalEntries }) listItems.push({ diff --git a/VAMobile/src/store/api/demo/mocks/claims.json b/VAMobile/src/store/api/demo/mocks/claims.json index c52de3ff9fb..d9a4a5f8708 100644 --- a/VAMobile/src/store/api/demo/mocks/claims.json +++ b/VAMobile/src/store/api/demo/mocks/claims.json @@ -27,7 +27,7 @@ "updatedAt": "2021-05-05", "displayTitle": "Compensation", "phase": 3, - "claimTypeCode": "", + "claimTypeCode": "010LCOMP", "documentsNeeded": true, "developmentLetterSent": false } diff --git a/VAMobile/src/translations/en/common.json b/VAMobile/src/translations/en/common.json index b68014306e9..6f9128130b1 100644 --- a/VAMobile/src/translations/en/common.json +++ b/VAMobile/src/translations/en/common.json @@ -940,6 +940,7 @@ "mobileBodyLink.a11yHint": "This page will open in your device's browser", "monthlyCompensationPayment": "Monthly compensation payment", "more": "More", + "movedToThisStepOn": "Moved to this step on {{date}}", "needed": "needed", "next": "Next", "noActivity": "There's no activity to show.", @@ -1390,6 +1391,7 @@ "statusDefinition.expired": "A prescription which is too old to fill. This does not refer to the expiration date of the medication in the container. Contact your VA healthcare team when you need more of this VA prescription.", "statusDefinition.transferred": "A prescription moved to VA’s new electronic health record. This prescription may also be described as “Discontinued” on medication lists from your healthcare team. Take your medications as prescribed by your healthcare team.", "statusDefinition.unknown": "The status cannot be determined. Contact your VA care team when you need more of this VA prescription. A prescription stopped by a VA provider. It is no longer available to be filled.", + "stepXofY": "Step {{current}} of {{total}}", "success": "Success", "sync.progress.signin": "Signing you in...", "sync.progress.signout": "Signing you out...",