From 83c56f030c078f4f6fb252e45c95577d80ba21e3 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Wed, 4 Sep 2024 15:41:52 +0300 Subject: [PATCH] cypress test to create progress note and edit it (#8479) --- .../e2e/patient_spec/patient_logupdate.cy.ts | 77 ++++++++++++++++++- .../pageobject/Patient/PatientConsultation.ts | 2 +- src/Components/Patient/DailyRounds.tsx | 5 +- 3 files changed, 76 insertions(+), 8 deletions(-) diff --git a/cypress/e2e/patient_spec/patient_logupdate.cy.ts b/cypress/e2e/patient_spec/patient_logupdate.cy.ts index 26894bd0815..feb315c820c 100644 --- a/cypress/e2e/patient_spec/patient_logupdate.cy.ts +++ b/cypress/e2e/patient_spec/patient_logupdate.cy.ts @@ -3,12 +3,16 @@ import LoginPage from "../../pageobject/Login/LoginPage"; import { PatientConsultationPage } from "../../pageobject/Patient/PatientConsultation"; import { PatientPage } from "../../pageobject/Patient/PatientCreation"; import PatientLogupdate from "../../pageobject/Patient/PatientLogupdate"; +import PatientInvestigation from "../../pageobject/Patient/PatientInvestigation"; +import PatientPrescription from "../../pageobject/Patient/PatientPrescription"; describe("Patient Log Update in Normal, Critical and TeleIcu", () => { const loginPage = new LoginPage(); const patientConsultationPage = new PatientConsultationPage(); const patientPage = new PatientPage(); const patientLogupdate = new PatientLogupdate(); + const patientInvestigation = new PatientInvestigation(); + const patientPrescription = new PatientPrescription(); const domicilaryPatient = "Dummy Patient 11"; const patientCategory = "Moderate"; const additionalSymptoms = "Fever"; @@ -36,7 +40,72 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { cy.awaitUrl("/patients"); }); - it("Create a new log teleicu update for a domicilary care patient and verify the copy previous value function", () => { + it("Create a new Progress log update for a admitted patient and edit it", () => { + patientPage.visitPatient("Dummy Patient 12"); + patientLogupdate.clickLogupdate(); + cy.verifyNotification("Please assign a bed to the patient"); + patientLogupdate.selectBed("Dummy Bed 4"); + cy.closeNotification(); + patientLogupdate.clickLogupdate(); + // Only will be using random non-unique progress note fields + patientLogupdate.selectPatientCategory(patientCategory); + patientLogupdate.selectRoundType("Progress Note"); + patientLogupdate.selectSymptomsDate("01012024"); + patientLogupdate.typeAndMultiSelectSymptoms("fe", ["Fever"]); + patientLogupdate.typeTemperature(patientTemperature); + // add diagnosis + patientConsultationPage.selectPatientDiagnosis( + "1A06", + "add-icd11-diagnosis-as-differential", + ); + // add a investigation for the patient + patientInvestigation.clickAddInvestigation(); + patientInvestigation.selectInvestigation("Vitals (GROUP)"); + patientInvestigation.clickInvestigationCheckbox(); + patientInvestigation.selectInvestigationFrequency("6"); + // add a medicine for the patient + patientPrescription.clickAddPrescription(); + patientPrescription.interceptMedibase(); + patientPrescription.selectMedicinebox(); + patientPrescription.selectMedicine("DOLO"); + patientPrescription.enterDosage("4"); + patientPrescription.selectDosageFrequency("Twice daily"); + cy.submitButton("Submit"); + cy.verifyNotification("Medicine prescribed"); + cy.closeNotification(); + // Submit the doctors log update + cy.submitButton("Save and Continue"); + cy.verifyNotification("Progress Note log created successfully"); + cy.closeNotification(); + // modify the relevant critical care log update + cy.contains("button", "Neurological Monitoring").click(); + cy.get("#consciousness_level-option-RESPONDS_TO_PAIN").click(); + cy.get("#left_pupil_light_reaction-option-FIXED").click(); + cy.submitButton("Update Details"); + cy.verifyNotification( + "Neurological Monitoring details succesfully updated.", + ); + cy.closeNotification(); + // Final Submission of the form + cy.submitButton("Complete"); + cy.verifyNotification("Progress Note Log Update filed successfully"); + cy.closeNotification(); + // Verify the data reflection + cy.contains("button", "Daily Rounds").click(); + patientLogupdate.clickLogupdateCard("#dailyround-entry", patientCategory); + cy.verifyContentPresence("#consultation-preview", [ + patientCategory, + patientTemperature, + ]); + // verify the edit functionality + patientLogupdate.clickUpdateDetail(); + patientLogupdate.typeSystolic(patientModifiedSystolic); + patientLogupdate.typeDiastolic(patientModifiedDiastolic); + cy.submitButton("Continue"); + cy.verifyNotification("Progress Note log updated successfully"); + }); + + it("Create a new TeleIcu log update for a domicilary care patient", () => { patientPage.visitPatient("Dummy Patient 11"); patientConsultationPage.clickEditConsultationButton(); patientConsultationPage.selectPatientSuggestion("Domiciliary Care"); @@ -63,7 +132,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { cy.verifyNotification("Telemedicine log created successfully"); }); - it("Create a new log normal update for a domicilary care patient and edit it", () => { + it("Create a new Normal Log update for a domicilary care patient and edit it", () => { patientPage.visitPatient(domicilaryPatient); patientConsultationPage.clickEditConsultationButton(); patientConsultationPage.selectPatientSuggestion("Domiciliary Care"); @@ -118,7 +187,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { ]); }); - it("Create a new log normal update for a admission patient and verify its reflection in cards", () => { + it("Create a new Normal update for a admission patient and verify its reflection in cards", () => { patientPage.visitPatient("Dummy Patient 13"); patientLogupdate.clickLogupdate(); cy.verifyNotification("Please assign a bed to the patient"); @@ -148,7 +217,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { cy.verifyContentPresence("#encounter-symptoms", [additionalSymptoms]); }); - it("Create a normal log update to verify MEWS Score Functionality", () => { + it("Create a Normal Log update to verify MEWS Score Functionality", () => { patientPage.visitPatient(domicilaryPatient); patientConsultationPage.clickEditConsultationButton(); patientConsultationPage.selectPatientSuggestion("Domiciliary Care"); diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts index dc5d9e2b2bb..e4a9810141e 100644 --- a/cypress/pageobject/Patient/PatientConsultation.ts +++ b/cypress/pageobject/Patient/PatientConsultation.ts @@ -52,7 +52,7 @@ export class PatientConsultationPage { cy.searchAndSelectOption("#icd11-search", icdCode); cy.get("#diagnosis-list") .contains("Add as") - .focus() + .scrollIntoView() .click() .then(() => { cy.get(`#${statusId}`).click(); diff --git a/src/Components/Patient/DailyRounds.tsx b/src/Components/Patient/DailyRounds.tsx index 81177925f08..0f0c7396f5e 100644 --- a/src/Components/Patient/DailyRounds.tsx +++ b/src/Components/Patient/DailyRounds.tsx @@ -781,11 +781,10 @@ export const DailyRounds = (props: any) => { {state.form.rounds_type === "DOCTORS_LOG" && ( <>