Skip to content

Commit

Permalink
patient export test (#8745)
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 authored Oct 8, 2024
1 parent 450fe02 commit f419493
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
12 changes: 12 additions & 0 deletions cypress/e2e/patient_spec/PatientHomepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ describe("Patient Homepage present functionalities", () => {
cy.awaitUrl("/patients");
});

it("Export the live patient list based on a date range", () => {
patientHome.clickPatientExport();
cy.verifyNotification("Please select a seven day period");
cy.closeNotification();
patientHome.typePatientModifiedBeforeDate("01122023");
patientHome.typePatientModifiedAfterDate("07122023");
patientHome.clickPatientFilterApply();
patientHome.interceptPatientExportRequest();
patientHome.clickPatientExport();
patientHome.verifyPatientExportRequest();
});

it("Verify the functionality of the patient tab pagination", () => {
let firstPatientPageOne: string;
cy.get('[data-cy="patient"]')
Expand Down
31 changes: 31 additions & 0 deletions cypress/pageobject/Patient/PatientHome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,36 @@ class PatientHome {
clickPreviousPage() {
cy.get("#prev-pages").click();
}

clickPatientExport() {
cy.get("#patient-export").click();
}

clickPatientFilterApply() {
cy.get("#apply-filter").click();
}

interceptPatientExportRequest() {
cy.intercept({
method: "GET",
url: "/api/v1/patient/*",
}).as("getPatients");
}

verifyPatientExportRequest() {
cy.wait("@getPatients").then((interception) => {
expect(interception.request.url).to.include("/api/v1/patient/");
expect(interception.request.url).to.include("&csv");
expect(interception.response.statusCode).to.eq(200);
});
}

typePatientModifiedBeforeDate(startDate: string) {
cy.clickAndTypeDate("input[name='modified_date_start']", startDate);
}

typePatientModifiedAfterDate(endDate: string) {
cy.clickAndTypeDate("input[name='modified_date_end']", endDate);
}
}
export default PatientHome;
2 changes: 1 addition & 1 deletion src/Components/Patient/ManagePatients.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ export const PatientManager = () => {
selected={qParams.ordering}
onSelect={updateQuery}
/>
<div className="tooltip w-full md:w-auto">
<div className="tooltip w-full md:w-auto" id="patient-export">
{!isExportAllowed ? (
<ButtonV2
onClick={() => {
Expand Down

0 comments on commit f419493

Please sign in to comment.