From b4103631dce433f194069298f84ff1ab19bd13d6 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Fri, 21 Jun 2024 01:38:45 +0530 Subject: [PATCH 1/2] resolved it --- cypress/e2e/patient_spec/patient_logupdate.cy.ts | 13 ++++++++----- cypress/pageobject/Patient/PatientConsultation.ts | 15 +++++---------- cypress/pageobject/Patient/PatientLogupdate.ts | 14 -------------- src/Components/Symptoms/SymptomsBuilder.tsx | 2 +- vite.config.mts | 4 ++-- 5 files changed, 16 insertions(+), 32 deletions(-) diff --git a/cypress/e2e/patient_spec/patient_logupdate.cy.ts b/cypress/e2e/patient_spec/patient_logupdate.cy.ts index cd7e30e1575..94d7825abc0 100644 --- a/cypress/e2e/patient_spec/patient_logupdate.cy.ts +++ b/cypress/e2e/patient_spec/patient_logupdate.cy.ts @@ -11,7 +11,6 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { const patientLogupdate = new PatientLogupdate(); const domicilaryPatient = "Dummy Patient 11"; const patientCategory = "Moderate"; - const additionalSymptoms = "Fever"; const physicalExamination = "physical examination details"; const otherExamination = "Other"; const patientSystolic = "119"; @@ -36,18 +35,22 @@ 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", () => { - patientPage.visitPatient("Dummy Patient 11"); + it("Create a doctor log 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("Telemedicine"); patientLogupdate.typeOtherDetails(otherExamination); - patientLogupdate.typeAdditionalSymptoms(additionalSymptoms); + patientConsultationPage.addPatientSymptoms( + "ss", + ["Breathlessness", "Dizziness"], + "21062024", + ); patientLogupdate.selectPatientCategory(patientCategory); patientLogupdate.typeSystolic(patientSystolic); patientLogupdate.typeDiastolic(patientDiastolic); diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts index 31b1fd6cb68..f09177b8c7d 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,11 @@ export class PatientConsultationPage { cy.clickAndSelectOption("#category", category); } + addPatientSymptoms(symptoms, text, date) { + cy.typeAndMultiSelectOption("#patient_symptoms", text, symptoms); + cy.clickAndTypeDate("#symptoms_onset_date", date); + } + 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/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: { />
Date: Wed, 26 Jun 2024 15:09:54 +0530 Subject: [PATCH 2/2] test for doctor log update first part --- .../patient_spec/patient_consultation.cy.ts | 22 +++--- .../e2e/patient_spec/patient_logupdate.cy.ts | 76 ++++++++++++++++--- .../pageobject/Patient/PatientConsultation.ts | 3 +- cypress/support/commands.ts | 27 ++++--- 4 files changed, 92 insertions(+), 36 deletions(-) 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 94d7825abc0..6c46fd4f1ad 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 physicalExamination = "physical examination details"; @@ -35,7 +39,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { cy.awaitUrl("/patients"); }); - it("Create a doctor log update | Edit the existing log | Verify it's reflection ", () => { + 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"); @@ -45,6 +49,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.clickLogupdate(); // Create a doctors log update patientLogupdate.typePhysicalExamination(physicalExamination); + patientLogupdate.selectRoundType("Progress Note"); patientLogupdate.typeOtherDetails(otherExamination); patientConsultationPage.addPatientSymptoms( "ss", @@ -61,11 +66,58 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { 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"); + cy.submitButton("Update Consultation"); + cy.verifyNotification("Consultation updated successfully"); + cy.closeNotification(); + patientLogupdate.clickLogupdate(); + patientLogupdate.typePhysicalExamination(physicalExamination); + patientLogupdate.selectRoundType("Telemedicine"); + patientLogupdate.typeOtherDetails(otherExamination); + // no symptoms for this patient + 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(); cy.submitButton("Save"); 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"); @@ -75,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); @@ -119,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"); @@ -128,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); @@ -146,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 f09177b8c7d..fb588e977be 100644 --- a/cypress/pageobject/Patient/PatientConsultation.ts +++ b/cypress/pageobject/Patient/PatientConsultation.ts @@ -14,9 +14,10 @@ export class PatientConsultationPage { cy.clickAndSelectOption("#category", category); } - addPatientSymptoms(symptoms, text, date) { + addPatientSymptoms(text, symptoms, date) { cy.typeAndMultiSelectOption("#patient_symptoms", text, symptoms); cy.clickAndTypeDate("#symptoms_onset_date", date); + cy.get("#add-symptom").click(); } selectPatientReferance(referance: string) { 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",