diff --git a/src/applications/claims-status/components/claim-status-tab/RecentActivity.jsx b/src/applications/claims-status/components/claim-status-tab/RecentActivity.jsx index b8f8ea66ffef..91459b816ab8 100644 --- a/src/applications/claims-status/components/claim-status-tab/RecentActivity.jsx +++ b/src/applications/claims-status/components/claim-status-tab/RecentActivity.jsx @@ -2,14 +2,14 @@ import React, { useCallback, useState } from 'react'; import PropTypes from 'prop-types'; import { Link } from 'react-router-dom-v5-compat'; import { VaPagination } from '@department-of-veterans-affairs/component-library/dist/react-bindings'; -import moment from 'moment'; import { useFeatureToggle } from '~/platform/utilities/feature-toggles'; +import { uniqueId } from 'lodash'; import { ITEMS_PER_PAGE } from '../../constants'; import { buildDateFormatter, + getOldestDocumentDate, getPhaseItemText, - getTrackedItemDateFromStatus, is5103Notice, isDisabilityCompensationClaim, } from '../../utils/helpers'; @@ -27,27 +27,6 @@ export default function RecentActivity({ claim }) { cstClaimPhasesEnabled && isDisabilityCompensationClaim(claim.attributes.claimTypeCode); - const getTrackedItemDescription = item => { - const displayName = - cst5103UpdateEnabled && is5103Notice(item.displayName) - ? 'List of evidence we may need (5103 notice)' - : item.displayName; - switch (item.status) { - case 'NEEDED_FROM_YOU': - case 'NEEDED_FROM_OTHERS': - return `We opened a request: "${displayName}"`; - case 'NO_LONGER_REQUIRED': - return `We closed a request: "${displayName}"`; - case 'SUBMITTED_AWAITING_REVIEW': - return `We received your document(s) for the request: "${displayName}"`; - case 'INITIAL_REVIEW_COMPLETE': - case 'ACCEPTED': - return `We completed a review for the request: "${displayName}"`; - default: - return 'There was an update to this item'; - } - }; - const getPhaseItemDescription = (currentPhaseBack, phase) => { const phaseItemText = getPhaseItemText(phase, showEightPhases); const movedIntoText = `Your claim moved into ${phaseItemText}`; @@ -73,15 +52,58 @@ export default function RecentActivity({ claim }) { const generateTrackedItems = () => { const { trackedItems } = claim.attributes; + const items = []; + const addItems = (date, description, item) => { + items.push({ + id: `${item.id}-${uniqueId()}`, + date, + description, + displayName: item.displayName, + status: item.status, + type: 'tracked_item', + }); + }; + + trackedItems.forEach(item => { + const displayName = + cst5103UpdateEnabled && is5103Notice(item.displayName) + ? 'List of evidence we may need (5103 notice)' + : item.displayName; + + if (item.closedDate) { + addItems( + item.closedDate, + `We closed a request: "${displayName}"`, + item, + ); + } + + if (item.receivedDate) { + addItems( + item.receivedDate, + `We completed a review for the request: "${displayName}"`, + item, + ); + } + + if (item.documents?.length > 0) { + addItems( + getOldestDocumentDate(item), + `We received your document(s) for the request: "${displayName}"`, + item, + ); + } + + if (item.requestedDate) { + addItems( + item.requestedDate, + `We opened a request: "${displayName}"`, + item, + ); + } + }); - return trackedItems.map(item => ({ - id: item.id, - date: getTrackedItemDateFromStatus(item), - description: getTrackedItemDescription(item), - displayName: item.displayName, - status: item.status, - type: 'tracked_item', - })); + return items; }; const generatePhaseItems = () => { @@ -136,7 +158,7 @@ export default function RecentActivity({ claim }) { const items = [...trackedItems, ...phaseItems]; return items.sort((item1, item2) => { - return moment(item2.date) - moment(item1.date); + return new Date(item2.date) - new Date(item1.date); }); }; diff --git a/src/applications/claims-status/tests/components/claim-status-tab/RecentActivity.unit.spec.jsx b/src/applications/claims-status/tests/components/claim-status-tab/RecentActivity.unit.spec.jsx index c32b2e7b6588..be19abbd9bad 100644 --- a/src/applications/claims-status/tests/components/claim-status-tab/RecentActivity.unit.spec.jsx +++ b/src/applications/claims-status/tests/components/claim-status-tab/RecentActivity.unit.spec.jsx @@ -230,6 +230,7 @@ const openClaimStep3WithAcceptedItem = { trackedItems: [ { id: 1, + receivedDate: '2024-05-20', requestedDate: '2024-05-12', status: 'ACCEPTED', displayName: 'Accepted Request', @@ -238,7 +239,7 @@ const openClaimStep3WithAcceptedItem = { }, }; -const openClaimStep4WithMultipleItems = { +const openClaimStep4WithOver10Items = { attributes: { claimDate: '2024-05-02', claimPhaseDates: { @@ -280,6 +281,7 @@ const openClaimStep4WithMultipleItems = { { id: 5, closedDate: '2024-05-24', + requestedDate: '2024-05-20', status: 'NO_LONGER_REQUIRED', displayName: 'No longer required Request', }, @@ -327,6 +329,93 @@ const openClaimStep4WithMultipleItems = { }, }; +const openClaimStep4WithClosedItem = { + attributes: { + claimDate: '2024-05-02', + claimPhaseDates: { + phaseChangeDate: '2024-06-07', + currentPhaseBack: false, + latestPhaseType: 'REVIEW_OF_EVIDENCE', + previousPhases: { + phase1CompleteDate: '2024-05-10', + phase2CompleteDate: '2024-05-22', + phase3CompleteDate: '2024-06-07', + }, + }, + claimTypeCode: '110LCMP7IDES', + trackedItems: [ + { + id: 3, + closedDate: '2024-05-24', + requestedDate: '2024-05-20', + status: 'NO_LONGER_REQUIRED', + displayName: 'No longer required Request', + }, + ], + }, +}; + +const openClaimStep4WithDocumentsSubmittedForTrackedItem = { + attributes: { + claimDate: '2024-05-02', + claimPhaseDates: { + phaseChangeDate: '2024-06-07', + currentPhaseBack: false, + latestPhaseType: 'REVIEW_OF_EVIDENCE', + previousPhases: { + phase1CompleteDate: '2024-05-10', + phase2CompleteDate: '2024-05-22', + phase3CompleteDate: '2024-06-07', + }, + }, + claimTypeCode: '110LCMP7IDES', + trackedItems: [ + { + id: 5, + requestedDate: '2024-05-20', + status: 'SUBMITTED_AWAITING_REVIEW', + displayName: 'Submitted awaiting Request', + documents: [ + { + uploadDate: '2024-05-24', + }, + ], + }, + ], + }, +}; + +const openClaimStep4WithDocumentsReceivedForTrackedItem = { + attributes: { + claimDate: '2024-05-02', + claimPhaseDates: { + phaseChangeDate: '2024-06-07', + currentPhaseBack: false, + latestPhaseType: 'REVIEW_OF_EVIDENCE', + previousPhases: { + phase1CompleteDate: '2024-05-10', + phase2CompleteDate: '2024-05-22', + phase3CompleteDate: '2024-06-07', + }, + }, + claimTypeCode: '110LCMP7IDES', + trackedItems: [ + { + id: 4, + requestedDate: '2024-05-20', + receivedDate: '2024-05-27', + status: 'SUBMITTED_AWAITING_REVIEW', + displayName: 'Submitted and received Request', + documents: [ + { + uploadDate: '2024-05-24', + }, + ], + }, + ], + }, +}; + const openClaimStep4WithAuto5103Notice = { attributes: { claimDate: '2024-05-02', @@ -576,10 +665,11 @@ describe('', () => { expect(recentActivityList).to.exist; expect( within(recentActivityList).getAllByRole('listitem').length, - ).to.equal(4); + ).to.equal(5); getByText('We received your claim in our system'); getByText('Your claim moved into Step 2: Initial review'); getByText('Your claim moved into Step 3: Evidence gathering'); + getByText(`We opened a request: "Accepted Request"`); getByText( 'We completed a review for the request: "Accepted Request"', ); @@ -600,7 +690,7 @@ describe('', () => { it('should render list with pagination', () => { const { container } = renderWithRouter( - + , ); @@ -613,6 +703,93 @@ describe('', () => { expect(pagination).to.exist; expect(pagination.pages).to.equal(2); }); + it('shows closed tracked item history in recent activity', () => { + const { container, getByText } = renderWithRouter( + + + , + ); + + const recentActivityList = $('ol', container); + expect(recentActivityList).to.exist; + expect( + within(recentActivityList).getAllByRole('listitem').length, + ).to.equal(6); + getByText('May 2, 2024'); + getByText('We received your claim in our system'); + getByText('May 10, 2024'); + getByText('Your claim moved into Step 2: Initial review'); + getByText('May 20, 2024'); + getByText(`We opened a request: "No longer required Request"`); + getByText('May 22, 2024'); + getByText('Your claim moved into Step 3: Evidence gathering'); + getByText('May 24, 2024'); + getByText(`We closed a request: "No longer required Request"`); + getByText('June 7, 2024'); + getByText(`Your claim moved into Step 4: Evidence review`); + }); + it('shows documents submitted tracked item history in recent activity', () => { + const { container, getByText } = renderWithRouter( + + + , + ); + + const recentActivityList = $('ol', container); + expect(recentActivityList).to.exist; + expect( + within(recentActivityList).getAllByRole('listitem').length, + ).to.equal(6); + getByText('May 2, 2024'); + getByText('We received your claim in our system'); + getByText('May 10, 2024'); + getByText('Your claim moved into Step 2: Initial review'); + getByText('May 20, 2024'); + getByText(`We opened a request: "Submitted awaiting Request"`); + getByText('May 22, 2024'); + getByText('Your claim moved into Step 3: Evidence gathering'); + getByText('May 24, 2024'); + getByText( + `We received your document(s) for the request: "Submitted awaiting Request"`, + ); + getByText('June 7, 2024'); + getByText(`Your claim moved into Step 4: Evidence review`); + }); + it('shows documents submitted tracked item history in recent activity', () => { + const { container, getByText } = renderWithRouter( + + + , + ); + + const recentActivityList = $('ol', container); + expect(recentActivityList).to.exist; + expect( + within(recentActivityList).getAllByRole('listitem').length, + ).to.equal(7); + getByText('May 2, 2024'); + getByText('We received your claim in our system'); + getByText('May 10, 2024'); + getByText('Your claim moved into Step 2: Initial review'); + getByText('May 20, 2024'); + getByText(`We opened a request: "Submitted and received Request"`); + getByText('May 22, 2024'); + getByText('Your claim moved into Step 3: Evidence gathering'); + getByText('May 24, 2024'); + getByText( + `We received your document(s) for the request: "Submitted and received Request"`, + ); + getByText('May 27, 2024'); + getByText( + `We completed a review for the request: "Submitted and received Request"`, + ); + getByText('June 7, 2024'); + getByText(`Your claim moved into Step 4: Evidence review`); + }); context( 'when cst5103UpdateEnabled and has an Automated 5103 Notice Response item', () => { @@ -681,9 +858,12 @@ describe('', () => { expect(recentActivityList).to.exist; expect( within(recentActivityList).getAllByRole('listitem').length, - ).to.equal(5); + ).to.equal(6); getByText('We received your claim in our system'); getByText('Your claim moved into Step 2: Initial review'); + getByText( + `We opened a request: "List of evidence we may need (5103 notice)"`, + ); getByText('Your claim moved into Step 3: Evidence gathering'); getByText('Your claim moved into Step 4: Evidence review'); getByText( @@ -707,9 +887,10 @@ describe('', () => { expect(recentActivityList).to.exist; expect( within(recentActivityList).getAllByRole('listitem').length, - ).to.equal(5); + ).to.equal(6); getByText('We received your claim in our system'); getByText('Your claim moved into Step 2: Initial review'); + getByText(`We opened a request: "5103 Notice Response"`); getByText('Your claim moved into Step 3: Evidence gathering'); getByText('Your claim moved into Step 4: Evidence review'); getByText('We closed a request: "5103 Notice Response"'); @@ -929,12 +1110,13 @@ describe('', () => { expect(recentActivityList).to.exist; expect( within(recentActivityList).getAllByRole('listitem').length, - ).to.equal(4); + ).to.equal(5); getByText('Your claim moved into Step 1: Claim received'); getByText('Your claim moved into Step 2: Initial review'); getByText( 'Your claim moved into Step 3: Evidence gathering, review, and decision', ); + getByText(`We opened a request: "Accepted Request"`); getByText( 'We completed a review for the request: "Accepted Request"', ); @@ -952,10 +1134,10 @@ describe('', () => { }); }); context('when claim is in phase 4', () => { - it('should render list with pagination and ', () => { + it('should render list with pagination', () => { const { container } = renderWithRouter( - + , ); @@ -968,6 +1150,93 @@ describe('', () => { expect(pagination).to.exist; expect(pagination.pages).to.equal(2); }); + it('shows closed tracked item history in recent activity', () => { + const { container, getByText } = renderWithRouter( + + + , + ); + + const recentActivityList = $('ol', container); + expect(recentActivityList).to.exist; + expect( + within(recentActivityList).getAllByRole('listitem').length, + ).to.equal(5); + getByText('May 2, 2024'); + getByText('Your claim moved into Step 1: Claim received'); + getByText('May 10, 2024'); + getByText('Your claim moved into Step 2: Initial review'); + getByText('May 20, 2024'); + getByText(`We opened a request: "No longer required Request"`); + getByText('May 22, 2024'); + getByText( + 'Your claim moved into Step 3: Evidence gathering, review, and decision', + ); + getByText('May 24, 2024'); + getByText(`We closed a request: "No longer required Request"`); + }); + it('shows documents submitted tracked item history in recent activity', () => { + const { container, getByText } = renderWithRouter( + + + , + ); + + const recentActivityList = $('ol', container); + expect(recentActivityList).to.exist; + expect( + within(recentActivityList).getAllByRole('listitem').length, + ).to.equal(5); + getByText('May 2, 2024'); + getByText('Your claim moved into Step 1: Claim received'); + getByText('May 10, 2024'); + getByText('Your claim moved into Step 2: Initial review'); + getByText('May 20, 2024'); + getByText(`We opened a request: "Submitted awaiting Request"`); + getByText('May 22, 2024'); + getByText( + 'Your claim moved into Step 3: Evidence gathering, review, and decision', + ); + getByText('May 24, 2024'); + getByText( + `We received your document(s) for the request: "Submitted awaiting Request"`, + ); + }); + it('shows documents submitted tracked item history in recent activity', () => { + const { container, getByText } = renderWithRouter( + + + , + ); + + const recentActivityList = $('ol', container); + expect(recentActivityList).to.exist; + expect( + within(recentActivityList).getAllByRole('listitem').length, + ).to.equal(6); + getByText('May 2, 2024'); + getByText('Your claim moved into Step 1: Claim received'); + getByText('May 10, 2024'); + getByText('Your claim moved into Step 2: Initial review'); + getByText('May 20, 2024'); + getByText(`We opened a request: "Submitted and received Request"`); + getByText('May 22, 2024'); + getByText( + 'Your claim moved into Step 3: Evidence gathering, review, and decision', + ); + getByText('May 24, 2024'); + getByText( + `We received your document(s) for the request: "Submitted and received Request"`, + ); + getByText('May 27, 2024'); + getByText( + `We completed a review for the request: "Submitted and received Request"`, + ); + }); context( 'when cst5103UpdateEnabled and has an Automated 5103 Notice Response item', () => { @@ -1025,7 +1294,7 @@ describe('', () => { }, ); context( - 'when cst5103UpdateEnabled and has an Automated 5103 Notice Response item', + 'when cst5103UpdateEnabled and has a closed Automated 5103 Notice Response item', () => { it('should render list', () => { const { container, getByText } = renderWithRouter( @@ -1038,9 +1307,12 @@ describe('', () => { expect(recentActivityList).to.exist; expect( within(recentActivityList).getAllByRole('listitem').length, - ).to.equal(4); + ).to.equal(5); getByText('Your claim moved into Step 1: Claim received'); getByText('Your claim moved into Step 2: Initial review'); + getByText( + `We opened a request: "List of evidence we may need (5103 notice)"`, + ); getByText( 'Your claim moved into Step 3: Evidence gathering, review, and decision', ); @@ -1052,7 +1324,7 @@ describe('', () => { }, ); context( - 'when cst5103UpdateEnabled disabled and has an Automated 5103 Notice Response item', + 'when cst5103UpdateEnabled disabled and has a closed Automated 5103 Notice Response item', () => { it('should render list', () => { const { container, getByText } = renderWithRouter( @@ -1065,9 +1337,10 @@ describe('', () => { expect(recentActivityList).to.exist; expect( within(recentActivityList).getAllByRole('listitem').length, - ).to.equal(4); + ).to.equal(5); getByText('Your claim moved into Step 1: Claim received'); getByText('Your claim moved into Step 2: Initial review'); + getByText(`We opened a request: "5103 Notice Response"`); getByText( 'Your claim moved into Step 3: Evidence gathering, review, and decision', ); diff --git a/src/applications/claims-status/tests/e2e/fixtures/mocks/lighthouse/claim-detail-open.json b/src/applications/claims-status/tests/e2e/fixtures/mocks/lighthouse/claim-detail-open.json index 0862348a739b..bdd3b5707239 100644 --- a/src/applications/claims-status/tests/e2e/fixtures/mocks/lighthouse/claim-detail-open.json +++ b/src/applications/claims-status/tests/e2e/fixtures/mocks/lighthouse/claim-detail-open.json @@ -5,12 +5,12 @@ "attributes": { "claimDate": "2021-01-12", "claimPhaseDates": { - "phaseChangeDate": "2022-01-01", + "phaseChangeDate": "2022-01-02", "currentPhaseBack": false, "latestPhaseType": "GATHERING_OF_EVIDENCE", "previousPhases": { "phase1CompleteDate": "2022-01-01", - "phase2CompleteDate": "2022-01-01" + "phase2CompleteDate": "2022-01-02" } }, "claimType": "Compensation", @@ -160,12 +160,12 @@ "tempJurisdiction": null, "trackedItems": [ { - "closedDate": null, - "description": "What was received item two.", - "displayName": "Farm Income", + "closedDate": "2022-01-04", + "description": "Test", + "displayName": "Closed Tracked Item", "overdue": false, - "receivedDate": "2022-01-04", - "requestedDate": null, + "receivedDate": null, + "requestedDate": "2022-01-01", "suspenseDate": null, "id": 1, "status": "INITIAL_REVIEW_COMPLETE", @@ -178,7 +178,7 @@ "displayName": "Submit Buddy Statement(s)", "overdue": true, "receivedDate": "2022-01-04", - "requestedDate": null, + "requestedDate": "2022-01-01", "suspenseDate": "2022-02-04", "id": 2, "status": "NEEDED_FROM_YOU", @@ -191,8 +191,8 @@ "displayName": "Please provide Form ZZ-1234", "overdue": true, "receivedDate": null, - "requestedDate": null, - "suspenseDate": "2010-03-25", + "requestedDate": "2022-01-01", + "suspenseDate": "2022-03-25", "id": 3, "status": "NEEDED_FROM_YOU", "uploaded": false, @@ -203,8 +203,8 @@ "description": "21-4142", "displayName": "Need form 21-4142", "overdue": true, - "receivedDate": "2021-01-04", - "requestedDate": null, + "receivedDate": "2022-01-25", + "requestedDate": "2022-01-21", "suspenseDate": null, "id": 4, "status": "NEEDED_FROM_OTHERS", @@ -217,7 +217,7 @@ "displayName": "Farm Income", "overdue": false, "receivedDate": "2022-01-04", - "requestedDate": null, + "requestedDate": "2022-01-01", "suspenseDate": null, "id": 5, "status": "INITIAL_REVIEW_COMPLETE", @@ -230,7 +230,7 @@ "displayName": "Submit Buddy Statement(s)", "overdue": true, "receivedDate": "2022-01-04", - "requestedDate": null, + "requestedDate": "2022-01-01", "suspenseDate": "2022-02-04", "id": 6, "status": "NEEDED_FROM_YOU", @@ -243,8 +243,8 @@ "displayName": "Please provide Form ZZ-1234", "overdue": true, "receivedDate": null, - "requestedDate": null, - "suspenseDate": "2010-03-25", + "requestedDate": "2022-01-01", + "suspenseDate": "2022-03-25", "id": 7, "status": "NEEDED_FROM_YOU", "uploaded": false, @@ -255,8 +255,8 @@ "description": "21-4142", "displayName": "Need form 21-4142", "overdue": true, - "receivedDate": "2021-01-04", - "requestedDate": null, + "receivedDate": "2022-01-24", + "requestedDate": "2022-01-20", "suspenseDate": null, "id": 8, "status": "NEEDED_FROM_OTHERS", @@ -269,7 +269,7 @@ "displayName": "Farm Income", "overdue": false, "receivedDate": "2022-01-04", - "requestedDate": null, + "requestedDate": "2022-01-01", "suspenseDate": null, "id": 9, "status": "INITIAL_REVIEW_COMPLETE", @@ -282,7 +282,7 @@ "displayName": "Submit Buddy Statement(s)", "overdue": true, "receivedDate": "2022-01-04", - "requestedDate": null, + "requestedDate": "2022-01-01", "suspenseDate": "2022-02-04", "id": 10, "status": "NEEDED_FROM_YOU", @@ -295,8 +295,8 @@ "displayName": "Please provide Form ZZ-1234", "overdue": true, "receivedDate": null, - "requestedDate": null, - "suspenseDate": "2010-03-25", + "requestedDate": "2022-01-01", + "suspenseDate": "2022-03-25", "id": 11, "status": "NEEDED_FROM_YOU", "uploaded": false, @@ -307,8 +307,8 @@ "description": "21-4142", "displayName": "Need form 21-4142", "overdue": true, - "receivedDate": "2021-01-04", - "requestedDate": null, + "receivedDate": "2022-01-04", + "requestedDate": "2022-01-01", "suspenseDate": null, "id": 12, "status": "NEEDED_FROM_OTHERS", diff --git a/src/applications/claims-status/tests/e2e/page-objects/TrackClaimsPageV2.js b/src/applications/claims-status/tests/e2e/page-objects/TrackClaimsPageV2.js index 2424a5eca9a9..2acb252fbce1 100644 --- a/src/applications/claims-status/tests/e2e/page-objects/TrackClaimsPageV2.js +++ b/src/applications/claims-status/tests/e2e/page-objects/TrackClaimsPageV2.js @@ -382,7 +382,7 @@ class TrackClaimsPageV2 { cy.get('va-card') .shadow() .get('[data-cy="moved-to-date-text"]') - .should('contain', 'Moved to this step on January 1, 2022'); + .should('contain', 'Moved to this step on January 2, 2022'); cy.get('va-card > a') .should('contain', 'Learn more about this step') .click() @@ -408,23 +408,50 @@ class TrackClaimsPageV2 { 'Your claim was decided', ); } else { + // Verify some tracked items on page 1 + cy.get('.recent-activity-container > ol > li > p').should( + 'contain', + 'We completed a review for the request: "Automated 5103 Notice Response"', + ); + cy.get('.recent-activity-container > ol > li > p').should( + 'contain', + 'We opened a request: "Automated 5103 Notice Response"', + ); + cy.get('.recent-activity-container > ol > li > p').should( + 'contain', + 'We closed a request: "Closed Tracked Item"', + ); + // click the next page cy.get('.recent-activity-container va-pagination') .shadow() .find( - '.usa-pagination__list > li.usa-pagination__item.usa-pagination__arrow > a', + '.usa-pagination__list > li.usa-pagination__item.usa-pagination__arrow > a.usa-pagination__next-page', ) .click(); + // Verify some tracked items on page 2 cy.get('.recent-activity-container > ol > li > p').should( 'contain', - 'We received your claim in our system', + 'Your claim moved into Step 3: Evidence gathering', ); cy.get('.recent-activity-container > ol > li > p').should( 'contain', - 'Your claim moved into Step 2: Initial review', + 'We opened a request: "Closed Tracked Item"', ); + // click the next page + cy.get('.recent-activity-container va-pagination') + .shadow() + .find( + '.usa-pagination__list > li.usa-pagination__item.usa-pagination__arrow > a.usa-pagination__next-page', + ) + .click(); + // Verify some tracked items on page 3 cy.get('.recent-activity-container > ol > li > p').should( 'contain', - 'Your claim moved into Step 3: Evidence gathering', + 'We received your claim in our system', + ); + cy.get('.recent-activity-container > ol > li > p').should( + 'contain', + 'Your claim moved into Step 2: Initial review', ); } } else if (claimClosed) { @@ -433,23 +460,50 @@ class TrackClaimsPageV2 { 'Your claim moved into Step 5: Closed', ); } else { + // Verify some tracked items on page 1 + cy.get('.recent-activity-container > ol > li > p').should( + 'contain', + 'We completed a review for the request: "Automated 5103 Notice Response"', + ); + cy.get('.recent-activity-container > ol > li > p').should( + 'contain', + 'We opened a request: "Automated 5103 Notice Response"', + ); + cy.get('.recent-activity-container > ol > li > p').should( + 'contain', + 'We closed a request: "Closed Tracked Item"', + ); + // click the next page cy.get('.recent-activity-container va-pagination') .shadow() .find( - '.usa-pagination__list > li.usa-pagination__item.usa-pagination__arrow > a', + '.usa-pagination__list > li.usa-pagination__item.usa-pagination__arrow > a.usa-pagination__next-page', ) .click(); + // Verify some tracked items on page 2 cy.get('.recent-activity-container > ol > li > p').should( 'contain', - 'Your claim moved into Step 1: Claim received', + 'Your claim moved into Step 3: Evidence gathering, review, and decision', ); cy.get('.recent-activity-container > ol > li > p').should( 'contain', - 'Your claim moved into Step 2: Initial review', + 'We opened a request: "Closed Tracked Item"', ); + // click the next page + cy.get('.recent-activity-container va-pagination') + .shadow() + .find( + '.usa-pagination__list > li.usa-pagination__item.usa-pagination__arrow > a.usa-pagination__next-page', + ) + .click(); + // Verify some tracked items on page 3 cy.get('.recent-activity-container > ol > li > p').should( 'contain', - 'Your claim moved into Step 3: Evidence gathering, review, and decision', + 'Your claim moved into Step 1: Claim received', + ); + cy.get('.recent-activity-container > ol > li > p').should( + 'contain', + 'Your claim moved into Step 2: Initial review', ); } } diff --git a/src/applications/claims-status/utils/helpers.js b/src/applications/claims-status/utils/helpers.js index 2195671797f7..423da0e6f670 100644 --- a/src/applications/claims-status/utils/helpers.js +++ b/src/applications/claims-status/utils/helpers.js @@ -1209,7 +1209,7 @@ export function setPageFocus(lastPage, loading) { } // Used to get the oldest document date // Logic used in getTrackedItemDateFromStatus() -const getOldestDocumentDate = item => { +export const getOldestDocumentDate = item => { const arrDocumentDates = item.documents.map(document => document.uploadDate); return arrDocumentDates.sort()[0]; // Tried to do Math.min() here and it was erroring out };