From f4194937eeb5eeb4353c4043f1faf3901e4af0e1 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Wed, 9 Oct 2024 01:29:43 +0200 Subject: [PATCH 1/2] patient export test (#8745) --- .../e2e/patient_spec/PatientHomepage.cy.ts | 12 +++++++ cypress/pageobject/Patient/PatientHome.ts | 31 +++++++++++++++++++ src/Components/Patient/ManagePatients.tsx | 2 +- 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/cypress/e2e/patient_spec/PatientHomepage.cy.ts b/cypress/e2e/patient_spec/PatientHomepage.cy.ts index c1575057fe4..0cf5936594d 100644 --- a/cypress/e2e/patient_spec/PatientHomepage.cy.ts +++ b/cypress/e2e/patient_spec/PatientHomepage.cy.ts @@ -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"]') diff --git a/cypress/pageobject/Patient/PatientHome.ts b/cypress/pageobject/Patient/PatientHome.ts index 94801cd4bb8..d2f4efdc877 100644 --- a/cypress/pageobject/Patient/PatientHome.ts +++ b/cypress/pageobject/Patient/PatientHome.ts @@ -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; diff --git a/src/Components/Patient/ManagePatients.tsx b/src/Components/Patient/ManagePatients.tsx index 3f15544a50a..e5ee70163ea 100644 --- a/src/Components/Patient/ManagePatients.tsx +++ b/src/Components/Patient/ManagePatients.tsx @@ -891,7 +891,7 @@ export const PatientManager = () => { selected={qParams.ordering} onSelect={updateQuery} /> -
+
{!isExportAllowed ? ( { From 207365a990a04884eef77771ffe1ce51749c8e38 Mon Sep 17 00:00:00 2001 From: Jacob John Jeevan <40040905+Jacobjeevan@users.noreply.github.com> Date: Wed, 9 Oct 2024 06:18:34 +0530 Subject: [PATCH 2/2] hide spoke heading on facility create page (#8730) --- src/Components/Facility/FacilityCreate.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Components/Facility/FacilityCreate.tsx b/src/Components/Facility/FacilityCreate.tsx index c68aa9ec0db..81bc6f48125 100644 --- a/src/Components/Facility/FacilityCreate.tsx +++ b/src/Components/Facility/FacilityCreate.tsx @@ -850,14 +850,14 @@ export const FacilityCreate = (props: FacilityProps) => { required types={["mobile", "landline"]} /> -
-

{t("spokes")}

- {facilityId && ( + {facilityId && ( +
+

{t("spokes")}

- )} -
+
+ )}