From 9b05821ac4717b7c27d28becdbd35b7ff6d400cd Mon Sep 17 00:00:00 2001 From: konavivekramakrishna <101407963+konavivekramakrishna@users.noreply.github.com> Date: Mon, 27 Nov 2023 10:49:06 +0530 Subject: [PATCH 1/6] Default Doctor Notes popup as opened when initially clicked (#6702) --- src/Components/Facility/PatientNotesSlideover.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/Facility/PatientNotesSlideover.tsx b/src/Components/Facility/PatientNotesSlideover.tsx index 27a961b9d9b..b268500f6cf 100644 --- a/src/Components/Facility/PatientNotesSlideover.tsx +++ b/src/Components/Facility/PatientNotesSlideover.tsx @@ -18,7 +18,7 @@ interface PatientNotesProps { } export default function PatientNotesSlideover(props: PatientNotesProps) { - const [show, setShow] = useState(false); + const [show, setShow] = useState(true); const [patientActive, setPatientActive] = useState(true); const [noteField, setNoteField] = useState(""); const [reload, setReload] = useState(false); From a6828e3397228596aff2f2c3e4ea1fa3293e1b3a Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Mon, 27 Nov 2023 16:36:38 +0530 Subject: [PATCH 2/6] fix doctor notes test (#6728) --- cypress/pageobject/Patient/PatientConsultation.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts index 4fb299a4965..9c588f50c4e 100644 --- a/cypress/pageobject/Patient/PatientConsultation.ts +++ b/cypress/pageobject/Patient/PatientConsultation.ts @@ -203,7 +203,6 @@ export class PatientConsultationPage { } addDoctorsNotes(notes: string) { - cy.get("#expand_doctor_notes").click(); cy.get("#doctor_notes_textarea").type(notes); } From a6fd9f67cc714c8b572e2a961cfe79a3fac266d3 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Mon, 27 Nov 2023 18:00:37 +0530 Subject: [PATCH 3/6] facility csv download test (#6730) --- .../e2e/facility_spec/facility_homepage.cy.ts | 54 +++++++++++++++++++ cypress/pageobject/Facility/FacilityHome.ts | 31 +++++++++++ src/Components/Common/Export.tsx | 2 +- 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 cypress/e2e/facility_spec/facility_homepage.cy.ts create mode 100644 cypress/pageobject/Facility/FacilityHome.ts diff --git a/cypress/e2e/facility_spec/facility_homepage.cy.ts b/cypress/e2e/facility_spec/facility_homepage.cy.ts new file mode 100644 index 00000000000..6f53f554835 --- /dev/null +++ b/cypress/e2e/facility_spec/facility_homepage.cy.ts @@ -0,0 +1,54 @@ +// FacilityCreation +import { cy, describe, before, beforeEach, it, afterEach } from "local-cypress"; +import LoginPage from "../../pageobject/Login/LoginPage"; +import FacilityHome from "../../pageobject/Facility/FacilityHome"; + +describe("Facility Creation", () => { + const loginPage = new LoginPage(); + const facilityHome = new FacilityHome(); + const facilitiesAlias = "downloadFacilitiesCSV"; + const capacitiesAlias = "downloadCapacitiesCSV"; + const doctorsAlias = "downloadDoctorsCSV"; + const triagesAlias = "downloadTriagesCSV"; + + before(() => { + loginPage.loginAsDisctrictAdmin(); + cy.saveLocalStorage(); + }); + + beforeEach(() => { + cy.viewport(1280, 720); + cy.restoreLocalStorage(); + cy.awaitUrl("/facility"); + }); + + it("Verify Facility Export Functionality", () => { + // Download the Facilities CSV + facilityHome.csvDownloadIntercept(facilitiesAlias, ""); + facilityHome.clickExportButton(); + facilityHome.clickMenuItem("Facilities"); + facilityHome.verifyDownload(facilitiesAlias); + facilityHome.clickSearchButton(); // to avoid flaky test, as sometimes, the test is unable to focus on the object + // Download the Capacities CSV + facilityHome.csvDownloadIntercept(capacitiesAlias, "&capacity"); + facilityHome.clickExportButton(); + facilityHome.clickMenuItem("Capacities"); + facilityHome.verifyDownload(capacitiesAlias); + facilityHome.clickSearchButton(); + // Download the Doctors CSV + facilityHome.csvDownloadIntercept(doctorsAlias, "&doctors"); + facilityHome.clickExportButton(); + facilityHome.clickMenuItem("Doctors"); + facilityHome.verifyDownload(doctorsAlias); + facilityHome.clickSearchButton(); + // Download the Triages CSV + facilityHome.csvDownloadIntercept(triagesAlias, "&triage"); + facilityHome.clickExportButton(); + facilityHome.clickMenuItem("Triages"); + facilityHome.verifyDownload(triagesAlias); + facilityHome.clickSearchButton(); + }); + afterEach(() => { + cy.saveLocalStorage(); + }); +}); diff --git a/cypress/pageobject/Facility/FacilityHome.ts b/cypress/pageobject/Facility/FacilityHome.ts new file mode 100644 index 00000000000..faf6747e024 --- /dev/null +++ b/cypress/pageobject/Facility/FacilityHome.ts @@ -0,0 +1,31 @@ +// cypress/support/pageObjects/FacilityHome.ts + +class FacilityHome { + // Selectors + exportButton = "#export-button"; + searchButton = "#search"; + menuItem = "[role='menuitem']"; + + // Operations + clickExportButton() { + cy.get(this.exportButton).click(); + } + + clickSearchButton() { + cy.get(this.searchButton).click(); + } + + clickMenuItem(itemName: string) { + cy.get(this.menuItem).contains(itemName).click(); + } + + csvDownloadIntercept(alias: string, queryParam: string) { + cy.intercept("GET", `**/api/v1/facility/?csv${queryParam}`).as(alias); + } + + verifyDownload(alias: string) { + cy.wait(`@${alias}`).its("response.statusCode").should("eq", 200); + } +} + +export default FacilityHome; diff --git a/src/Components/Common/Export.tsx b/src/Components/Common/Export.tsx index f991c476aac..7ddaca115bd 100644 --- a/src/Components/Common/Export.tsx +++ b/src/Components/Common/Export.tsx @@ -40,7 +40,7 @@ export const ExportMenu = ({ const { isExporting, exportFile } = useExport(); return ( -
+
Date: Mon, 27 Nov 2023 18:15:00 +0530 Subject: [PATCH 4/6] Show "ICU Admission Date" only for Internal Transfer (#6729) * Show "ICU Admission Date" only for Internal Transfer * fix styling --- src/Components/Facility/ConsultationForm.tsx | 54 ++++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index 091be6b5968..ed3934441a8 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -724,7 +724,10 @@ export const ConsultationForm = (props: any) => { : undefined, consultation_notes: state.form.consultation_notes, is_telemedicine: state.form.is_telemedicine, - icu_admission_date: state.form.icu_admission_date, + icu_admission_date: + state.form.route_to_facility === 30 + ? state.form.icu_admission_date + : undefined, action: state.form.action, review_interval: state.form.review_interval, assigned_to: @@ -1195,9 +1198,7 @@ export const ConsultationForm = (props: any) => {
@@ -1218,29 +1219,28 @@ export const ConsultationForm = (props: any) => {
)} - {state.form.route_to_facility && - [20, 30].includes(state.form.route_to_facility) && ( -
- -
- )} + {state.form.route_to_facility === 30 && ( +
+ +
+ )} {["A", "DC"].includes(state.form.suggestion) && !isUpdate && (
From 466d4ed196131d814677a444386459638cd4bc2e Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Mon, 27 Nov 2023 20:22:22 +0530 Subject: [PATCH 5/6] test for search facility (#6733) --- cypress/e2e/facility_spec/facility_homepage.cy.ts | 14 +++++++++++++- cypress/pageobject/Facility/FacilityHome.ts | 9 +++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/cypress/e2e/facility_spec/facility_homepage.cy.ts b/cypress/e2e/facility_spec/facility_homepage.cy.ts index 6f53f554835..bf6ce12536e 100644 --- a/cypress/e2e/facility_spec/facility_homepage.cy.ts +++ b/cypress/e2e/facility_spec/facility_homepage.cy.ts @@ -2,14 +2,19 @@ import { cy, describe, before, beforeEach, it, afterEach } from "local-cypress"; import LoginPage from "../../pageobject/Login/LoginPage"; import FacilityHome from "../../pageobject/Facility/FacilityHome"; +import ManageUserPage from "../../pageobject/Users/ManageUserPage"; +import FacilityPage from "../../pageobject/Facility/FacilityCreation"; describe("Facility Creation", () => { const loginPage = new LoginPage(); const facilityHome = new FacilityHome(); + const facilityPage = new FacilityPage(); + const manageUserPage = new ManageUserPage(); const facilitiesAlias = "downloadFacilitiesCSV"; const capacitiesAlias = "downloadCapacitiesCSV"; const doctorsAlias = "downloadDoctorsCSV"; const triagesAlias = "downloadTriagesCSV"; + const facilityname = "Dummy Facility 1"; before(() => { loginPage.loginAsDisctrictAdmin(); @@ -17,11 +22,17 @@ describe("Facility Creation", () => { }); beforeEach(() => { - cy.viewport(1280, 720); cy.restoreLocalStorage(); cy.awaitUrl("/facility"); }); + it("Search a facility in homepage", () => { + manageUserPage.typeFacilitySearch(facilityname); + facilityPage.verifyFacilityBadgeContent(facilityname); + manageUserPage.assertFacilityInCard(facilityname); + facilityHome.verifyURLContains(facilityname); + }); + it("Verify Facility Export Functionality", () => { // Download the Facilities CSV facilityHome.csvDownloadIntercept(facilitiesAlias, ""); @@ -48,6 +59,7 @@ describe("Facility Creation", () => { facilityHome.verifyDownload(triagesAlias); facilityHome.clickSearchButton(); }); + afterEach(() => { cy.saveLocalStorage(); }); diff --git a/cypress/pageobject/Facility/FacilityHome.ts b/cypress/pageobject/Facility/FacilityHome.ts index faf6747e024..04dfe94d002 100644 --- a/cypress/pageobject/Facility/FacilityHome.ts +++ b/cypress/pageobject/Facility/FacilityHome.ts @@ -26,6 +26,15 @@ class FacilityHome { verifyDownload(alias: string) { cy.wait(`@${alias}`).its("response.statusCode").should("eq", 200); } + + getURL() { + return cy.url(); + } + + verifyURLContains(searchText) { + const encodedText = encodeURIComponent(searchText).replace(/%20/g, "+"); + this.getURL().should("include", `search=${encodedText}`); + } } export default FacilityHome; From 5cde45749e73ef99bd0554a2ebd925c3e4484ea1 Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Tue, 28 Nov 2023 15:34:20 +0530 Subject: [PATCH 6/6] Allow route to facility to be edited if null (#6742) --- src/Components/Facility/ConsultationForm.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index ed3934441a8..486adfa5170 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -946,7 +946,7 @@ export const ConsultationForm = (props: any) => { required label="Route to Facility" {...field("route_to_facility")} - disabled={isUpdate} + disabled={isUpdate && !!state.form.route_to_facility} // For backwards compatibility; Allow in edit form only if route_to_facility is not set previously />