Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Cypress Test | Doctor Log Update | Consultation Module #8083

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions cypress/e2e/patient_spec/patient_consultation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
83 changes: 72 additions & 11 deletions cypress/e2e/patient_spec/patient_logupdate.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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");
Expand All @@ -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);
Expand All @@ -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");
Expand All @@ -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);
Expand Down Expand Up @@ -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");
Expand All @@ -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);
Expand All @@ -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");
Expand Down
16 changes: 6 additions & 10 deletions cypress/pageobject/Patient/PatientConsultation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down
14 changes: 0 additions & 14 deletions cypress/pageobject/Patient/PatientLogupdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
27 changes: 13 additions & 14 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Symptoms/SymptomsBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ const AddSymptom = (props: {
/>
<div className="flex w-full flex-col gap-2">
<AutocompleteMultiSelectFormField
id="additional_symptoms"
id="patient_symptoms"
name="symptom"
className="w-full"
disabled={props.disabled || processing}
Expand Down
4 changes: 2 additions & 2 deletions vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default {
port: 4000,
proxy: {
"/api": {
target: process.env.CARE_API ?? "https://careapi.ohc.network",
target: process.env.CARE_API ?? "http://localhost:9000/",
changeOrigin: true,
},
},
Expand All @@ -100,7 +100,7 @@ export default {
port: 4000,
proxy: {
"/api": {
target: process.env.CARE_API ?? "https://careapi.ohc.network",
target: process.env.CARE_API ?? "http://localhost:9000/",
changeOrigin: true,
},
},
Expand Down
Loading