From a5a3c44eb545a644106979926de5ebad4cfd720e Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Thu, 7 Nov 2024 01:23:38 +0530 Subject: [PATCH 1/3] investigation log update --- .../patient_spec/PatientInvestigation.cy.ts | 38 +++++++++++++++++++ .../Patient/PatientInvestigation.ts | 6 ++- .../ConsultationInvestigationsTab.tsx | 1 + 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 cypress/e2e/patient_spec/PatientInvestigation.cy.ts diff --git a/cypress/e2e/patient_spec/PatientInvestigation.cy.ts b/cypress/e2e/patient_spec/PatientInvestigation.cy.ts new file mode 100644 index 00000000000..32213e00104 --- /dev/null +++ b/cypress/e2e/patient_spec/PatientInvestigation.cy.ts @@ -0,0 +1,38 @@ +import { PatientPage } from "pageobject/Patient/PatientCreation"; +import PatientInvestigation from "pageobject/Patient/PatientInvestigation"; + +import LoginPage from "../../pageobject/Login/LoginPage"; + +describe("Patient Investigation Creation from Patient consultation page", () => { + const loginPage = new LoginPage(); + const patientPage = new PatientPage(); + const patientInvestigation = new PatientInvestigation(); + const patientName = "Dummy Patient 12"; + + before(() => { + loginPage.loginAsDistrictAdmin(); + cy.saveLocalStorage(); + }); + + beforeEach(() => { + cy.restoreLocalStorage(); + cy.clearLocalStorage(/filters--.+/); + cy.awaitUrl("/patients"); + }); + + it("Create a investigation for a patient and verify its reflection", () => { + patientPage.visitPatient(patientName); + patientInvestigation.clickInvestigationTab(); + patientInvestigation.clickLogLabResults(); + cy.clickAndMultiSelectOption("#investigations", [ + "Haematology", + "Urine Test", + ]); + cy.submitButton("Save Investigation"); + cy.verifyNotification("Please Enter at least one value"); + }); + + afterEach(() => { + cy.saveLocalStorage(); + }); +}); diff --git a/cypress/pageobject/Patient/PatientInvestigation.ts b/cypress/pageobject/Patient/PatientInvestigation.ts index 8f73cf908bc..74e29b7ecd7 100644 --- a/cypress/pageobject/Patient/PatientInvestigation.ts +++ b/cypress/pageobject/Patient/PatientInvestigation.ts @@ -1,11 +1,9 @@ class PatientInvestigation { clickAddInvestigation() { - cy.get("#investigation").scrollIntoView(); cy.verifyAndClickElement("#investigation", "Add Investigation"); } clickInvestigationTab() { - cy.get("#consultation_tab_nav").scrollIntoView(); cy.verifyAndClickElement("#consultation_tab_nav", "Investigations"); } @@ -19,6 +17,10 @@ class PatientInvestigation { cy.get("#investigation-checkbox").click(); } + clickLogLabResults() { + cy.verifyAndClickElement("#log-lab-results", "Log Lab Results"); + } + selectInvestigationFrequency(frequency: string) { cy.get("#investigation-frequency").click(); cy.contains("button", frequency).should("be.visible").click(); diff --git a/src/components/Facility/ConsultationDetails/ConsultationInvestigationsTab.tsx b/src/components/Facility/ConsultationDetails/ConsultationInvestigationsTab.tsx index ed1157f2c95..bbc17d925a9 100644 --- a/src/components/Facility/ConsultationDetails/ConsultationInvestigationsTab.tsx +++ b/src/components/Facility/ConsultationDetails/ConsultationInvestigationsTab.tsx @@ -17,6 +17,7 @@ export const ConsultationInvestigationsTab = (props: ConsultationTabProps) => {
From 6e6a24b02d60b4b424d35cdd7843bef8c48df412 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Mon, 11 Nov 2024 13:20:03 +0530 Subject: [PATCH 2/3] investigation flow --- cypress/e2e/patient_spec/PatientInvestigation.cy.ts | 4 +++- cypress/pageobject/Patient/PatientInvestigation.ts | 4 ++++ src/components/Facility/Investigations/ViewInvestigations.tsx | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cypress/e2e/patient_spec/PatientInvestigation.cy.ts b/cypress/e2e/patient_spec/PatientInvestigation.cy.ts index 32213e00104..380adf2c37e 100644 --- a/cypress/e2e/patient_spec/PatientInvestigation.cy.ts +++ b/cypress/e2e/patient_spec/PatientInvestigation.cy.ts @@ -24,12 +24,14 @@ describe("Patient Investigation Creation from Patient consultation page", () => patientPage.visitPatient(patientName); patientInvestigation.clickInvestigationTab(); patientInvestigation.clickLogLabResults(); - cy.clickAndMultiSelectOption("#investigations", [ + patientInvestigation.selectInvestigationOption([ "Haematology", "Urine Test", ]); cy.submitButton("Save Investigation"); cy.verifyNotification("Please Enter at least one value"); + cy.closeNotification(); + // Temporary workflow for investigation since we dont have dummy data and moving away from existing module }); afterEach(() => { diff --git a/cypress/pageobject/Patient/PatientInvestigation.ts b/cypress/pageobject/Patient/PatientInvestigation.ts index 74e29b7ecd7..a9f8f38435a 100644 --- a/cypress/pageobject/Patient/PatientInvestigation.ts +++ b/cypress/pageobject/Patient/PatientInvestigation.ts @@ -17,6 +17,10 @@ class PatientInvestigation { cy.get("#investigation-checkbox").click(); } + selectInvestigationOption(options: string[]) { + cy.clickAndMultiSelectOption("#investigations", options); + } + clickLogLabResults() { cy.verifyAndClickElement("#log-lab-results", "Log Lab Results"); } diff --git a/src/components/Facility/Investigations/ViewInvestigations.tsx b/src/components/Facility/Investigations/ViewInvestigations.tsx index 162fd6d87e0..3bd80b0bb28 100644 --- a/src/components/Facility/Investigations/ViewInvestigations.tsx +++ b/src/components/Facility/Investigations/ViewInvestigations.tsx @@ -62,6 +62,7 @@ export default function ViewInvestigations(props: {
navigate( `/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}/investigation/${investigationSession.session_external_id}`, @@ -73,6 +74,7 @@ export default function ViewInvestigations(props: { {t("view")} navigate( `/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}/investigation/${investigationSession.session_external_id}/print`, From 7017dc9b231f1f9b13b9843693d6851fd6104d41 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Mon, 11 Nov 2024 14:11:48 +0530 Subject: [PATCH 3/3] remove unwanted check --- cypress/e2e/patient_spec/PatientHomepage.cy.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/cypress/e2e/patient_spec/PatientHomepage.cy.ts b/cypress/e2e/patient_spec/PatientHomepage.cy.ts index 32d869b8f50..53fb8732712 100644 --- a/cypress/e2e/patient_spec/PatientHomepage.cy.ts +++ b/cypress/e2e/patient_spec/PatientHomepage.cy.ts @@ -43,7 +43,6 @@ describe("Patient Homepage present functionalities", () => { patientHome.typePatientAdmitedBeforeDate(patientFromDate); patientHome.typePatientAdmitedAfterDate(patientToDate); patientHome.clickPatientFilterApply(); - patientHome.verifyTotalPatientCount("1"); // verify the badge and clear the count patientHome.verifyPatientCreatedBeforeDate(patientToDateBadge); patientHome.verifyPatientCreatedAfterDate(patientFromDateBadge);