diff --git a/cypress/e2e/death_report_spec/death_report.cy.ts b/cypress/e2e/death_report_spec/death_report.cy.ts index c051e1ee776..846c31f7a90 100644 --- a/cypress/e2e/death_report_spec/death_report.cy.ts +++ b/cypress/e2e/death_report_spec/death_report.cy.ts @@ -12,9 +12,8 @@ describe("Death Report", () => { beforeEach(() => { cy.restoreLocalStorage(); cy.clearLocalStorage(/filters--.+/); - cy.awaitUrl("/"); + cy.awaitUrl("/patients"); cy.intercept("**/api/v1/patient/**").as("getPatients"); - cy.get("#facility-patients").contains("Patients").click({ force: true }); cy.url().should("include", "/patients"); cy.wait("@getPatients").get("a[data-cy=patient]").first().click(); cy.url().then((url) => { diff --git a/cypress/e2e/facility_spec/facility_creation.cy.ts b/cypress/e2e/facility_spec/facility_creation.cy.ts index f8001584ac3..ab9d72f430f 100644 --- a/cypress/e2e/facility_spec/facility_creation.cy.ts +++ b/cypress/e2e/facility_spec/facility_creation.cy.ts @@ -297,13 +297,6 @@ describe("Facility Creation", () => { facilityPage.verifySuccessNotification("Facility updated successfully"); }); - it("Delete a facility", () => { - facilityPage.visitUpdateFacilityPage(facilityUrl1); - facilityPage.clickManageFacilityDropdown(); - facilityPage.clickDeleteFacilityOption(); - facilityPage.confirmDeleteFacility(); - }); - afterEach(() => { cy.saveLocalStorage(); }); diff --git a/cypress/e2e/facility_spec/facility_homepage.cy.ts b/cypress/e2e/facility_spec/facility_homepage.cy.ts index 7269c3a2581..5d1cef4efcf 100644 --- a/cypress/e2e/facility_spec/facility_homepage.cy.ts +++ b/cypress/e2e/facility_spec/facility_homepage.cy.ts @@ -18,11 +18,12 @@ describe("Facility Homepage Function", () => { const capacitiesAlias = "downloadCapacitiesCSV"; const doctorsAlias = "downloadDoctorsCSV"; const triagesAlias = "downloadTriagesCSV"; - const facilityname = "Dummy Facility 1"; - const statename = "Kerala"; + const facilityName = "Dummy Facility 1"; + const facilityLocaion = "Dummy Location"; + const stateName = "Kerala"; const district = "Ernakulam"; - const localbody = "Aikaranad"; - const facilitytype = "Private Hospital"; + const localBody = "Aikaranad"; + const facilityType = "Private Hospital"; before(() => { loginPage.loginAsDisctrictAdmin(); @@ -58,16 +59,16 @@ describe("Facility Homepage Function", () => { it("Verify the functionality of advance filter", () => { userPage.clickAdvancedFilters(); - facilityPage.selectState(statename); + facilityPage.selectState(stateName); facilityPage.selectDistrict(district); - facilityPage.selectLocalBody(localbody); - facilityPage.clickUpdateFacilityType(facilitytype); + facilityPage.selectLocalBody(localBody); + facilityPage.clickUpdateFacilityType(facilityType); userPage.applyFilter(); - facilityPage.verifyStateBadgeContent(statename); + facilityPage.verifyStateBadgeContent(stateName); facilityPage.verifyDistrictBadgeContent(district); - facilityPage.verifyLocalBodyBadgeContent(localbody); - facilityPage.verifyFacilityTypeBadgeContent(facilitytype); - manageUserPage.assertFacilityInCard(facilityname); + facilityPage.verifyLocalBodyBadgeContent(localBody); + facilityPage.verifyFacilityTypeBadgeContent(facilityType); + manageUserPage.assertFacilityInCard(facilityName); userPage.clearFilters(); userPage.verifyDataTestIdNotVisible("State"); userPage.verifyDataTestIdNotVisible("District"); @@ -80,10 +81,10 @@ describe("Facility Homepage Function", () => { assetPagination.navigateToNextPage(); assetPagination.navigateToPreviousPage(); // search for a facility - manageUserPage.typeFacilitySearch(facilityname); - facilityPage.verifyFacilityBadgeContent(facilityname); - manageUserPage.assertFacilityInCard(facilityname); - facilityHome.verifyURLContains(facilityname); + manageUserPage.typeFacilitySearch(facilityName); + facilityPage.verifyFacilityBadgeContent(facilityName); + manageUserPage.assertFacilityInCard(facilityName); + facilityHome.verifyURLContains(facilityName); }); it("Verify Facility Export Functionality", () => { @@ -113,6 +114,25 @@ describe("Facility Homepage Function", () => { facilityHome.clickSearchButton(); }); + it("Verify Facility Detail page redirection to CNS and Live Minitoring ", () => { + userPage.clickAdvancedFilters(); + facilityPage.selectState(stateName); + facilityPage.selectDistrict(district); + facilityPage.selectLocalBody(localBody); + userPage.applyFilter(); + // go to cns page in the facility details page + manageUserPage.assertFacilityInCard(facilityName); + facilityHome.clickViewFacilityDetails(); + facilityHome.clickFacilityCnsButton(); + facilityHome.verifyCnsUrl(); + facilityHome.navigateBack(); + // go to live monitoring page in the facility details page + facilityHome.clickFacilityLiveMonitorButton(); + facilityHome.selectLocation(facilityLocaion); + facilityHome.clickLiveMonitorButton(); + facilityHome.verifyLiveMonitorUrl(); + }); + afterEach(() => { cy.saveLocalStorage(); }); diff --git a/cypress/e2e/facility_spec/facility_manage.cy.ts b/cypress/e2e/facility_spec/facility_manage.cy.ts index 67439e636dd..11c75949af1 100644 --- a/cypress/e2e/facility_spec/facility_manage.cy.ts +++ b/cypress/e2e/facility_spec/facility_manage.cy.ts @@ -18,6 +18,12 @@ describe("Facility Manage Functions", () => { "Health Facility config updated successfully"; const facilityHrfId = uuidv4(); const facilityUpdatedHrfId = uuidv4(); + const doctorCapacity = "5"; + const doctorModifiedCapacity = "7"; + const totalCapacity = "100"; + const currentOccupied = "80"; + const totalUpdatedCapacity = "120"; + const currentUpdatedOccupied = "100"; before(() => { loginPage.loginAsDisctrictAdmin(); @@ -98,6 +104,71 @@ describe("Facility Manage Functions", () => { facilityManage.verifyHrfIdValue(facilityUpdatedHrfId); }); + it("Modify doctor capacity in Facility detail page", () => { + // Add a doctor capacity + facilityManage.clickFacilityAddDoctorTypeButton(); + facilityPage.selectAreaOfSpecialization("General Medicine"); + facilityPage.fillDoctorCount(doctorCapacity); + facilityPage.saveAndExitDoctorForm(); + facilityManage.verifySuccessMessageVisibilityAndContent( + "Doctor count added successfully" + ); + facilityManage.verifyTotalDoctorCapacity(doctorCapacity); + // edit a existing doctor + facilityManage.clickEditFacilityDoctorCapacity(); + facilityPage.fillDoctorCount(doctorModifiedCapacity); + facilityPage.clickdoctorcapacityaddmore(); + facilityManage.verifySuccessMessageVisibilityAndContent( + "Doctor count updated successfully" + ); + facilityManage.verifyTotalDoctorCapacity(doctorModifiedCapacity); + // delete a bed + facilityManage.clickDeleteFacilityDoctorCapacity(); + facilityManage.clickButtonWithText("Delete"); + facilityManage.verifySuccessMessageVisibilityAndContent( + "Doctor specialization type deleted successfully" + ); + }); + + it("Modify bed capacity in Facility detail page", () => { + // add multiple new bed capacity + facilityManage.clickFacilityAddBedTypeButton(); + facilityPage.selectBedType("Oxygen beds"); + facilityPage.fillTotalCapacity(totalCapacity); + facilityPage.fillCurrentlyOccupied(currentOccupied); + facilityPage.saveAndExitBedCapacityForm(); + facilityManage.verifySuccessMessageVisibilityAndContent( + "Bed capacity added successfully" + ); + facilityManage.verifyFacilityBedCapacity(totalCapacity); + facilityManage.verifyFacilityBedCapacity(currentOccupied); + // edit a existing bed + facilityManage.clickEditFacilityBedCapacity(); + facilityPage.fillTotalCapacity(totalUpdatedCapacity); + facilityPage.fillCurrentlyOccupied(currentUpdatedOccupied); + facilityPage.clickbedcapcityaddmore(); + facilityManage.verifySuccessMessageVisibilityAndContent( + "Bed capacity updated successfully" + ); + facilityManage.verifyFacilityBedCapacity(totalUpdatedCapacity); + facilityManage.verifyFacilityBedCapacity(currentUpdatedOccupied); + // delete a bed + facilityManage.clickDeleteFacilityBedCapacity(); + facilityManage.clickButtonWithText("Delete"); + facilityManage.verifySuccessMessageVisibilityAndContent( + "Bed type deleted successfully" + ); + }); + + it("Delete a existing facility and verify the error message", () => { + facilityPage.clickManageFacilityDropdown(); + facilityPage.clickDeleteFacilityOption(); + facilityPage.confirmDeleteFacility(); + facilityManage.verifySuccessMessageVisibilityAndContent( + "You do not have permission to perform this action." + ); + }); + afterEach(() => { cy.saveLocalStorage(); }); diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts index 4297179050b..e6569799eaa 100644 --- a/cypress/pageobject/Facility/FacilityCreation.ts +++ b/cypress/pageobject/Facility/FacilityCreation.ts @@ -75,11 +75,11 @@ class FacilityPage { } fillTotalCapacity(capacity: string) { - cy.get("input#total-capacity").click().type(capacity); + cy.get("input#total-capacity").click().clear().click().type(capacity); } fillCurrentlyOccupied(occupied: string) { - cy.get("input#currently-occupied").click().type(occupied); + cy.get("input#currently-occupied").click().clear().click().type(occupied); } saveAndExitBedCapacityForm() { @@ -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/cypress/pageobject/Facility/FacilityHome.ts b/cypress/pageobject/Facility/FacilityHome.ts index 03f2be9b19b..fa163757584 100644 --- a/cypress/pageobject/Facility/FacilityHome.ts +++ b/cypress/pageobject/Facility/FacilityHome.ts @@ -31,10 +31,34 @@ class FacilityHome { cy.url().should("include", "/cns"); } + verifyLiveMonitorUrl() { + cy.url().should("include", "/live-monitoring?location="); + } + clickFacilityNotifyButton() { cy.get("#facility-notify").first().click(); } + clickLiveMonitorButton() { + cy.get("#live-monitoring-button").scrollIntoView(); + cy.get("#live-monitoring-button").click(); + } + + clickFacilityLiveMonitorButton() { + cy.get("#facility-detailspage-livemonitoring").scrollIntoView(); + cy.get("#facility-detailspage-livemonitoring").click(); + } + + clickFacilityCnsButton() { + cy.get("#facility-detailspage-cns").scrollIntoView(); + cy.get("#facility-detailspage-cns").click(); + } + + selectLocation(location) { + cy.get("#location").click().type(location); + cy.get("li[role=option]").contains(location).click(); + } + verifyFacilityDetailsUrl() { cy.url().should("match", /\/facility\/[\w-]+/); } diff --git a/cypress/pageobject/Facility/FacilityManage.ts b/cypress/pageobject/Facility/FacilityManage.ts index a7eab2884b4..69cdaf669e2 100644 --- a/cypress/pageobject/Facility/FacilityManage.ts +++ b/cypress/pageobject/Facility/FacilityManage.ts @@ -13,6 +13,30 @@ class FacilityManage { .wait(100); // Adjust the wait time as needed } + verifyTotalDoctorCapacity(expectedCapacity) { + cy.get("#facility-doctor-totalcapacity").contains(expectedCapacity); + } + + verifyFacilityBedCapacity(expectedCapacity) { + cy.get("#facility-bed-capacity-details").contains(expectedCapacity); + } + + clickEditFacilityDoctorCapacity() { + cy.get("#edit-facility-doctorcapacity").click(); + } + + clickEditFacilityBedCapacity() { + cy.get("#edit-facility-bedcapacity").click(); + } + + clickDeleteFacilityDoctorCapacity() { + cy.get("#delete-facility-doctorcapacity").click(); + } + + clickDeleteFacilityBedCapacity() { + cy.get("#delete-facility-bedcapacity").click(); + } + clickSaveCoverImage() { cy.get("#save-cover-image").scrollIntoView(); cy.get("#save-cover-image").click(); @@ -54,5 +78,15 @@ class FacilityManage { verifyHrfIdValue(expectedValue) { cy.get("#hf_id").should("have.value", expectedValue); } + + clickFacilityAddDoctorTypeButton() { + cy.get("#facility-add-doctortype").scrollIntoView(); + cy.get("#facility-add-doctortype").click(); + } + + clickFacilityAddBedTypeButton() { + cy.get("#facility-add-bedtype").scrollIntoView(); + cy.get("#facility-add-bedtype").click(); + } } export default FacilityManage; diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts index 7528b30da06..8570b2b8e7a 100644 --- a/cypress/pageobject/Patient/PatientConsultation.ts +++ b/cypress/pageobject/Patient/PatientConsultation.ts @@ -47,7 +47,7 @@ export class PatientConsultationPage { cy.get("#icd11-search input[role='combobox']") .scrollIntoView() .click() - .type("1A"); + .type("1A00"); cy.get("#icd11-search [role='option']") .contains("1A00 Cholera") .scrollIntoView() diff --git a/netlify.toml b/netlify.toml index f23b951ff21..a98fd0f5352 100644 --- a/netlify.toml +++ b/netlify.toml @@ -21,6 +21,6 @@ status = 200 [[headers]] for = "/*" [headers.values] - cache-control = ''' - max-age=0, - no-store''' + cache-control = "max-age=0, no-store" + X-Frame-Options = "DENY" + X-Content-Type-Options = "nosniff" diff --git a/src/Components/Facility/BedTypeCard.tsx b/src/Components/Facility/BedTypeCard.tsx index 67e22f31f42..f2af4bd7a1c 100644 --- a/src/Components/Facility/BedTypeCard.tsx +++ b/src/Components/Facility/BedTypeCard.tsx @@ -111,6 +111,7 @@ export const BedTypeCard: React.FC = ({
{ setSelectedId(room_type || 0); setOpen(true); @@ -125,6 +126,7 @@ export const BedTypeCard: React.FC = ({ setOpenDeleteDialog(true)} authorizeFor={NonReadOnlyUsers} className=" tooltip bg-opacity/10 flex aspect-square h-7 w-7 flex-col items-center justify-center rounded bg-red-100 px-4 py-0 hover:bg-red-200" 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/FacilityBedCapacity.tsx b/src/Components/Facility/FacilityBedCapacity.tsx index d33caf3f7cb..30d67bfcf33 100644 --- a/src/Components/Facility/FacilityBedCapacity.tsx +++ b/src/Components/Facility/FacilityBedCapacity.tsx @@ -87,6 +87,7 @@ export const FacilityBedCapacity = (props: any) => {
Bed Capacity
setBedCapacityModalOpen(true)} authorizeFor={NonReadOnlyUsers} 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 && ( diff --git a/src/Components/Facility/FacilityHome.tsx b/src/Components/Facility/FacilityHome.tsx index acf6324f5a5..6f42dab00a6 100644 --- a/src/Components/Facility/FacilityHome.tsx +++ b/src/Components/Facility/FacilityHome.tsx @@ -394,6 +394,7 @@ export const FacilityHome = (props: any) => {
{ {permittedUserTypes.includes(authUser.user_type) && ( - + Live Monitoring @@ -524,6 +531,7 @@ const LiveMonitoringButton = () => {