Skip to content

Commit

Permalink
e2e previous prescriptions
Browse files Browse the repository at this point in the history
added e2e for previous prescriptions
  • Loading branch information
RajiVenkatesh18 committed Jan 3, 2025
1 parent 8dd6f24 commit d94479f
Show file tree
Hide file tree
Showing 6 changed files with 5,180 additions and 0 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import MedicationsSite from './med_site/MedicationsSite';
import MedicationsLandingPage from './pages/MedicationsLandingPage';
import medicationsList from './fixtures/grouped-prescriptions-list.json';
import MedicationsDetailsPage from './pages/MedicationsDetailsPage';
import olderRxDetails from './fixtures/older-prescription-details.json';
import { Data } from './utils/constants';

describe('Medications Details Page Grouping', () => {
it('visits Medications Details Page Grouping Pagination', () => {
const site = new MedicationsSite();
const landingPage = new MedicationsLandingPage();
const detailsPage = new MedicationsDetailsPage();
site.login();
landingPage.visitLandingPageURL();
landingPage.visitMedicationsListPage(medicationsList);
cy.injectAxe();
cy.axeCheck('main');
detailsPage.clickMedicationDetailsLink(olderRxDetails, 2);
detailsPage.verifyPreviousPrescriptionsPaginationTextOnDetailsPage(
Data.PREVIOUS_PRESCRIPTION_PAGINATION,
);
detailsPage.clickNextButtonForPreviousPrescriptionPagination();
detailsPage.verifyPaginationTextIsFocusedAfterClickingNext(
Data.PREVIOUS_PRESCRIPTION_PAGINATION_SECOND,
);
detailsPage.clickNextButtonForPreviousPrescriptionPagination();
detailsPage.verifyPaginationTextIsFocusedAfterClickingNext(
Data.PREVIOUS_PRESCRIPTION_PAGINATION_THIRD,
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,20 @@ class MedicationsDetailsPage {
'Download a text file',
);
};

verifyPreviousPrescriptionsPaginationTextOnDetailsPage = text => {
cy.get('[data-testid="grouping-showing-info"]').should('have.text', text);
};

clickNextButtonForPreviousPrescriptionPagination = () => {
cy.contains('Next').click({ force: true });
};

verifyPaginationTextIsFocusedAfterClickingNext = text => {
cy.get('[data-testid="grouping-showing-info"]')
.should('have.text', text)
.and('have.focus');
};
}

export default MedicationsDetailsPage;
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import emptyPrescriptionsList from '../fixtures/empty-prescriptions-list.json';
import prescriptions from '../fixtures/prescriptions.json';
import { Paths } from '../utils/constants';
import rxList from '../fixtures/listOfPrescriptions.json';
import allergies from '../fixtures/allergies.json';

class MedicationsLandingPage {
clickExpandAllAccordionButton = () => {
Expand Down Expand Up @@ -130,5 +131,18 @@ class MedicationsLandingPage {
cy.visit(medicationsUrls.MEDICATIONS_ABOUT);
cy.intercept('GET', Paths.LANDING_LIST, emptyPrescriptionsList);
};

visitMedicationsListPage = prescriptionsList => {
cy.intercept('GET', `${Paths.MED_LIST}`).as('medicationsList');
cy.intercept(
'GET',
'/my_health/v1/medical_records/allergies',
allergies,
).as('allergies');
cy.intercept('GET', Paths.MED_LIST, prescriptionsList).as(
'medicationsList',
);
cy.get('[data-testid ="prescriptions-nav-link"]').click({ force: true });
};
}
export default MedicationsLandingPage;
6 changes: 6 additions & 0 deletions src/applications/mhv-medications/tests/e2e/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ export const Data = {
'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.',
PREVIOUS_PRESCRIPTION_PAGINATION:
'Showing 1 - 10 of 26 prescriptions, from newest to oldest',
PREVIOUS_PRESCRIPTION_PAGINATION_SECOND:
'Showing 11 - 20 of 26 prescriptions, from newest to oldest',
PREVIOUS_PRESCRIPTION_PAGINATION_THIRD:
'Showing 21 - 26 of 26 prescriptions, from newest to oldest',
};
export const Paths = {
LANDING_LIST:
Expand Down

0 comments on commit d94479f

Please sign in to comment.