From d5d9ee9e215d9289c4912651d453c039a98fe991 Mon Sep 17 00:00:00 2001 From: Nikhil Kumar <91010142+r-nikhilkumar@users.noreply.github.com> Date: Tue, 7 May 2024 15:04:57 +0530 Subject: [PATCH] [FIXED] Modified Notification related to Patient Log update successfully (#7645) * Modified Notification related to Patient Log update successfully * change request done * done * cypress_update * done * cyp_test_try1 * just minor changes * change request | test failed done * fix the flaky test * fix the flaky test * fix the flaky test * fix the flaky test --- .../e2e/patient_spec/patient_logupdate.cy.ts | 17 ++++++++++------- cypress/pageobject/Patient/PatientLogupdate.ts | 4 ++++ src/Components/Patient/DailyRounds.tsx | 6 +++--- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/cypress/e2e/patient_spec/patient_logupdate.cy.ts b/cypress/e2e/patient_spec/patient_logupdate.cy.ts index 470d8d8fab3..655ec197002 100644 --- a/cypress/e2e/patient_spec/patient_logupdate.cy.ts +++ b/cypress/e2e/patient_spec/patient_logupdate.cy.ts @@ -45,6 +45,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { cy.closeNotification(); patientLogupdate.clickLogupdate(); patientLogupdate.typePhysicalExamination(physicalExamination); + patientLogupdate.selectRoundType("Telemedicine"); patientLogupdate.typeOtherDetails(otherExamination); patientLogupdate.typeAdditionalSymptoms(additionalSymptoms); patientLogupdate.selectPatientCategory(patientCategory); @@ -58,7 +59,9 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.typeRhythm(patientRhythm); cy.get("#consciousness_level-2").click(); cy.submitButton("Save"); - cy.verifyNotification("Consultation Updates details created successfully"); + cy.verifyNotification( + "Telemedicine Log Updates details created successfully", + ); // verify the copied previous value cy.closeNotification(); patientLogupdate.clickLogupdate(); @@ -71,7 +74,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { ]); cy.verifyContentPresence("#rhythm_detail", [patientRhythm]); cy.submitButton("Continue"); - cy.verifyNotification("Consultation Updates details updated successfully"); + cy.verifyNotification("Normal Log Updates details updated successfully"); }); it("Create a new log normal update for a domicilary care patient and edit it", () => { @@ -96,7 +99,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.typeRhythm(patientRhythm); cy.get("#consciousness_level-2").click(); cy.submitButton("Save"); - cy.verifyNotification("Consultation Updates details created successfully"); + cy.verifyNotification("Normal Log Updates details created successfully"); cy.closeNotification(); // edit the card and verify the data. patientLogupdate.clickLogupdateCard("#dailyround-entry", patientCategory); @@ -118,7 +121,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.clickClearButtonInElement("#diastolic"); patientLogupdate.typeDiastolic(patientModifiedDiastolic); cy.submitButton("Continue"); - cy.verifyNotification("Consultation Updates details updated successfully"); + cy.verifyNotification("Normal Log Updates details updated successfully"); patientLogupdate.clickLogupdateCard("#dailyround-entry", patientCategory); cy.verifyContentPresence("#consultation-preview", [ patientModifiedDiastolic, @@ -148,7 +151,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { cy.get("#consciousness_level-2").click(); cy.submitButton("Save"); cy.wait(2000); - cy.verifyNotification("Consultation Updates details created successfully"); + cy.verifyNotification("Normal Log Updates details created successfully"); // Verify the card content cy.get("#basic-information").scrollIntoView(); cy.verifyContentPresence("#basic-information", [additionalSymptoms]); @@ -171,7 +174,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.typeRespiratory(patientRespiratory); cy.get("#consciousness_level-2").click(); cy.submitButton("Save"); - cy.verifyNotification("Consultation Updates details created successfully"); + cy.verifyNotification("Normal Log Updates details created successfully"); cy.closeNotification(); cy.verifyContentPresence("#consultation-buttons", ["9"]); // Verify the Incomplete data will give blank info @@ -181,7 +184,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.typeDiastolic(patientDiastolic); patientLogupdate.typePulse(patientPulse); cy.submitButton("Save"); - cy.verifyNotification("Consultation Updates details created successfully"); + cy.verifyNotification("Normal Log Updates details created successfully"); cy.closeNotification(); cy.verifyContentPresence("#consultation-buttons", ["-"]); }); diff --git a/cypress/pageobject/Patient/PatientLogupdate.ts b/cypress/pageobject/Patient/PatientLogupdate.ts index 7b431dbc458..0baee6e9b3f 100644 --- a/cypress/pageobject/Patient/PatientLogupdate.ts +++ b/cypress/pageobject/Patient/PatientLogupdate.ts @@ -5,6 +5,10 @@ class PatientLogupdate { cy.wait(2000); } + selectRoundType(roundType: string) { + cy.clickAndSelectOption("#rounds_type", roundType); + } + selectBed(bed: string) { cy.searchAndSelectOption("input[name='bed']", bed); cy.submitButton("Move to bed"); diff --git a/src/Components/Patient/DailyRounds.tsx b/src/Components/Patient/DailyRounds.tsx index 8f17e2dee03..713dfe097b8 100644 --- a/src/Components/Patient/DailyRounds.tsx +++ b/src/Components/Patient/DailyRounds.tsx @@ -13,6 +13,7 @@ import useAppHistory from "../../Common/hooks/useAppHistory"; import { DraftSection, useAutoSaveReducer } from "../../Utils/AutoSave"; import * as Notification from "../../Utils/Notifications"; import { formatDateTime } from "../../Utils/utils"; +import { capitalize } from "lodash-es"; import BloodPressureFormField, { BloodPressureValidator, } from "../Common/BloodPressureFormField"; @@ -296,7 +297,7 @@ export const DailyRounds = (props: any) => { if (obj) { dispatch({ type: "set_form", form: initForm }); Notification.Success({ - msg: "Consultation Updates details updated successfully", + msg: `${obj.rounds_type === "VENTILATOR" ? "Critical Care" : capitalize(obj.rounds_type)} Log Updates details updated successfully`, }); if (["NORMAL", "TELEMEDICINE"].includes(state.form.rounds_type)) { navigate( @@ -316,9 +317,8 @@ export const DailyRounds = (props: any) => { setIsLoading(false); if (obj) { dispatch({ type: "set_form", form: initForm }); - Notification.Success({ - msg: "Consultation Updates details created successfully", + msg: `${obj.rounds_type === "VENTILATOR" ? "Critical Care" : capitalize(obj.rounds_type)} Log Updates details created successfully`, }); if (["NORMAL", "TELEMEDICINE"].includes(state.form.rounds_type)) { if (data.clone_last) {