Skip to content

Commit

Permalink
feature/8866-add-step-x-and-moved-to-step-date (#9297)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandec authored Aug 12, 2024
1 parent 40f0dd1 commit 1753a1d
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 17 deletions.
31 changes: 19 additions & 12 deletions VAMobile/e2e/tests/Claims.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand All @@ -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 () => {
Expand All @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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()
Expand Down
13 changes: 13 additions & 0 deletions VAMobile/e2e/tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -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())
Expand All @@ -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',
}),
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion VAMobile/src/store/api/demo/mocks/claims.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"updatedAt": "2021-05-05",
"displayTitle": "Compensation",
"phase": 3,
"claimTypeCode": "",
"claimTypeCode": "010LCOMP",
"documentsNeeded": true,
"developmentLetterSent": false
}
Expand Down
2 changes: 2 additions & 0 deletions VAMobile/src/translations/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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...",
Expand Down

0 comments on commit 1753a1d

Please sign in to comment.