diff --git a/cypress/e2e/patient_spec/patient_consultation.cy.ts b/cypress/e2e/patient_spec/patient_consultation.cy.ts index eef98a5e3ce..89eaa8fc52e 100644 --- a/cypress/e2e/patient_spec/patient_consultation.cy.ts +++ b/cypress/e2e/patient_spec/patient_consultation.cy.ts @@ -293,12 +293,11 @@ describe("Patient Consultation in multiple combination", () => { ); // verify the free text in referring facility name patientConsultationPage.typeReferringFacility("Life Care Hospital"); - patientConsultationPage.selectSymptomsDate("01012024"); - patientConsultationPage.typeAndMultiSelectSymptoms("s", [ - "Sore throat", - "Sputum", - ]); - patientConsultationPage.clickAddSymptom(); + patientConsultationPage.addPatientSymptoms( + "ss", + ["Breathlessness", "Dizziness"], + "21062024", + ); // Stable category patientConsultationPage.selectPatientCategory("Mild"); // OP Consultation @@ -338,12 +337,11 @@ describe("Patient Consultation in multiple combination", () => { "Outpatient/Emergency Room", ); // Select the Symptoms - Breathlessness and Bleeding symptoms - patientConsultationPage.selectSymptomsDate("01012024"); - patientConsultationPage.typeAndMultiSelectSymptoms("b", [ - "Breathlessness", - "Bleeding", - ]); - patientConsultationPage.clickAddSymptom(); + patientConsultationPage.addPatientSymptoms( + "ss", + ["Breathlessness", "Dizziness"], + "21062024", + ); // Comfort Care category patientConsultationPage.selectPatientCategory("Comfort Care"); // Date of symptoms diff --git a/cypress/e2e/patient_spec/patient_logupdate.cy.ts b/cypress/e2e/patient_spec/patient_logupdate.cy.ts index cd7e30e1575..6c46fd4f1ad 100644 --- a/cypress/e2e/patient_spec/patient_logupdate.cy.ts +++ b/cypress/e2e/patient_spec/patient_logupdate.cy.ts @@ -3,15 +3,18 @@ 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"; const physicalExamination = "physical examination details"; const otherExamination = "Other"; const patientSystolic = "119"; @@ -36,7 +39,59 @@ 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 Progress Note update | Edit the existing log | Verify it's reflection ", () => { + patientPage.visitPatient("Dummy Patient 14"); + patientConsultationPage.clickEditConsultationButton(); + patientConsultationPage.selectPatientSuggestion("Domiciliary Care"); + cy.submitButton("Update Consultation"); + cy.verifyNotification("Consultation updated successfully"); + cy.closeNotification(); + patientLogupdate.clickLogupdate(); + // Create a doctors log update + patientLogupdate.typePhysicalExamination(physicalExamination); + patientLogupdate.selectRoundType("Progress Note"); + patientLogupdate.typeOtherDetails(otherExamination); + patientConsultationPage.addPatientSymptoms( + "ss", + ["Breathlessness", "Dizziness"], + "21062024", + ); + patientLogupdate.selectPatientCategory(patientCategory); + patientLogupdate.typeSystolic(patientSystolic); + patientLogupdate.typeDiastolic(patientDiastolic); + patientLogupdate.typePulse(patientPulse); + patientLogupdate.typeTemperature(patientTemperature); + patientLogupdate.typeRespiratory(patientRespiratory); + patientLogupdate.typeSpo2(patientSpo2); + patientLogupdate.selectRhythm(patientRhythmType); + patientLogupdate.typeRhythm(patientRhythm); + cy.get("#consciousness_level-2").click(); + // add a icd-11 diagnosis + patientConsultationPage.selectPatientDiagnosis( + "1A04", + "add-icd11-diagnosis-as-confirmed", + ); + // add a investigation + 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.verifyNotification("Progress Note log created successfully"); + // view the existing + }); + + it("Create a new log teleicu update for a domicilary care patient", () => { patientPage.visitPatient("Dummy Patient 11"); patientConsultationPage.clickEditConsultationButton(); patientConsultationPage.selectPatientSuggestion("Domiciliary Care"); @@ -47,7 +102,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.typePhysicalExamination(physicalExamination); patientLogupdate.selectRoundType("Telemedicine"); patientLogupdate.typeOtherDetails(otherExamination); - patientLogupdate.typeAdditionalSymptoms(additionalSymptoms); + // no symptoms for this patient patientLogupdate.selectPatientCategory(patientCategory); patientLogupdate.typeSystolic(patientSystolic); patientLogupdate.typeDiastolic(patientDiastolic); @@ -62,7 +117,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 brief update for a domicilary care patient and edit it", () => { patientPage.visitPatient(domicilaryPatient); patientConsultationPage.clickEditConsultationButton(); patientConsultationPage.selectPatientSuggestion("Domiciliary Care"); @@ -72,7 +127,11 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.clickLogupdate(); patientLogupdate.typePhysicalExamination(physicalExamination); patientLogupdate.typeOtherDetails(otherExamination); - patientLogupdate.typeAdditionalSymptoms(additionalSymptoms); + patientConsultationPage.addPatientSymptoms( + "ss", + ["Breathlessness", "Dizziness"], + "21062024", + ); patientLogupdate.selectPatientCategory(patientCategory); patientLogupdate.typeSystolic(patientSystolic); patientLogupdate.typeDiastolic(patientDiastolic); @@ -116,7 +175,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 brief 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"); @@ -125,9 +184,11 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.clickLogupdate(); patientLogupdate.typePhysicalExamination(physicalExamination); patientLogupdate.typeOtherDetails(otherExamination); - patientLogupdate.selectSymptomsDate("01012024"); - patientLogupdate.typeAndMultiSelectSymptoms("fe", ["Fever"]); - patientLogupdate.clickAddSymptom(); + patientConsultationPage.addPatientSymptoms( + "ss", + ["Breathlessness", "Dizziness"], + "21062024", + ); patientLogupdate.selectPatientCategory(patientCategory); patientLogupdate.typeSystolic(patientSystolic); patientLogupdate.typeDiastolic(patientDiastolic); @@ -143,10 +204,10 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { cy.verifyNotification("Brief Update log created successfully"); // Verify the card content cy.get("#basic-information").scrollIntoView(); - cy.verifyContentPresence("#encounter-symptoms", [additionalSymptoms]); + cy.verifyContentPresence("#encounter-symptoms", ["Breathlessness"]); }); - it("Create a normal log update to verify MEWS Score Functionality", () => { + it("Create a brief 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 31b1fd6cb68..fb588e977be 100644 --- a/cypress/pageobject/Patient/PatientConsultation.ts +++ b/cypress/pageobject/Patient/PatientConsultation.ts @@ -6,16 +6,6 @@ export class PatientConsultationPage { cy.clickAndSelectOption("#route_to_facility", status); } - typeAndMultiSelectSymptoms(input, symptoms) { - cy.typeAndMultiSelectOption("#additional_symptoms", input, symptoms); - } - selectSymptomsDate(date: string) { - cy.clickAndTypeDate("#symptoms_onset_date", date); - } - clickAddSymptom() { - cy.get("#add-symptom").click(); - } - verifyConsultationPatientName(patientName: string) { cy.get("#patient-name-consultation").should("contain", patientName); } @@ -24,6 +14,12 @@ export class PatientConsultationPage { cy.clickAndSelectOption("#category", category); } + addPatientSymptoms(text, symptoms, date) { + cy.typeAndMultiSelectOption("#patient_symptoms", text, symptoms); + cy.clickAndTypeDate("#symptoms_onset_date", date); + cy.get("#add-symptom").click(); + } + selectPatientReferance(referance: string) { cy.searchAndSelectOption("#referred_to", referance); } diff --git a/cypress/pageobject/Patient/PatientLogupdate.ts b/cypress/pageobject/Patient/PatientLogupdate.ts index bc141c04984..acca06d8454 100644 --- a/cypress/pageobject/Patient/PatientLogupdate.ts +++ b/cypress/pageobject/Patient/PatientLogupdate.ts @@ -28,20 +28,6 @@ class PatientLogupdate { cy.get("#other_details").click().type(details); } - typeAdditionalSymptoms(symptoms: string) { - cy.searchAndSelectOption("#additional_symptoms", symptoms); - } - - typeAndMultiSelectSymptoms(input, symptoms) { - cy.typeAndMultiSelectOption("#additional_symptoms", input, symptoms); - } - selectSymptomsDate(date: string) { - cy.clickAndTypeDate("#symptoms_onset_date", date); - } - clickAddSymptom() { - cy.get("#add-symptom").click(); - } - typeSystolic(systolic: string) { cy.searchAndSelectOption("#systolic", systolic); } diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 45a3cde3245..7b8e8d7d2e1 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -142,21 +142,20 @@ Cypress.Commands.add( }); }, ); -Cypress.Commands.add( - "typeAndMultiSelectOption", - (selector: string, input: string, options: string | string[]) => { - const optionArray = Array.isArray(options) ? options : [options]; - cy.get(selector) - .click() - .type(input) - .then(() => { - optionArray.forEach((options) => { - cy.get("[role='option']").contains(options).click(); - }); - cy.get(selector).click(); +Cypress.Commands.add("typeAndMultiSelectOption", (selector, input, options) => { + const optionArray = Array.isArray(options) ? options : [options]; + cy.get(selector) + .click() + .type(input) + .then(() => { + optionArray.forEach((option, index) => { + cy.get("[role='option']").contains(option).click(); + if (index < optionArray.length - 1) { + cy.wait(1000); // Wait for 1 second before selecting the next option + } }); - }, -); + }); +}); Cypress.Commands.add( "clickAndSelectOption", diff --git a/src/Components/Symptoms/SymptomsBuilder.tsx b/src/Components/Symptoms/SymptomsBuilder.tsx index b4a11cf6999..3d6e21589ac 100644 --- a/src/Components/Symptoms/SymptomsBuilder.tsx +++ b/src/Components/Symptoms/SymptomsBuilder.tsx @@ -304,7 +304,7 @@ const AddSymptom = (props: { />