From bca7c3b38edfff8a65251444ceaff0b3862622e0 Mon Sep 17 00:00:00 2001 From: Vitalii Menshutin <133991282+vmenshutin-bylight@users.noreply.github.com> Date: Wed, 18 Dec 2024 17:05:23 -0500 Subject: [PATCH] MHV-64020: Grouping Medications: Changes to med list (#33632) * MHV-64020: Grouping Medications: Changes to med list * updated rxApi * feature flag updates * e2e updates updated pagination and added download pdf tests back * fixed failing unit test --------- Co-authored-by: raji.venkatesh --- .../mhv-medications/actions/prescriptions.js | 9 +++++- src/applications/mhv-medications/api/rxApi.js | 11 +++++-- .../MedicationsList/MedicationsList.jsx | 6 ++-- .../components/shared/ExtraDetails.jsx | 5 ++- .../containers/LandingPage.jsx | 4 +++ .../containers/Prescriptions.jsx | 11 ++++++- .../shared/ExtraDetails.unit.spec.jsx | 4 ++- ...-download-pdf-details-page.cypress.spec.js | 2 +- ...ons-download-pdf-list-page.cypress.spec.js | 2 +- ...ns-pagination-details-page.cypress.spec.js | 6 ++-- ...etically-by-name-list-page.cypress.spec.js | 4 +-- ...lt-prescriptions-list-page.cypress.spec.js | 4 +-- ...ast-filled-first-list-page.cypress.spec.js | 4 +-- ...crumb-list-page-navigation.cypress.spec.js | 8 ++--- ...lidate-browser-back-button.cypress.spec.js | 2 +- ...r-active-refill-in-process.cypress.spec.js | 5 ++- ...n-for-non-VA-prescriptions.cypress.spec.js | 5 ++- .../tests/e2e/pages/MedicationsListPage.js | 11 +++---- .../tests/e2e/pages/MedicationsRefillPage.js | 6 +--- .../tests/e2e/utils/constants.js | 32 ++++++++++--------- .../mhv-medications/util/selectors.js | 2 +- 21 files changed, 86 insertions(+), 57 deletions(-) diff --git a/src/applications/mhv-medications/actions/prescriptions.js b/src/applications/mhv-medications/actions/prescriptions.js index c1d594c3b5d4..9b4d53e48e2a 100644 --- a/src/applications/mhv-medications/actions/prescriptions.js +++ b/src/applications/mhv-medications/actions/prescriptions.js @@ -13,9 +13,14 @@ import { export const getPrescriptionsPaginatedSortedList = ( pageNumber, sortEndpoint, + perPage, ) => async dispatch => { try { - const response = await getPaginatedSortedList(pageNumber, sortEndpoint); + const response = await getPaginatedSortedList( + pageNumber, + sortEndpoint, + perPage, + ); dispatch({ type: Actions.Prescriptions.GET_PAGINATED_SORTED_LIST, response, @@ -33,12 +38,14 @@ export const getPaginatedFilteredList = ( pageNumber, filterOption, sortEndpoint, + perPage, ) => async dispatch => { try { const response = await getFilteredList( pageNumber, filterOption, sortEndpoint, + perPage, ); dispatch({ type: Actions.Prescriptions.GET_PAGINATED_FILTERED_LIST, diff --git a/src/applications/mhv-medications/api/rxApi.js b/src/applications/mhv-medications/api/rxApi.js index 8c9a12e2a9e1..0b53773c7d37 100644 --- a/src/applications/mhv-medications/api/rxApi.js +++ b/src/applications/mhv-medications/api/rxApi.js @@ -74,9 +74,13 @@ export const getDocumentation = id => { }; // **Remove once filter feature is developed and live.** -export const getPaginatedSortedList = (pageNumber = 1, sortEndpoint = '') => { +export const getPaginatedSortedList = ( + pageNumber = 1, + sortEndpoint = '', + perPage = 10, +) => { return apiRequest( - `${apiBasePath}/prescriptions?page=${pageNumber}&per_page=20${sortEndpoint}`, + `${apiBasePath}/prescriptions?page=${pageNumber}&per_page=${perPage}${sortEndpoint}`, { headers }, ); }; @@ -85,9 +89,10 @@ export const getFilteredList = ( pageNumber = 1, filterOption = '', sortEndpoint = '', + perPage = 10, ) => { return apiRequest( - `${apiBasePath}/prescriptions?page=${pageNumber}&per_page=20${filterOption}${sortEndpoint}`, + `${apiBasePath}/prescriptions?page=${pageNumber}&per_page=${perPage}${filterOption}${sortEndpoint}`, { headers }, ); }; diff --git a/src/applications/mhv-medications/components/MedicationsList/MedicationsList.jsx b/src/applications/mhv-medications/components/MedicationsList/MedicationsList.jsx index 8885a65678b7..a951c7f9047f 100644 --- a/src/applications/mhv-medications/components/MedicationsList/MedicationsList.jsx +++ b/src/applications/mhv-medications/components/MedicationsList/MedicationsList.jsx @@ -13,10 +13,9 @@ import { } from '../../util/constants'; import PrescriptionPrintOnly from '../PrescriptionDetails/PrescriptionPrintOnly'; import { fromToNumbs } from '../../util/helpers'; -import { selectFilterFlag } from '../../util/selectors'; +import { selectFilterFlag, selectGroupingFlag } from '../../util/selectors'; const MAX_PAGE_LIST_LENGTH = 6; -const perPage = 20; const MedicationsList = props => { const history = useHistory(); const { @@ -35,6 +34,9 @@ const MedicationsList = props => { state => state.rx.prescriptions?.prescriptionDetails?.prescriptionId, ); const showFilterContent = useSelector(selectFilterFlag); + const showGroupingFlag = useSelector(selectGroupingFlag); + + const perPage = showGroupingFlag ? 10 : 20; const displaynumberOfPrescriptionsSelector = ".no-print [data-testid='page-total-info']"; diff --git a/src/applications/mhv-medications/components/shared/ExtraDetails.jsx b/src/applications/mhv-medications/components/shared/ExtraDetails.jsx index 157e95b32c30..724b28519645 100644 --- a/src/applications/mhv-medications/components/shared/ExtraDetails.jsx +++ b/src/applications/mhv-medications/components/shared/ExtraDetails.jsx @@ -47,7 +47,7 @@ const ExtraDetails = rx => { data-testid="rx-refillinprocess-info" className="vads-u-margin-y--0" > - We expect to fill it on{' '} + We expect to fill this prescription on{' '} {dateFormat(rx.refillDate, 'MMMM D, YYYY')}.

@@ -127,8 +127,7 @@ const ExtraDetails = rx => { )} {dispStatus === dispStatusObj.nonVA && (

- This isn’t a prescription that you filled through a VA pharmacy. You - can’t manage this medication in this online tool. + You can’t manage this medication in this online tool.

)} {dispStatus === dispStatusObj.onHold && ( diff --git a/src/applications/mhv-medications/containers/LandingPage.jsx b/src/applications/mhv-medications/containers/LandingPage.jsx index 348593898e04..40edac5feba4 100644 --- a/src/applications/mhv-medications/containers/LandingPage.jsx +++ b/src/applications/mhv-medications/containers/LandingPage.jsx @@ -23,6 +23,7 @@ import { import { selectAllergiesFlag, selectFilterFlag, + selectGroupingFlag, selectRefillContentFlag, } from '../util/selectors'; import ApiErrorNotification from '../components/shared/ApiErrorNotification'; @@ -59,6 +60,7 @@ const LandingPage = () => { const showRefillContent = useSelector(selectRefillContentFlag); const showAllergiesContent = useSelector(selectAllergiesFlag); const showFilterContent = useSelector(selectFilterFlag); + const showGroupingFlag = useSelector(selectGroupingFlag); const manageMedicationsHeader = useRef(); const manageMedicationsAccordionSection = useRef(); @@ -102,6 +104,7 @@ const LandingPage = () => { getPrescriptionsPaginatedSortedList( 1, rxListSortingOptions[defaultSelectedSortOption].API_ENDPOINT, + showGroupingFlag ? 10 : 20, ), ) .then(() => setIsPrescriptionsLoading(false)) @@ -122,6 +125,7 @@ const LandingPage = () => { 1, filterOptions.ALL_MEDICATIONS.url, sortEndpoint, + showGroupingFlag ? 10 : 20, ), ) .then(() => setIsPrescriptionsLoading(false)) diff --git a/src/applications/mhv-medications/containers/Prescriptions.jsx b/src/applications/mhv-medications/containers/Prescriptions.jsx index 1b58707a760e..e5bbb73d500d 100644 --- a/src/applications/mhv-medications/containers/Prescriptions.jsx +++ b/src/applications/mhv-medications/containers/Prescriptions.jsx @@ -55,6 +55,7 @@ import Alert from '../components/shared/Alert'; import { selectAllergiesFlag, selectFilterFlag, + selectGroupingFlag, selectRefillContentFlag, } from '../util/selectors'; import PrescriptionsPrintOnly from './PrescriptionsPrintOnly'; @@ -89,6 +90,7 @@ const Prescriptions = () => { const showAllergiesContent = useSelector(selectAllergiesFlag); // **Remove sort funtions and logic once filter feature is developed and live.** const showFilterContent = useSelector(selectFilterFlag); + const showGroupingContent = useSelector(selectGroupingFlag); const pagination = useSelector( showFilterContent ? state => state.rx.prescriptions?.prescriptionsFilteredPagination @@ -141,7 +143,12 @@ const Prescriptions = () => { `${isFiltering ? 'Filtering' : 'Sorting'} your medications...`, ); dispatch( - getPaginatedFilteredList(1, filterOptions[filterBy]?.url, sortBy), + getPaginatedFilteredList( + 1, + filterOptions[filterBy]?.url, + sortBy, + showGroupingContent ? 10 : 20, + ), ).then(() => { updateLoadingStatus(false, ''); focusElement(document.getElementById('showingRx')); @@ -240,6 +247,7 @@ const Prescriptions = () => { getPrescriptionsPaginatedSortedList( page ?? 1, rxListSortingOptions[sortOption].API_ENDPOINT, + showGroupingContent ? 10 : 20, ), ).then(() => updateLoadingStatus(false, '')); if (!selectedSortOption) updateSortOption(sortOption); @@ -315,6 +323,7 @@ const Prescriptions = () => { storedPageNumber, filterOptions[storedFilterOption]?.url, sortEndpoint, + showGroupingContent ? 10 : 20, ), ).then(() => updateLoadingStatus(false, '')); } diff --git a/src/applications/mhv-medications/tests/components/shared/ExtraDetails.unit.spec.jsx b/src/applications/mhv-medications/tests/components/shared/ExtraDetails.unit.spec.jsx index 16291bc8b6dc..1dd66eb524da 100644 --- a/src/applications/mhv-medications/tests/components/shared/ExtraDetails.unit.spec.jsx +++ b/src/applications/mhv-medications/tests/components/shared/ExtraDetails.unit.spec.jsx @@ -40,7 +40,9 @@ describe('Medications List Card Extra Details', () => { const expectedDate = dateFormat(prescription.refillDate, 'MMMM D, YYYY'); expect( await screen.findByTestId('rx-refillinprocess-info'), - ).to.contain.text(`We expect to fill it on ${expectedDate}.`); + ).to.contain.text( + `We expect to fill this prescription on ${expectedDate}.`, + ); }); it('displays submitted content correctly', async () => { diff --git a/src/applications/mhv-medications/tests/e2e/medications-download-pdf-details-page.cypress.spec.js b/src/applications/mhv-medications/tests/e2e/medications-download-pdf-details-page.cypress.spec.js index e8b68a4b0e01..bb071749bbf0 100644 --- a/src/applications/mhv-medications/tests/e2e/medications-download-pdf-details-page.cypress.spec.js +++ b/src/applications/mhv-medications/tests/e2e/medications-download-pdf-details-page.cypress.spec.js @@ -6,7 +6,7 @@ import mockPrescriptionDetails from './fixtures/prescription-details.json'; import MedicationsLandingPage from './pages/MedicationsLandingPage'; describe('Medications Details Page Download', () => { - it.skip('visits Medications Details Page Download PDF Dropdown', () => { + it('visits Medications Details Page Download PDF Dropdown', () => { const site = new MedicationsSite(); const listPage = new MedicationsListPage(); const detailsPage = new MedicationsDetailsPage(); diff --git a/src/applications/mhv-medications/tests/e2e/medications-download-pdf-list-page.cypress.spec.js b/src/applications/mhv-medications/tests/e2e/medications-download-pdf-list-page.cypress.spec.js index 954738c8b402..6c5f7754de73 100644 --- a/src/applications/mhv-medications/tests/e2e/medications-download-pdf-list-page.cypress.spec.js +++ b/src/applications/mhv-medications/tests/e2e/medications-download-pdf-list-page.cypress.spec.js @@ -4,7 +4,7 @@ import MedicationsLandingPage from './pages/MedicationsLandingPage'; import MedicationsListPage from './pages/MedicationsListPage'; describe('Medications Download PDF on Medications List Page', () => { - it.skip('visits download pdf on list page', () => { + it('visits download pdf on list page', () => { const site = new MedicationsSite(); const listPage = new MedicationsListPage(); const landingPage = new MedicationsLandingPage(); diff --git a/src/applications/mhv-medications/tests/e2e/medications-pagination-details-page.cypress.spec.js b/src/applications/mhv-medications/tests/e2e/medications-pagination-details-page.cypress.spec.js index 6bed19b497dc..89aa81077ab3 100644 --- a/src/applications/mhv-medications/tests/e2e/medications-pagination-details-page.cypress.spec.js +++ b/src/applications/mhv-medications/tests/e2e/medications-pagination-details-page.cypress.spec.js @@ -26,10 +26,10 @@ describe('Medications List Page Pagination', () => { listPage.clickGotoMedicationsLink(); // cy.get('[href="/my-health/medications/"]').click(); // site.loadVAPaginationPrescriptions(1, mockRxPageOne); - site.verifyPaginationPrescriptionsDisplayed(1, 20, threadLength); + site.verifyPaginationPrescriptionsDisplayed(1, 10, threadLength); site.loadVAPaginationNextPrescriptions(2, mockRxPageTwo); - site.verifyPaginationPrescriptionsDisplayed(21, 29, threadLength); + site.verifyPaginationPrescriptionsDisplayed(11, 20, threadLength); site.loadVAPaginationPreviousPrescriptions(1, mockRxPageOne, 20); - site.verifyPaginationPrescriptionsDisplayed(1, 20, threadLength); + site.verifyPaginationPrescriptionsDisplayed(1, 10, threadLength); }); }); diff --git a/src/applications/mhv-medications/tests/e2e/medications-sort-alphabetically-by-name-list-page.cypress.spec.js b/src/applications/mhv-medications/tests/e2e/medications-sort-alphabetically-by-name-list-page.cypress.spec.js index cd8d23fde55c..943b9a2c5390 100644 --- a/src/applications/mhv-medications/tests/e2e/medications-sort-alphabetically-by-name-list-page.cypress.spec.js +++ b/src/applications/mhv-medications/tests/e2e/medications-sort-alphabetically-by-name-list-page.cypress.spec.js @@ -32,7 +32,7 @@ describe('Medications List Page Sort Alphabetically By Name', () => { }); listPage.clickGotoMedicationsLink(); - site.verifyPaginationPrescriptionsDisplayed(1, 20, listLength); + site.verifyPaginationPrescriptionsDisplayed(1, 10, listLength); // site.loadVAPaginationNextPrescriptions(2, mockRxPageTwo); listPage.selectSortDropDownOption( 'Alphabetically by name', @@ -41,7 +41,7 @@ describe('Medications List Page Sort Alphabetically By Name', () => { listPage.loadRxAfterSortAlphabeticallyByName(); listPage.verifyPaginationDisplayedforSortAlphabeticallyByName( 1, - 20, + 10, listLength, ); }); diff --git a/src/applications/mhv-medications/tests/e2e/medications-sort-default-prescriptions-list-page.cypress.spec.js b/src/applications/mhv-medications/tests/e2e/medications-sort-default-prescriptions-list-page.cypress.spec.js index c8d4bfbf8b45..cfc7fe767273 100644 --- a/src/applications/mhv-medications/tests/e2e/medications-sort-default-prescriptions-list-page.cypress.spec.js +++ b/src/applications/mhv-medications/tests/e2e/medications-sort-default-prescriptions-list-page.cypress.spec.js @@ -35,7 +35,7 @@ describe('Medications List Page Sort Alphabetically By Status', () => { }); listPage.clickGotoMedicationsLink(); // site.loadVAPaginationPrescriptions(1, mockRxPageOne); - site.verifyPaginationPrescriptionsDisplayed(1, 20, listLength); + site.verifyPaginationPrescriptionsDisplayed(1, 10, listLength); // site.loadVAPaginationNextPrescriptions(2, mockRxPageTwo); listPage.selectSortDropDownOption( 'Alphabetically by status', @@ -44,7 +44,7 @@ describe('Medications List Page Sort Alphabetically By Status', () => { listPage.loadRxDefaultSortAlphabeticallyByStatus(); listPage.verifyPaginationDisplayedforSortAlphabeticallyByStatus( 1, - 20, + 10, listLength, ); }); diff --git a/src/applications/mhv-medications/tests/e2e/medications-sort-last-filled-first-list-page.cypress.spec.js b/src/applications/mhv-medications/tests/e2e/medications-sort-last-filled-first-list-page.cypress.spec.js index 66bf47486c9b..ccce06d76045 100644 --- a/src/applications/mhv-medications/tests/e2e/medications-sort-last-filled-first-list-page.cypress.spec.js +++ b/src/applications/mhv-medications/tests/e2e/medications-sort-last-filled-first-list-page.cypress.spec.js @@ -35,13 +35,13 @@ describe('Medications List Page Sort By Last Filled First', () => { }); listPage.clickGotoMedicationsLink(); // site.loadVAPaginationPrescriptions(1, mockRxPageOne); - site.verifyPaginationPrescriptionsDisplayed(1, 20, listLength); + site.verifyPaginationPrescriptionsDisplayed(1, 10, listLength); // site.loadVAPaginationNextPrescriptions(2, mockRxPageTwo); listPage.selectSortDropDownOption( 'Last filled first', Paths.SORT_BY_LAST_FILLED, ); listPage.loadRxAfterSortLastFilledFirst(); - listPage.verifyPaginationDisplayedforSortLastFilledFirst(1, 20, listLength); + listPage.verifyPaginationDisplayedforSortLastFilledFirst(1, 10, listLength); }); }); diff --git a/src/applications/mhv-medications/tests/e2e/medications-validate-breadcrumb-list-page-navigation.cypress.spec.js b/src/applications/mhv-medications/tests/e2e/medications-validate-breadcrumb-list-page-navigation.cypress.spec.js index 463a602527e1..d185929b3dad 100644 --- a/src/applications/mhv-medications/tests/e2e/medications-validate-breadcrumb-list-page-navigation.cypress.spec.js +++ b/src/applications/mhv-medications/tests/e2e/medications-validate-breadcrumb-list-page-navigation.cypress.spec.js @@ -27,14 +27,14 @@ describe('Medications Breadcrumb Navigation To List Page', () => { cy.injectAxe(); cy.axeCheck('main'); listPage.clickGotoMedicationsLink(); - site.verifyPaginationPrescriptionsDisplayed(1, 20, listLength); + site.verifyPaginationPrescriptionsDisplayed(1, 10, listLength); site.loadVAPaginationNextPrescriptions(2, mockRxPageTwo); - site.verifyPaginationPrescriptionsDisplayed(21, 29, listLength); + site.verifyPaginationPrescriptionsDisplayed(11, 20, listLength); detailsPage.clickMedicationHistoryAndDetailsLink(prescriptionDetails); detailsPage.clickMedicationsListPageTwoBreadcrumbsOnDetailsPage(); listPage.verifyNavigationToListPageTwoAfterClickingBreadcrumbMedications( - 21, - 29, + 11, + 20, listLength, ); }); diff --git a/src/applications/mhv-medications/tests/e2e/medications-validate-browser-back-button.cypress.spec.js b/src/applications/mhv-medications/tests/e2e/medications-validate-browser-back-button.cypress.spec.js index a7bcc0da20bd..d851c86ec6f4 100644 --- a/src/applications/mhv-medications/tests/e2e/medications-validate-browser-back-button.cypress.spec.js +++ b/src/applications/mhv-medications/tests/e2e/medications-validate-browser-back-button.cypress.spec.js @@ -24,6 +24,6 @@ describe('Medications details Page Back Browser', () => { site.loadVAPaginationNextPrescriptions(2, mockRxPageTwo); detailsPage.clickMedicationHistoryAndDetailsLink(mockPrescriptionDetails); cy.go('back'); - site.verifyPaginationPrescriptionsDisplayed(21, 29, threadLength); + site.verifyPaginationPrescriptionsDisplayed(11, 20, threadLength); }); }); diff --git a/src/applications/mhv-medications/tests/e2e/medications-validate-information-for-active-refill-in-process.cypress.spec.js b/src/applications/mhv-medications/tests/e2e/medications-validate-information-for-active-refill-in-process.cypress.spec.js index a84ef236b03d..c11a59dc09e9 100644 --- a/src/applications/mhv-medications/tests/e2e/medications-validate-information-for-active-refill-in-process.cypress.spec.js +++ b/src/applications/mhv-medications/tests/e2e/medications-validate-information-for-active-refill-in-process.cypress.spec.js @@ -1,6 +1,7 @@ import MedicationsSite from './med_site/MedicationsSite'; import MedicationsLandingPage from './pages/MedicationsLandingPage'; import MedicationsListPage from './pages/MedicationsListPage'; +import { Data } from './utils/constants'; describe('Medications List Page Information based on Medication Status', () => { it('verify information on list view for active refill in process', () => { @@ -12,6 +13,8 @@ describe('Medications List Page Information based on Medication Status', () => { cy.injectAxe(); cy.axeCheck('main'); listPage.clickGotoMedicationsLink(); - listPage.verifyInformationBasedOnStatusActiveRefillInProcess(); + listPage.verifyInformationBasedOnStatusActiveRefillInProcess( + Data.ACTIVE_REFILL_IN_PROCESS, + ); }); }); diff --git a/src/applications/mhv-medications/tests/e2e/medications-validate-information-for-non-VA-prescriptions.cypress.spec.js b/src/applications/mhv-medications/tests/e2e/medications-validate-information-for-non-VA-prescriptions.cypress.spec.js index 00188efbb9d6..125fae8256a0 100644 --- a/src/applications/mhv-medications/tests/e2e/medications-validate-information-for-non-VA-prescriptions.cypress.spec.js +++ b/src/applications/mhv-medications/tests/e2e/medications-validate-information-for-non-VA-prescriptions.cypress.spec.js @@ -1,6 +1,7 @@ import MedicationsSite from './med_site/MedicationsSite'; import MedicationsLandingPage from './pages/MedicationsLandingPage'; import MedicationsListPage from './pages/MedicationsListPage'; +import { Data } from './utils/constants'; describe('Medications List Page Information based on Medication Status', () => { it('verify information on list view for non-VA prescriptions', () => { @@ -12,6 +13,8 @@ describe('Medications List Page Information based on Medication Status', () => { cy.injectAxe(); cy.axeCheck('main'); listPage.clickGotoMedicationsLink(); - listPage.verifyInformationBasedOnStatusNonVAPrescription(); + listPage.verifyInformationBasedOnStatusNonVAPrescription( + Data.ACTIVE_NON_VA, + ); }); }); diff --git a/src/applications/mhv-medications/tests/e2e/pages/MedicationsListPage.js b/src/applications/mhv-medications/tests/e2e/pages/MedicationsListPage.js index b4dfa3bd2c88..f0bbdf284b13 100644 --- a/src/applications/mhv-medications/tests/e2e/pages/MedicationsListPage.js +++ b/src/applications/mhv-medications/tests/e2e/pages/MedicationsListPage.js @@ -326,22 +326,19 @@ class MedicationsListPage { .and('be.visible'); }; - verifyInformationBasedOnStatusActiveRefillInProcess = () => { + verifyInformationBasedOnStatusActiveRefillInProcess = text => { cy.get('[data-testid="rx-refillinprocess-info"]') .should('exist') .and('be.visible') - .and('contain', 'We expect to fill it on'); + .and('contain', text); }; - verifyInformationBasedOnStatusNonVAPrescription = () => { + verifyInformationBasedOnStatusNonVAPrescription = text => { cy.get('[data-testid="rx-last-filled-info"]').should('be.visible'); cy.get('[data-testid="non-VA-prescription"]') .should('be.visible') - .and( - 'contain', - 'This isn’t a prescription that you filled through a VA pharmacy. You can’t manage this medication in this online tool.', - ); + .and('contain', text); }; verifyInformationBasedOnStatusActiveParked = () => { diff --git a/src/applications/mhv-medications/tests/e2e/pages/MedicationsRefillPage.js b/src/applications/mhv-medications/tests/e2e/pages/MedicationsRefillPage.js index 03c75b12b76d..f6c738aea799 100644 --- a/src/applications/mhv-medications/tests/e2e/pages/MedicationsRefillPage.js +++ b/src/applications/mhv-medications/tests/e2e/pages/MedicationsRefillPage.js @@ -434,11 +434,7 @@ class MedicationsRefillPage { }; clickMedicationsListPageLinkOnRefillSuccessAlertOnRefillsPage = () => { - cy.intercept( - 'GET', - '/my_health/v1/prescriptions?page=1&per_page=20&sort[]=disp_status&sort[]=prescription_name&sort[]=dispensed_date', - medicationsList, - ).as('medicationsList'); + cy.intercept('GET', Paths.MED_LIST, medicationsList).as('medicationsList'); cy.intercept( 'GET', '/my_health/v1/prescriptions?&sort[]=disp_status&sort[]=prescription_name&sort[]=dispensed_date&include_image=true', diff --git a/src/applications/mhv-medications/tests/e2e/utils/constants.js b/src/applications/mhv-medications/tests/e2e/utils/constants.js index c957b3891362..1a6073059e0f 100644 --- a/src/applications/mhv-medications/tests/e2e/utils/constants.js +++ b/src/applications/mhv-medications/tests/e2e/utils/constants.js @@ -1,39 +1,41 @@ export const Data = { - PAGINATION_TEXT: 'Showing 1 - 20 of 29 medications', + PAGINATION_TEXT: 'Showing 1 - 10 of 29 medications', PAGINATION_ALL_MEDICATIONS: - 'Showing 1 - 20 of 29 medications, alphabetically by status', + 'Showing 1 - 10 of 29 medications, alphabetically by status', PAGINATION_ACTIVE_TEXT: - 'Showing 1 - 20 of 29 active medications, alphabetically by status', + 'Showing 1 - 10 of 29 active medications, alphabetically by status', PAGINATION_RENEW: - 'Showing 1 - 20 of 29 renewal needed before refill medications, alphabetically by status', + 'Showing 1 - 10 of 29 renewal needed before refill medications, alphabetically by status', PAGINATION_NON_ACTIVE: - 'Showing 1 - 15 of 15 non-active medications, alphabetically by status', + 'Showing 1 - 10 of 15 non-active medications, alphabetically by status', PAGINATION_RECENTLY_REQUESTED: - 'Showing 1 - 20 of 29 recently requested medications, alphabetically by status', + 'Showing 1 - 10 of 29 recently requested medications, alphabetically by status', + ACTIVE_REFILL_IN_PROCESS: 'We expect to fill this prescription on', + ACTIVE_NON_VA: 'You can’t manage this medication in this online tool.', }; export const Paths = { LANDING_LIST: - '/my_health/v1/prescriptions?page=1&per_page=20&sort[]=disp_status&sort[]=prescription_name&sort[]=dispensed_date', + '/my_health/v1/prescriptions?page=1&per_page=10&sort[]=disp_status&sort[]=prescription_name&sort[]=dispensed_date', MED_LIST: - '/my_health/v1/prescriptions?page=1&per_page=20&sort[]=disp_status&sort[]=prescription_name&sort[]=dispensed_date', + '/my_health/v1/prescriptions?page=1&per_page=10&sort[]=disp_status&sort[]=prescription_name&sort[]=dispensed_date', SORT_BY_NAME: - 'my_health/v1/prescriptions?page=1&per_page=20&sort[]=prescription_name&sort[]=dispensed_date', + 'my_health/v1/prescriptions?page=1&per_page=10&sort[]=prescription_name&sort[]=dispensed_date', SORT_BY_LAST_FILLED: - 'my_health/v1/prescriptions?page=1&per_page=20&sort[]=-dispensed_date&sort[]=prescription_name', + 'my_health/v1/prescriptions?page=1&per_page=10&sort[]=-dispensed_date&sort[]=prescription_name', SORT_BY_STATUS: '&sort[]=disp_status&sort[]=prescription_name&sort[]=dispensed_date', ACTIVE_FILTER: - '/my_health/v1/prescriptions?page=1&per_page=20&filter[[disp_status][eq]]=Active,Active:%20Refill%20in%20Process,Active:%20Non-VA,Active:%20On%20hold,Active:%20Parked,Active:%20Submitted&sort[]=disp_status&sort[]=prescription_name&sort[]=dispensed_date', + '/my_health/v1/prescriptions?page=1&per_page=10&filter[[disp_status][eq]]=Active,Active:%20Refill%20in%20Process,Active:%20Non-VA,Active:%20On%20hold,Active:%20Parked,Active:%20Submitted&sort[]=disp_status&sort[]=prescription_name&sort[]=dispensed_date', INTERCEPT: { PAGINATION_NEXT: - '/my_health/v1/prescriptions?page=2&per_page=20&sort[]=disp_status&sort[]=prescription_name&sort[]=dispensed_date', + '/my_health/v1/prescriptions?page=2&per_page=10&sort[]=disp_status&sort[]=prescription_name&sort[]=dispensed_date', RECENTLY_REQUESTED_FILTER_LIST: - '/my_health/v1/prescriptions?page=1&per_page=20&filter[[disp_status][eq]]=Active:%20Refill%20in%20Process,Active:%20Submitted&sort[]=disp_status&sort[]=prescription_name&sort[]=dispensed_date', + '/my_health/v1/prescriptions?page=1&per_page=10&filter[[disp_status][eq]]=Active:%20Refill%20in%20Process,Active:%20Submitted&sort[]=disp_status&sort[]=prescription_name&sort[]=dispensed_date', RENEW_FILTER_LIST: - 'my_health/v1/prescriptions?page=1&per_page=20&filter[[disp_status][eq]]=Active,Expired&sort[]=disp_status&sort[]=prescription_name&sort[]=dispensed_date', + 'my_health/v1/prescriptions?page=1&per_page=10&filter[[disp_status][eq]]=Active,Expired&sort[]=disp_status&sort[]=prescription_name&sort[]=dispensed_date', NON_ACTIVE_FILTER_LIST: - '/my_health/v1/prescriptions?page=1&per_page=20&filter[[disp_status][eq]]=Discontinued,Expired,Transferred,Unknown&sort[]=disp_status&sort[]=prescription_name&sort[]=dispensed_date', + '/my_health/v1/prescriptions?page=1&per_page=10&filter[[disp_status][eq]]=Discontinued,Expired,Transferred,Unknown&sort[]=disp_status&sort[]=prescription_name&sort[]=dispensed_date', }, }; export const Alerts = { diff --git a/src/applications/mhv-medications/util/selectors.js b/src/applications/mhv-medications/util/selectors.js index db79e024ccf0..d1a2cbb7fab6 100644 --- a/src/applications/mhv-medications/util/selectors.js +++ b/src/applications/mhv-medications/util/selectors.js @@ -9,5 +9,5 @@ export const selectAllergiesFlag = state => export const selectFilterFlag = state => state.featureToggles[FEATURE_FLAG_NAMES.mhvMedicationsDisplayFilter]; -export const selectgroupingFlag = state => +export const selectGroupingFlag = state => state.featureToggles[FEATURE_FLAG_NAMES.mhvMedicationsDisplayGrouping];