From 25f0e49c3cfff9f720f9f1f0bdd96ad29c46a114 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Thu, 18 Jan 2024 18:23:49 +0530 Subject: [PATCH] modify doctor capacity --- .../e2e/facility_spec/facility_manage.cy.ts | 29 +++++++++++++++++++ .../pageobject/Facility/FacilityCreation.ts | 2 +- src/Components/Facility/DoctorsCountCard.tsx | 2 ++ .../Facility/FacilityDoctorList.tsx | 7 +++-- 4 files changed, 37 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/facility_spec/facility_manage.cy.ts b/cypress/e2e/facility_spec/facility_manage.cy.ts index 67439e636dd..ff37eaedab6 100644 --- a/cypress/e2e/facility_spec/facility_manage.cy.ts +++ b/cypress/e2e/facility_spec/facility_manage.cy.ts @@ -18,6 +18,7 @@ describe("Facility Manage Functions", () => { "Health Facility config updated successfully"; const facilityHrfId = uuidv4(); const facilityUpdatedHrfId = uuidv4(); + const doctorCapacity = "5"; before(() => { loginPage.loginAsDisctrictAdmin(); @@ -98,6 +99,34 @@ describe("Facility Manage Functions", () => { facilityManage.verifyHrfIdValue(facilityUpdatedHrfId); }); + it("Modify Facility detail page doctor capacity ", () => { + // Add a doctor capacity + cy.get("#facility-add-doctortype").scrollIntoView(); + cy.get("#facility-add-doctortype").click(); + facilityPage.selectAreaOfSpecialization("General Medicine"); + facilityPage.fillDoctorCount(doctorCapacity); + facilityPage.clickdoctorcapacityaddmore(); + facilityPage.saveAndExitDoctorForm(); + facilityManage.verifySuccessMessageVisibilityAndContent( + "Doctor count added successfully" + ); + cy.get("#facility-doctor-totalcapacity").contains(doctorCapacity); + // edit a existing doctor + cy.get("#edit-facility-doctorcapacity").click(); + facilityPage.fillDoctorCount("7"); + facilityPage.clickdoctorcapacityaddmore(); + facilityManage.verifySuccessMessageVisibilityAndContent( + "Doctor count updated successfully" + ); + cy.get("#facility-doctor-totalcapacity").contains("7"); + // delete a bed + cy.get("#delete-facility-doctorcapacity").click(); + cy.get("#submit").click(); + facilityManage.verifySuccessMessageVisibilityAndContent( + "Doctor specialization type deleted successfully" + ); + }); + afterEach(() => { cy.saveLocalStorage(); }); diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts index 4297179050b..e4c3a1207d7 100644 --- a/cypress/pageobject/Facility/FacilityCreation.ts +++ b/cypress/pageobject/Facility/FacilityCreation.ts @@ -96,7 +96,7 @@ class FacilityPage { } fillDoctorCount(count: string) { - cy.get("input#count").click().type(count); + cy.get("input#count").click().clear().click().type(count); } fillOxygenCapacity(capacity: string) { diff --git a/src/Components/Facility/DoctorsCountCard.tsx b/src/Components/Facility/DoctorsCountCard.tsx index ee15d7a2c9d..5c90918cb7d 100644 --- a/src/Components/Facility/DoctorsCountCard.tsx +++ b/src/Components/Facility/DoctorsCountCard.tsx @@ -64,6 +64,7 @@ const DoctorsCountCard = (props: DoctorsCountProps) => {
{ @@ -75,6 +76,7 @@ const DoctorsCountCard = (props: DoctorsCountProps) => { Edit setOpenDeleteDialog(true)} diff --git a/src/Components/Facility/FacilityDoctorList.tsx b/src/Components/Facility/FacilityDoctorList.tsx index d9a8b0d1a37..fddc1973aa3 100644 --- a/src/Components/Facility/FacilityDoctorList.tsx +++ b/src/Components/Facility/FacilityDoctorList.tsx @@ -46,7 +46,7 @@ export const FacilityDoctorList = (props: any) => {
-
+
Total Doctors
@@ -88,6 +88,7 @@ export const FacilityDoctorList = (props: any) => {
Doctors List
setDoctorCapacityModalOpen(true)} disabled={doctorList.length === DOCTOR_SPECIALIZATION.length} @@ -97,7 +98,9 @@ export const FacilityDoctorList = (props: any) => { Add Doctor Types
-
{doctorList}
+
+ {doctorList} +
{doctorCapacityModalOpen && (