diff --git a/cypress/e2e/death_report_spec/death_report.cy.ts b/cypress/e2e/death_report_spec/death_report.cy.ts deleted file mode 100644 index 846c31f7a90..00000000000 --- a/cypress/e2e/death_report_spec/death_report.cy.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { before, beforeEach, cy, describe, it } from "local-cypress"; - -const user = { username: "devdistrictadmin", password: "Coronasafe@123" }; -const address = "C-106,\nSector-H,\nAliganj,\nLucknow,\nUttar Pradesh"; - -describe("Death Report", () => { - before(() => { - cy.loginByApi(user.username, user.password); - cy.saveLocalStorage(); - }); - - beforeEach(() => { - cy.restoreLocalStorage(); - cy.clearLocalStorage(/filters--.+/); - cy.awaitUrl("/patients"); - cy.intercept("**/api/v1/patient/**").as("getPatients"); - cy.url().should("include", "/patients"); - cy.wait("@getPatients").get("a[data-cy=patient]").first().click(); - cy.url().then((url) => { - const patient_id = url.split("/")[6]; - cy.visit(`/death_report/${patient_id}`, { - onBeforeLoad: (win) => { - cy.stub(win, "print"); - }, - }); - }); - }); - - it("Add Data And Submit " + user.username, () => { - // Wait For Form Data To Prepopulate - - // Clear Exisiting Data And Fill New Data - cy.get("input[name='name']").clear().type("Apurva Nagar"); - cy.get("input[name='age']").clear().type("20"); - cy.get("input[name='gender']").clear().type("Male"); - cy.get("textarea[name='address']").clear().type(address); - cy.get("input[name='phone_number']").clear().type("+919919266674"); - cy.get("input[name='is_declared_positive']").clear().type("No"); - cy.get("input[name='date_declared_positive']") - .clear({ force: true }) - .type("2021-12-01", { force: true }); - cy.get("input[name='test_type']").clear().type("Rapid Antigen"); - cy.get("input[name='date_of_test']") - .clear({ force: true }) - .type("2021-12-01", { force: true }); - cy.get("input[name='date_of_result']") - .clear({ force: true }) - .type("2021-12-01", { force: true }); - cy.get("input[name='hospital_tested_in']").clear().type("Apollo Hospital"); - cy.get("input[name='hospital_died_in']").clear().type("Apollo Hospital"); - cy.get("input[name='date_of_admission']") - .clear({ force: true }) - .type("2021-12-01", { force: true }); - cy.get("input[name='date_of_death']") - .clear({ force: true }) - .type("2021-12-01", { force: true }); - cy.get("input[name='comorbidities']").clear().type("awesomeness"); - cy.get("input[name='history_clinical_course']") - .clear() - .type("No cure for awesomeness"); - cy.get("input[name='brought_dead']").clear().type("No"); - cy.get("input[name='home_or_cfltc']").clear().type("-"); - cy.get("input[name='is_vaccinated']").clear().type("Yes"); - cy.get("input[name='kottayam_confirmation_sent']").clear().type("Yes"); - cy.get("input[name='kottayam_sample_date']") - .clear({ force: true }) - .type("2021-12-01", { force: true }); - cy.get("input[name='cause_of_death']") - .clear() - .type("Too awesome for earth"); - cy.get("input[name='srf_id']").clear().type("123456"); - - // See Preview Of Report - cy.get("button").contains("Preview").click(); - - // Print Death Report - cy.get("button").contains("Print Death Report").click(); - cy.window().its("print").should("be.called"); - }); -}); diff --git a/cypress/e2e/facility_spec/facility_creation.cy.ts b/cypress/e2e/facility_spec/facility_creation.cy.ts index ea27938c7e9..f318f422893 100644 --- a/cypress/e2e/facility_spec/facility_creation.cy.ts +++ b/cypress/e2e/facility_spec/facility_creation.cy.ts @@ -136,15 +136,18 @@ describe("Facility Creation", () => { facilityPage.fillExpectedDTypeCylinderRequirement(oxygenExpected); facilityPage.selectLocation("Kochi, Kerala"); facilityPage.submitForm(); + cy.closeNotification(); // create multiple bed capacity and verify card reflection facilityPage.selectBedType("Oxygen beds"); facilityPage.fillTotalCapacity(bedCapacity); facilityPage.fillCurrentlyOccupied(bedOccupancy); facilityPage.clickbedcapcityaddmore(); + cy.closeNotification(); facilityPage.selectBedType("Ordinary Bed"); facilityPage.fillTotalCapacity(bedCapacity); facilityPage.fillCurrentlyOccupied(bedOccupancy); facilityPage.clickbedcapcityaddmore(); + cy.closeNotification(); facilityPage.getTotalBedCapacity().contains(totalCapacity); facilityPage.getTotalBedCapacity().contains(totalOccupancy); facilityPage.clickcancelbutton(); @@ -152,9 +155,11 @@ describe("Facility Creation", () => { facilityPage.selectAreaOfSpecialization("General Medicine"); facilityPage.fillDoctorCount(doctorCapacity); facilityPage.clickdoctorcapacityaddmore(); + cy.closeNotification(); facilityPage.selectAreaOfSpecialization("Pulmonology"); facilityPage.fillDoctorCount(doctorCapacity); facilityPage.clickdoctorcapacityaddmore(); + cy.closeNotification(); facilityPage.getTotalDoctorCapacity().contains(doctorCapacity); facilityPage.clickcancelbutton(); facilityPage.verifyfacilitynewurl(); @@ -186,6 +191,12 @@ describe("Facility Creation", () => { facilityPage.getFacilityTotalBedCapacity().contains(totalOccupancy); facilityPage.getFacilityTotalDoctorCapacity().scrollIntoView(); facilityPage.getFacilityTotalDoctorCapacity().contains(totalDoctor); + // verify the delete functionality + cy.get("#manage-facility-dropdown button").scrollIntoView(); + facilityPage.clickManageFacilityDropdown(); + facilityPage.clickDeleteFacilityOption(); + facilityPage.confirmDeleteFacility(); + cy.verifyNotification("Facility deleted successfully"); }); it("Create a new facility with single bed and doctor capacity", () => { diff --git a/cypress/e2e/facility_spec/facility_manage.cy.ts b/cypress/e2e/facility_spec/facility_manage.cy.ts index 612a95001d6..c5f56f97170 100644 --- a/cypress/e2e/facility_spec/facility_manage.cy.ts +++ b/cypress/e2e/facility_spec/facility_manage.cy.ts @@ -161,15 +161,6 @@ describe("Facility Manage Functions", () => { ); }); - it("Delete a existing facility and verify the error message", () => { - facilityPage.clickManageFacilityDropdown(); - facilityPage.clickDeleteFacilityOption(); - facilityPage.confirmDeleteFacility(); - facilityManage.verifySuccessMessageVisibilityAndContent( - "You do not have permission to perform this action." - ); - }); - afterEach(() => { cy.saveLocalStorage(); }); diff --git a/cypress/e2e/patient_spec/patient_consultation.cy.ts b/cypress/e2e/patient_spec/patient_consultation.cy.ts index 9b3248d6656..3bffa0081ce 100644 --- a/cypress/e2e/patient_spec/patient_consultation.cy.ts +++ b/cypress/e2e/patient_spec/patient_consultation.cy.ts @@ -2,29 +2,41 @@ import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress"; import LoginPage from "../../pageobject/Login/LoginPage"; import { PatientPage } from "../../pageobject/Patient/PatientCreation"; import { PatientConsultationPage } from "../../pageobject/Patient/PatientConsultation"; -import { - emergency_phone_number, - phone_number, -} from "../../pageobject/constants"; -import FacilityPage from "../../pageobject/Facility/FacilityCreation"; -import PatientMedicalHistory from "../../pageobject/Patient/PatientMedicalHistory"; +import PatientPredefined from "../../pageobject/Patient/PatientPredefined"; +import ShiftCreation from "../../pageobject/Shift/ShiftCreation"; +import PatientInvestigation from "../../pageobject/Patient/PatientInvestigation"; +import PatientTreatmentPlan from "../../pageobject/Patient/PatientTreatmentPlan"; +import PatientDeathReport from "../../pageobject/Patient/PatientDeathReport"; +import PatientPrescription from "../../pageobject/Patient/PatientPrescription"; -describe("Patient Creation with consultation", () => { +describe("Patient Consultation in multiple combination", () => { const patientConsultationPage = new PatientConsultationPage(); const loginPage = new LoginPage(); const patientPage = new PatientPage(); - const facilityPage = new FacilityPage(); - const patientMedicalHistory = new PatientMedicalHistory(); - const patientDateOfBirth = "01012001"; - const patientOneName = "Patient With Consultation"; - const patientOneGender = "Male"; - const patientOneAddress = "Test Patient Address"; - const patientOnePincode = "682001"; - const patientOneState = "Kerala"; - const patientOneDistrict = "Ernakulam"; - const patientOneLocalbody = "Aluva"; - const patientOneWard = "4"; - const patientOneBloodGroup = "O+"; + const patientPredefined = new PatientPredefined(); + const shiftCreation = new ShiftCreation(); + const patientInvestigation = new PatientInvestigation(); + const patientTreatmentPlan = new PatientTreatmentPlan(); + const patientDeathReport = new PatientDeathReport(); + const patientPrescription = new PatientPrescription(); + const facilityName = "Dummy Facility 40"; + const doctorName = "Dev Doctor"; + const diagnosis1 = "1A00"; + const diagnosis2 = "1A01"; + const diagnosis3 = "1A02"; + const diagnosis4 = "1A04"; + const diagnosis5 = "1A05"; + const patientIllnessHistory = "History Of present illness"; + const patientExaminationHistory = + "Examination Details and Clinical Conditions"; + const patientTreatment = "Treatment Plan"; + const generalInstruction = "Patient General Instructions"; + const specialInstruction = "Special Instruction"; + const procedureName = "Procedure No 1"; + const patientWeight = "70"; + const patientHeight = "170"; + const medicineOne = "DOLO"; + const patientIpNumber = "192.168"; before(() => { loginPage.loginAsDisctrictAdmin(); @@ -37,64 +49,349 @@ describe("Patient Creation with consultation", () => { cy.awaitUrl("/patients"); }); - it("Create a patient with consultation", () => { + it("OP Patient with admission consultation", () => { patientPage.createPatient(); - patientPage.selectFacility("Dummy Facility 40"); + patientPage.selectFacility(facilityName); + patientPredefined.createPatient(); patientPage.patientformvisibility(); - patientPage.typePatientPhoneNumber(phone_number); - patientPage.typePatientEmergencyNumber(emergency_phone_number); - patientPage.typePatientDateOfBirth(patientDateOfBirth); - patientPage.typePatientName(patientOneName); - patientPage.selectPatientGender(patientOneGender); - patientPage.typePatientAddress(patientOneAddress); - facilityPage.fillPincode(patientOnePincode); - facilityPage.selectStateOnPincode(patientOneState); - facilityPage.selectDistrictOnPincode(patientOneDistrict); - facilityPage.selectLocalBody(patientOneLocalbody); - facilityPage.selectWard(patientOneWard); - patientMedicalHistory.clickNoneMedicialHistory(); - patientPage.selectPatientBloodGroup(patientOneBloodGroup); patientPage.clickCreatePatient(); patientPage.verifyPatientIsCreated(); - patientConsultationPage.fillIllnessHistory("history"); patientConsultationPage.selectConsultationStatus( "Outpatient/Emergency Room" ); patientConsultationPage.selectSymptoms("ASYMPTOMATIC"); + patientConsultationPage.typePatientIllnessHistory(patientIllnessHistory); + patientConsultationPage.typePatientExaminationHistory( + patientExaminationHistory + ); + patientConsultationPage.typePatientWeight(patientWeight); + patientConsultationPage.typePatientHeight(patientHeight); + patientConsultationPage.selectPatientCategory("Stable"); + // icd 11 - 4 diagnosis with one principal + patientConsultationPage.selectPatientDiagnosis( + diagnosis1, + "add-icd11-diagnosis-as-unconfirmed" + ); + patientConsultationPage.selectPatientDiagnosis( + diagnosis2, + "add-icd11-diagnosis-as-provisional" + ); + patientConsultationPage.selectPatientDiagnosis( + diagnosis3, + "add-icd11-diagnosis-as-differential" + ); + patientConsultationPage.selectPatientDiagnosis( + diagnosis4, + "add-icd11-diagnosis-as-confirmed" + ); + patientConsultationPage.selectPatientPrincipalDiagnosis(diagnosis4); + patientTreatmentPlan.clickAddProcedure(); + patientTreatmentPlan.typeProcedureName(procedureName); + patientTreatmentPlan.typeProcedureTime("2024-02-22T12:30"); + patientTreatmentPlan.typeTreatmentPlan(patientTreatment); + patientTreatmentPlan.typePatientGeneralInstruction(generalInstruction); + patientTreatmentPlan.typeSpecialInstruction(specialInstruction); + patientTreatmentPlan.fillTreatingPhysican(doctorName); + cy.submitButton("Create Consultation"); + // the above submit should fail as IP number is missing + patientConsultationPage.typePatientNumber(patientIpNumber); + cy.submitButton("Create Consultation"); + cy.verifyNotification("Consultation created successfully"); + // Below code for the prescription module only present while creating a new consultation + patientPrescription.clickAddPrescription(); + patientPrescription.interceptMediaBase(); + patientPrescription.selectMedicinebox(); + patientPrescription.waitForMediabaseStatusCode(); + patientPrescription.selectMedicine(medicineOne); + patientPrescription.enterDosage("3"); + patientPrescription.selectDosageFrequency("Twice daily"); + cy.submitButton("Submit"); + cy.verifyNotification("Medicine prescribed"); + patientPrescription.clickReturnToDashboard(); + // Verify the data's across the dashboard + patientConsultationPage.verifyTextInConsultation( + "#patient-consultationbadges", + patientIpNumber + ); + patientConsultationPage.verifyTextInConsultation( + "#diagnoses-view", + diagnosis1 + ); + patientConsultationPage.verifyTextInConsultation( + "#diagnoses-view", + diagnosis2 + ); + patientConsultationPage.verifyTextInConsultation( + "#diagnoses-view", + diagnosis3 + ); + patientConsultationPage.verifyTextInConsultation( + "#diagnoses-view", + diagnosis4 + ); + patientConsultationPage.verifyTextInConsultation( + "#history-presentillness", + patientIllnessHistory + ); + patientConsultationPage.verifyTextInConsultation( + "#examination-details", + patientExaminationHistory + ); + patientConsultationPage.verifyTextInConsultation( + "#treatment-summary", + patientTreatment + ); + patientConsultationPage.verifyTextInConsultation( + "#general-instructions", + generalInstruction + ); + patientConsultationPage.verifyTextInConsultation( + "#consultation-notes", + specialInstruction + ); + patientConsultationPage.verifyTextInConsultation( + "#consultation-procedure", + procedureName + ); + patientConsultationPage.verifyTextInConsultation( + "#patient-weight", + patientWeight + ); + patientConsultationPage.verifyTextInConsultation( + "#patient-height", + patientHeight + ); + }); - patientConsultationPage.enterConsultationDetails( - "Stable", - "Examination details and Clinical conditions", - "70", - "170", - "IP007", - "generalnote", - "Dev Doctor" - ); - patientConsultationPage.submitConsultation(); + it("OP Patient with Declare Death", () => { + patientPage.createPatient(); + patientPage.selectFacility(facilityName); + patientPredefined.createPatient(); + patientPage.patientformvisibility(); + patientPage.clickCreatePatient(); + patientPage.verifyPatientIsCreated(); + // OP Patient + patientConsultationPage.selectConsultationStatus( + "Outpatient/Emergency Room" + ); + // Asymptomatic + patientConsultationPage.selectSymptoms("ASYMPTOMATIC"); + // CRITICAL category + patientConsultationPage.selectPatientCategory("Critical"); + patientConsultationPage.selectPatientSuggestion("Declare Death"); + patientConsultationPage.typeCauseOfDeath("Cause of Death"); + patientConsultationPage.typePatientConsultationDate( + "#death_datetime", + "2024-02-22T12:45" + ); + patientConsultationPage.typeDeathConfirmedBy(doctorName); + patientConsultationPage.typePatientConsultationDate( + "#encounter_date", + "2024-02-22T12:30" + ); + cy.submitButton("Create Consultation"); + cy.verifyNotification( + "Create Diagnoses - Atleast one diagnosis is required" + ); + patientConsultationPage.selectPatientDiagnosis( + diagnosis4, + "add-icd11-diagnosis-as-confirmed" + ); + cy.submitButton("Create Consultation"); + cy.verifyNotification("Consultation created successfully"); + // verify the data and death report + patientConsultationPage.verifyTextInConsultation( + "#consultation-buttons", + "EXPIRED" + ); + patientConsultationPage.clickPatientDetails(); + patientDeathReport.clickDeathReport(); + patientDeathReport.verifyDeathReportAutofill( + "#name", + "Patient With Predefined Data" + ); + patientDeathReport.verifyDeathReportAutofill( + "#cause_of_death", + "Cause of Death" + ); + cy.submitButton("Preview"); + cy.preventPrint(); + patientDeathReport.clickPrintDeathReport(); + cy.get("@verifyPrevent").should("be.called"); + }); - // Below code for the prescription module only present while creating a new consultation - patientConsultationPage.clickAddPrescription(); - patientConsultationPage.interceptMediaBase(); - patientConsultationPage.selectMedicinebox(); - patientConsultationPage.waitForMediabaseStatusCode(); - patientConsultationPage.prescribefirstMedicine(); - patientConsultationPage.enterDosage("3"); - patientConsultationPage.selectDosageFrequency("Twice daily"); - patientConsultationPage.submitPrescriptionAndReturn(); - patientConsultationPage.verifyConsultationPatientName(patientOneName); + it("Internal Transfer within facility Patient with Domicilary Care", () => { + patientPage.createPatient(); + patientPage.selectFacility(facilityName); + patientPredefined.createPatient(); + patientPage.patientformvisibility(); + patientPage.clickCreatePatient(); + patientPage.verifyPatientIsCreated(); + // Internal Transfer within facility + patientConsultationPage.selectConsultationStatus( + "Internal Transfer within the facility" + ); + patientConsultationPage.selectPatientWard("Dummy Location 1"); + // Asymptomatic + patientConsultationPage.selectSymptoms("ASYMPTOMATIC"); + // Abnormal category + patientConsultationPage.selectPatientCategory("Abnormal"); + patientConsultationPage.selectPatientSuggestion("Domiciliary Care"); + // one ICD-11 diagnosis + patientConsultationPage.selectPatientDiagnosis( + diagnosis4, + "add-icd11-diagnosis-as-confirmed" + ); + patientConsultationPage.typePatientConsultationDate( + "#icu_admission_date", + "2024-02-23T12:30" + ); + // add investigation + patientInvestigation.clickAddInvestigation(); + patientInvestigation.selectInvestigation("Vitals (GROUP)"); + patientInvestigation.clickInvestigationCheckbox(); + patientInvestigation.selectInvestigationFrequency("6"); + // Add advice and treating physican + patientTreatmentPlan.typePatientGeneralInstruction(generalInstruction); + patientTreatmentPlan.fillTreatingPhysican(doctorName); + // add review after and add action + patientTreatmentPlan.selectReviewAfter("15 mins"); + patientTreatmentPlan.selectAction("Specialist Required"); + // add telemedicine + patientTreatmentPlan.clickTelemedicineCheckbox(); + patientTreatmentPlan.assignTelemedicineDoctor(doctorName); + cy.submitButton("Create Consultation"); + cy.verifyNotification("Consultation created successfully"); + // verify the data reflection - + patientConsultationPage.verifyTextInConsultation( + "#patient-infobadges", + "Specialist Required" + ); + patientConsultationPage.verifyTextInConsultation( + "#patient-infobadges", + "Domiciliary Care" + ); + patientConsultationPage.verifyTextInConsultation("#diagnoses-view", "1A04"); + patientInvestigation.clickInvestigationTab(); + patientConsultationPage.verifyTextInConsultation( + "#investigation-suggestions", + "Vitals" + ); + }); + + it("Referred From another Facility Patient with OP consultation", () => { + patientPage.createPatient(); + patientPage.selectFacility(facilityName); + patientPredefined.createPatient(); + patientPage.patientformvisibility(); + patientPage.clickCreatePatient(); + patientPage.verifyPatientIsCreated(); + // referred from another facility patient + patientConsultationPage.selectConsultationStatus( + "Referred from another facility" + ); + // verify the free text in referring facility name + patientConsultationPage.typeReferringFacility("Life Care Hospital"); + // Vomiting and Nausea symptoms + patientConsultationPage.selectSymptoms(["VOMITING", "SORE THROAT"]); + // Stable category + patientConsultationPage.selectPatientCategory("Stable"); + // Date of symptoms + patientConsultationPage.selectSymptomsDate( + "#symptoms_onset_date", + "01012024" + ); + // OP Consultation + patientConsultationPage.selectPatientSuggestion("OP Consultation"); + // one ICD-11 and no principal + patientConsultationPage.selectPatientDiagnosis( + diagnosis4, + "add-icd11-diagnosis-as-confirmed" + ); + // no investigation + patientTreatmentPlan.typePatientGeneralInstruction(generalInstruction); + // no review after and no action + patientTreatmentPlan.fillTreatingPhysican(doctorName); + cy.submitButton("Create Consultation"); + cy.verifyNotification("Patient discharged successfully"); + // verify the Discharge Reason, Diagnosis, treatment physican + patientConsultationPage.verifyTextInConsultation( + "#consultation-buttons", + "OP file closed" + ); + patientConsultationPage.verifyTextInConsultation( + "#treating-physician", + doctorName + ); + patientConsultationPage.verifyTextInConsultation("#diagnoses-view", "1A04"); + }); + + it("OP Patient with Refer to another hospital consultation", () => { + patientPage.createPatient(); + patientPage.selectFacility(facilityName); + patientPredefined.createPatient(); + patientPage.patientformvisibility(); + patientPage.clickCreatePatient(); + patientPage.verifyPatientIsCreated(); + // Route of Facility - Out Patient + patientConsultationPage.selectConsultationStatus( + "Outpatient/Emergency Room" + ); + // Select the Symptoms - Sore throat and fever symptoms + patientConsultationPage.selectSymptoms(["FEVER", "SORE THROAT"]); + // Comfort Care category + patientConsultationPage.selectPatientCategory("Comfort Care"); + // Date of symptoms + patientConsultationPage.selectSymptomsDate( + "#symptoms_onset_date", + "01012024" + ); + // Decision after consultation - Referred to Facility + patientConsultationPage.selectPatientSuggestion( + "Refer to another Hospital" + ); + patientConsultationPage.selectPatientReferance( + "Dummy Request Approving Center" + ); + // Four ICD-11 and one principal diagnosis + patientConsultationPage.selectPatientDiagnosis( + diagnosis4, + "add-icd11-diagnosis-as-confirmed" + ); + patientConsultationPage.selectPatientPrincipalDiagnosis(diagnosis4); + // no investigation for the patient + patientTreatmentPlan.typePatientGeneralInstruction(generalInstruction); + patientTreatmentPlan.fillTreatingPhysican(doctorName); + // no review after and no action + cy.submitButton("Create Consultation"); + // Create a shifting request + cy.closeNotification(); + shiftCreation.typeCurrentFacilityPerson("Current Facility Person"); + shiftCreation.typeCurrentFacilityPhone("9999999999"); + shiftCreation.typeShiftReason("reason for shift"); + cy.submitButton("Submit"); + cy.verifyNotification("Shift request created successfully"); }); it("Edit created consultation to existing patient", () => { - // temporary fixing, whole file will be refactored soon - cy.get("[data-cy='patient']").first().click(); + patientPage.visitPatient("Dummy Patient 13"); patientConsultationPage.clickEditConsultationButton(); - patientConsultationPage.fillIllnessHistory("editted"); - patientConsultationPage.updateSymptoms("FEVER"); - patientConsultationPage.setSymptomsDate("01082023"); - patientConsultationPage.updateConsultation(); - patientConsultationPage.verifySuccessNotification( - "Consultation updated successfully" + cy.wait(5000); + patientConsultationPage.typePatientIllnessHistory("editted"); + patientConsultationPage.selectPatientDiagnosis( + diagnosis5, + "add-icd11-diagnosis-as-unconfirmed" + ); + cy.get("#diagnosis-entry-1").within(() => { + cy.get("#condition-verification-status-menu").click(); + cy.get("#add-icd11-diagnosis-as-entered-in-error").click(); + }); + cy.submitButton("Update Consultation"); + cy.verifyNotification("Consultation updated successfully"); + cy.get("#diagnoses-view").should("not.contain.text", diagnosis5); + patientConsultationPage.verifyTextInConsultation( + "#history-presentillness", + "editted" ); }); diff --git a/cypress/e2e/patient_spec/patient_manage.cy.ts b/cypress/e2e/patient_spec/patient_manage.cy.ts index 6c58767c06b..313b62ba43d 100644 --- a/cypress/e2e/patient_spec/patient_manage.cy.ts +++ b/cypress/e2e/patient_spec/patient_manage.cy.ts @@ -2,11 +2,13 @@ import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress"; import LoginPage from "../../pageobject/Login/LoginPage"; import { PatientConsultationPage } from "../../pageobject/Patient/PatientConsultation"; import { PatientPage } from "../../pageobject/Patient/PatientCreation"; +import PatientPrescription from "../../pageobject/Patient/PatientPrescription"; describe("Patient", () => { const loginPage = new LoginPage(); const patientPage = new PatientPage(); const patientConsultationPage = new PatientConsultationPage(); + const patientPrescription = new PatientPrescription(); before(() => { loginPage.loginAsDisctrictAdmin(); @@ -40,22 +42,21 @@ describe("Patient", () => { patientConsultationPage.visitDoctorNotesPage(); patientConsultationPage.addDoctorsNotes("Test Doctor Notes"); patientConsultationPage.postDoctorNotes(); - patientConsultationPage.verifySuccessNotification( - "Note added successfully" - ); + cy.verifyNotification("Note added successfully"); }); it("Edit prescription for an already created patient", () => { patientPage.visitPatient("Dummy Patient 4"); - patientConsultationPage.visitEditPrescriptionPage(); - patientConsultationPage.clickAddPrescription(); - patientConsultationPage.interceptMediaBase(); - patientConsultationPage.selectMedicinebox(); - patientConsultationPage.waitForMediabaseStatusCode(); - patientConsultationPage.prescribesecondMedicine(); - patientConsultationPage.enterDosage("4"); - patientConsultationPage.selectDosageFrequency("Twice daily"); - patientConsultationPage.submitPrescription(); + patientPrescription.visitEditPrescriptionPage(); + patientPrescription.clickAddPrescription(); + patientPrescription.interceptMediaBase(); + patientPrescription.selectMedicinebox(); + patientPrescription.waitForMediabaseStatusCode(); + patientPrescription.selectMedicine("DOLO"); + patientPrescription.enterDosage("4"); + patientPrescription.selectDosageFrequency("Twice daily"); + cy.submitButton("Submit"); + cy.verifyNotification("Medicine prescribed"); }); it("Upload consultations file ", () => { diff --git a/cypress/e2e/patient_spec/patient_registration.cy.ts b/cypress/e2e/patient_spec/patient_registration.cy.ts index 1dce2c7c6f7..eb6bfc079f1 100644 --- a/cypress/e2e/patient_spec/patient_registration.cy.ts +++ b/cypress/e2e/patient_spec/patient_registration.cy.ts @@ -3,8 +3,8 @@ import LoginPage from "../../pageobject/Login/LoginPage"; import { PatientPage } from "../../pageobject/Patient/PatientCreation"; import FacilityPage from "../../pageobject/Facility/FacilityCreation"; import { - emergency_phone_number, - phone_number, + generatePhoneNumber, + generateEmergencyPhoneNumber, } from "../../pageobject/constants"; import PatientTransfer from "../../pageobject/Patient/PatientTransfer"; import PatientExternal from "../../pageobject/Patient/PatientExternal"; @@ -26,6 +26,8 @@ describe("Patient Creation with consultation", () => { const patientExternal = new PatientExternal(); const patientInsurance = new PatientInsurance(); const patientMedicalHistory = new PatientMedicalHistory(); + const phone_number = generatePhoneNumber(); + const emergency_phone_number = generateEmergencyPhoneNumber(); const age = calculateAge(); const patientFacility = "Dummy Facility 40"; const patientDateOfBirth = "01012001"; diff --git a/cypress/e2e/users_spec/user_creation.cy.ts b/cypress/e2e/users_spec/user_creation.cy.ts index b8e0dfe63eb..d9b3e52ddaf 100644 --- a/cypress/e2e/users_spec/user_creation.cy.ts +++ b/cypress/e2e/users_spec/user_creation.cy.ts @@ -5,8 +5,8 @@ import FacilityPage from "../../pageobject/Facility/FacilityCreation"; import { UserPage } from "../../pageobject/Users/UserSearch"; import { UserCreationPage } from "../../pageobject/Users/UserCreation"; import { - emergency_phone_number, - phone_number, + generatePhoneNumber, + generateEmergencyPhoneNumber, } from "../../pageobject/constants"; describe("User Creation", () => { @@ -15,6 +15,8 @@ describe("User Creation", () => { const userCreationPage = new UserCreationPage(); const facilityPage = new FacilityPage(); const assetSearchPage = new AssetSearchPage(); + const phone_number = generatePhoneNumber(); + const emergency_phone_number = generateEmergencyPhoneNumber(); const fillFacilityName = "Dummy Facility 40"; const makeid = (length: number) => { let result = ""; diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts index 6be99cf5758..f799197b7cb 100644 --- a/cypress/pageobject/Facility/FacilityCreation.ts +++ b/cypress/pageobject/Facility/FacilityCreation.ts @@ -289,9 +289,7 @@ class FacilityPage { } confirmDeleteFacility() { - cy.intercept("DELETE", "**/api/v1/facility/**").as("deleteFacility"); - cy.get("#submit").contains("Delete").click(); - cy.wait("@deleteFacility").its("response.statusCode").should("eq", 403); + cy.submitButton("Delete"); } selectLocation(location: string) { diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts index bc2e8f330a3..d88c79dafd7 100644 --- a/cypress/pageobject/Patient/PatientConsultation.ts +++ b/cypress/pageobject/Patient/PatientConsultation.ts @@ -1,109 +1,98 @@ export class PatientConsultationPage { selectConsultationStatus(status: string) { + cy.wait(5000); cy.get("#route_to_facility").scrollIntoView(); cy.get("#route_to_facility").should("be.visible"); - cy.get("#route_to_facility") - .click() - .then(() => { - cy.get("[role='option']").contains(status).click(); - }); + cy.clickAndSelectOption("#route_to_facility", status); } - selectSymptoms(symptoms: string) { - cy.get("#symptoms") - .click() - .then(() => { - cy.get("[role='option']").contains(symptoms).click(); - }); + selectSymptoms(symptoms) { + cy.clickAndMultiSelectOption("#symptoms", symptoms); + } + + selectSymptomsDate(selector: string, date: string) { + cy.clickAndTypeDate(selector, date); } verifyConsultationPatientName(patientName: string) { cy.get("#patient-name-consultation").should("contain", patientName); } - fillIllnessHistory(history: string) { - cy.wait(5000); - cy.get("#history_of_present_illness").scrollIntoView(); - cy.get("#history_of_present_illness").should("be.visible"); - cy.get("#history_of_present_illness").click().type(history); - } - - enterConsultationDetails( - category: string, - examinationDetails: string, - weight: string, - height: string, - ipNumber: string, - consulationNotes: string, - verificationBy: string - ) { - cy.get("#symptoms").click(); - cy.get("#category") - .click() - .then(() => { - cy.get("[role='option']").contains(category).click(); - }); - cy.get("#examination_details").click().type(examinationDetails); - cy.get("#weight").click().type(height); - cy.get("#height").click().type(weight); - cy.get("#patient_no").type(ipNumber); - cy.intercept("GET", "**/icd/**").as("getIcdResults"); - cy.get("#icd11-search input[role='combobox']") - .scrollIntoView() - .click() - .type("1A00"); - cy.get("#icd11-search [role='option']") - .contains("1A00 Cholera") - .scrollIntoView() - .click(); - cy.get("#condition-verification-status-menu").click(); - cy.get("#add-icd11-diagnosis-as-confirmed").click(); - cy.wait("@getIcdResults").its("response.statusCode").should("eq", 200); - - cy.get("#principal-diagnosis-select").click(); - cy.get("#principal-diagnosis-select [role='option']").first().click(); - - cy.get("#consultation_notes").click().type(consulationNotes); - cy.get("#treating_physician") + selectPatientCategory(category: string) { + cy.clickAndSelectOption("#category", category); + } + + selectPatientReferance(referance: string) { + cy.searchAndSelectOption("#referred_to", referance); + } + + selectPatientWard(ward: string) { + cy.searchAndSelectOption("#transferred_from_location", ward); + } + + selectPatientSuggestion(suggestion: string) { + cy.clickAndSelectOption("#suggestion", suggestion); + } + + typeCauseOfDeath(cause: string) { + cy.get("#cause_of_death").click().type(cause); + } + + typeDeathConfirmedBy(doctor: string) { + cy.get("#death_confirmed_doctor").click().type(doctor); + } + + selectPatientDiagnosis(icdCode, statusId) { + cy.searchAndSelectOption("#icd11-search", icdCode); + cy.get("#diagnosis-list") + .contains("Add as") + .focus() .click() - .type(verificationBy) .then(() => { - cy.get("[role='option']").contains("Dev Doctor").click(); + cy.get(`#${statusId}`).click(); }); } - submitConsultation() { - cy.get("#submit").click(); + typePatientConsultationDate(selector: string, date: string) { + cy.get(selector).clear().click().type(date); } - clickAddPrescription() { - cy.contains("button", "Add Prescription Medication") - .should("be.visible") - .click(); + clickPatientDetails() { + cy.verifyAndClickElement("#consultationpage-header", "Patient Details"); } - interceptMediaBase() { - cy.intercept("GET", "**/api/v1/medibase/**").as("getMediaBase"); + typePatientIllnessHistory(history: string) { + cy.get("#history_of_present_illness").clear().click().type(history); } - prescribefirstMedicine() { - cy.get("div#medicine_object input[placeholder='Select'][role='combobox']") - .click() - .type("dolo") - .type("{downarrow}{enter}"); + typePatientExaminationHistory(examination: string) { + cy.get("#examination_details").type(examination); } - prescribesecondMedicine() { - cy.get("div#medicine_object input[placeholder='Select'][role='combobox']") - .click() - .type("dolo") - .type("{downarrow}{downarrow}{enter}"); + typePatientWeight(weight: string) { + cy.get("#weight").type(weight); + } + + typePatientHeight(height: string) { + cy.get("#height").type(height); + } + + typePatientNumber(number: string) { + cy.get("#patient_no").scrollIntoView(); + cy.get("#patient_no").type(number); + } + + selectPatientPrincipalDiagnosis(diagnosis: string) { + cy.clickAndSelectOption("#principal-diagnosis-select", diagnosis); + } + + verifyTextInConsultation(selector, text) { + cy.get(selector).scrollIntoView(); + cy.get(selector).contains(text).should("be.visible"); } - selectMedicinebox() { - cy.get( - "div#medicine_object input[placeholder='Select'][role='combobox']" - ).click(); + typeReferringFacility(referringFacility: string) { + cy.searchAndSelectOption("#referred_from_facility", referringFacility); } visitFilesPage() { @@ -124,82 +113,19 @@ export class PatientConsultationPage { cy.wait("@uploadFile").its("response.statusCode").should("eq", 201); } - waitForMediabaseStatusCode() { - cy.wait("@getMediaBase").its("response.statusCode").should("eq", 200); - } - - enterDosage(doseAmount: string) { - cy.get("#dosage").type(doseAmount, { force: true }); - } - - selectDosageFrequency(frequency: string) { - cy.get("#frequency") - .click() - .then(() => { - cy.get("div#frequency [role='option']").contains(frequency).click(); - }); - } - - submitPrescriptionAndReturn() { - cy.intercept("POST", "**/api/v1/consultation/*/prescriptions/").as( - "submitPrescription" - ); - cy.get("button#submit").should("be.visible").click(); - cy.get("[data-testid='return-to-patient-dashboard']").click(); - cy.wait("@submitPrescription").its("response.statusCode").should("eq", 201); - } - clickEditConsultationButton() { cy.get("#consultation-buttons").scrollIntoView(); cy.get("button").contains("Manage Patient").click(); - cy.get("#consultation-buttons") - .contains("Edit Consultation Details") - .click(); - } - - setSymptomsDate(date: string) { - cy.get("#symptoms_onset_date") - .click() - .then(() => { - cy.get("[placeholder='DD/MM/YYYY']").type(date); - }); - } - - updateConsultation() { - cy.intercept("PUT", "**/api/v1/consultation/**").as("updateConsultation"); - cy.get("#submit").contains("Update Consultation").click(); - cy.wait("@updateConsultation").its("response.statusCode").should("eq", 200); - } - - verifySuccessNotification(message: string) { - cy.verifyNotification(message); - } - - updateSymptoms(symptoms: string) { - this.selectSymptoms(symptoms); - cy.get("#symptoms").click(); + cy.verifyAndClickElement( + "#consultation-buttons", + "Edit Consultation Details" + ); } visitShiftRequestPage() { cy.get("#create_shift_request").click(); } - enterPatientShiftDetails( - name: string, - phone_number: string, - facilityName: string, - reason: string - ) { - cy.get("#refering_facility_contact_name").type(name); - cy.get("#refering_facility_contact_number").type(phone_number); - cy.get("input[name='assigned_facility']") - .type(facilityName) - .then(() => { - cy.get("[role='option']").first().click(); - }); - cy.get("#reason").type(reason); - } - createShiftRequest() { cy.intercept("POST", "**/api/v1/shift/").as("createShiftRequest"); cy.get("#submit").click(); @@ -247,28 +173,4 @@ export class PatientConsultationPage { cy.get("#submit").contains("Confirm Discharge").click(); cy.wait("@dischargePatient").its("response.statusCode").should("eq", 200); } - - discontinuePreviousPrescription() { - cy.intercept( - "POST", - "**/api/v1/consultation/*/prescriptions/*/discontinue/" - ).as("deletePrescription"); - cy.get("button").contains("Discontinue").click(); - cy.get("#submit").contains("Discontinue").click(); - cy.wait("@deletePrescription").its("response.statusCode").should("eq", 200); - } - - visitEditPrescriptionPage() { - cy.get("#consultation_tab_nav").scrollIntoView(); - cy.get("#consultation_tab_nav").contains("Medicines").click(); - cy.get("a[href='prescriptions']").first().click(); - } - - submitPrescription() { - cy.intercept("POST", "**/api/v1/consultation/*/prescriptions/").as( - "submitPrescription" - ); - cy.get("#submit").contains("Submit").click(); - cy.wait("@submitPrescription").its("response.statusCode").should("eq", 201); - } } diff --git a/cypress/pageobject/Patient/PatientDeathReport.ts b/cypress/pageobject/Patient/PatientDeathReport.ts new file mode 100644 index 00000000000..4a0a9f8dd2c --- /dev/null +++ b/cypress/pageobject/Patient/PatientDeathReport.ts @@ -0,0 +1,14 @@ +class PatientDeathReport { + clickDeathReport() { + cy.get("#death-report").click(); + } + + verifyDeathReportAutofill(selector: string, value: string) { + cy.get(selector).should("have.value", value); + } + + clickPrintDeathReport() { + cy.get("#print-deathreport").click(); + } +} +export default PatientDeathReport; diff --git a/cypress/pageobject/Patient/PatientInvestigation.ts b/cypress/pageobject/Patient/PatientInvestigation.ts new file mode 100644 index 00000000000..c226c358676 --- /dev/null +++ b/cypress/pageobject/Patient/PatientInvestigation.ts @@ -0,0 +1,27 @@ +class PatientInvestigation { + clickAddInvestigation() { + cy.get("#investigation").scrollIntoView(); + cy.verifyAndClickElement("#investigation", "Add Investigation"); + } + + clickInvestigationTab() { + cy.get("#consultation_tab_nav").scrollIntoView(); + cy.verifyAndClickElement("#consultation_tab_nav", "Investigations"); + } + + selectInvestigation(investigation: string) { + cy.get("#search-patient-investigation").click(); + cy.verifyAndClickElement("#investigation-group", investigation); + cy.verifyAndClickElement("#investigation", "Investigation No. 1"); + } + + clickInvestigationCheckbox() { + cy.get("#investigation-checkbox").click(); + } + + selectInvestigationFrequency(frequency: string) { + cy.get("#investigation-frequency").click(); + cy.contains("button", frequency).should("be.visible").click(); + } +} +export default PatientInvestigation; diff --git a/cypress/pageobject/Patient/PatientPredefined.ts b/cypress/pageobject/Patient/PatientPredefined.ts new file mode 100644 index 00000000000..6b2bcc0d472 --- /dev/null +++ b/cypress/pageobject/Patient/PatientPredefined.ts @@ -0,0 +1,34 @@ +// PatientPredefined.js + +import { PatientPage } from "../../pageobject/Patient/PatientCreation"; +import FacilityPage from "../../pageobject/Facility/FacilityCreation"; +import PatientMedicalHistory from "../../pageobject/Patient/PatientMedicalHistory"; +import { + generatePhoneNumber, + generateEmergencyPhoneNumber, +} from "../../pageobject/constants"; + +class PatientPredefined { + createPatient() { + const patientPage = new PatientPage(); + const facilityPage = new FacilityPage(); + const patientMedicalHistory = new PatientMedicalHistory(); + const phone_number = generatePhoneNumber(); + const emergency_phone_number = generateEmergencyPhoneNumber(); + patientPage.typePatientPhoneNumber(phone_number); + patientPage.typePatientEmergencyNumber(emergency_phone_number); + patientPage.typePatientDateOfBirth("01012001"); + patientPage.typePatientName("Patient With Predefined Data"); + patientPage.selectPatientGender("Male"); + patientPage.typePatientAddress("Test Patient Address"); + facilityPage.fillPincode("682001"); + facilityPage.selectStateOnPincode("Kerala"); + facilityPage.selectDistrictOnPincode("Ernakulam"); + facilityPage.selectLocalBody("Aluva"); + facilityPage.selectWard("4"); + patientMedicalHistory.clickNoneMedicialHistory(); + patientPage.selectPatientBloodGroup("O+"); + } +} + +export default PatientPredefined; diff --git a/cypress/pageobject/Patient/PatientPrescription.ts b/cypress/pageobject/Patient/PatientPrescription.ts new file mode 100644 index 00000000000..c20d32672d6 --- /dev/null +++ b/cypress/pageobject/Patient/PatientPrescription.ts @@ -0,0 +1,60 @@ +export class PatientPrescription { + clickAddPrescription() { + cy.contains("button", "Add Prescription Medication") + .should("be.visible") + .click(); + } + + interceptMediaBase() { + cy.intercept("GET", "**/api/v1/medibase/**").as("getMediaBase"); + } + + selectMedicine(medicine: string) { + cy.searchAndSelectOption( + "div#medicine_object input[placeholder='Select'][role='combobox']", + medicine + ); + } + + selectMedicinebox() { + cy.get( + "div#medicine_object input[placeholder='Select'][role='combobox']" + ).click(); + } + + waitForMediabaseStatusCode() { + cy.wait("@getMediaBase").its("response.statusCode").should("eq", 200); + } + + enterDosage(doseAmount: string) { + cy.get("#dosage").type(doseAmount, { force: true }); + } + + selectDosageFrequency(frequency: string) { + cy.clickAndSelectOption("#frequency", frequency); + } + + clickReturnToDashboard() { + cy.verifyAndClickElement( + "[data-testid='return-to-patient-dashboard']", + "Return to Patient Dashboard" + ); + } + + discontinuePreviousPrescription() { + cy.intercept( + "POST", + "**/api/v1/consultation/*/prescriptions/*/discontinue/" + ).as("deletePrescription"); + cy.get("button").contains("Discontinue").click(); + cy.get("#submit").contains("Discontinue").click(); + cy.wait("@deletePrescription").its("response.statusCode").should("eq", 200); + } + + visitEditPrescriptionPage() { + cy.get("#consultation_tab_nav").scrollIntoView(); + cy.get("#consultation_tab_nav").contains("Medicines").click(); + cy.get("a[href='prescriptions']").first().click(); + } +} +export default PatientPrescription; diff --git a/cypress/pageobject/Patient/PatientTreatmentPlan.ts b/cypress/pageobject/Patient/PatientTreatmentPlan.ts new file mode 100644 index 00000000000..70af5604776 --- /dev/null +++ b/cypress/pageobject/Patient/PatientTreatmentPlan.ts @@ -0,0 +1,47 @@ +class PatientTreatmentPlan { + typePatientGeneralInstruction(instruction: string) { + cy.get("#consultation_notes").type(instruction); + } + + fillTreatingPhysican(doctor: string) { + cy.searchAndSelectOption("#treating_physician", doctor); + } + + selectReviewAfter(time: string) { + cy.clickAndSelectOption("#review_interval", time); + } + + selectAction(action: string) { + cy.clickAndSelectOption("#action", action); + } + + clickTelemedicineCheckbox() { + cy.get("#is_telemedicine").click(); + } + + assignTelemedicineDoctor(doctor: string) { + cy.searchAndSelectOption("#assigned_to", doctor); + } + + clickAddProcedure() { + cy.get("#procedure").scrollIntoView(); + cy.verifyAndClickElement("#procedure", "Add Procedures"); + } + + typeProcedureName(procedure: string) { + cy.get("#procedure-name").type(procedure); + } + + typeProcedureTime(time: string) { + cy.get("#procedure-time").type(time); + } + + typeTreatmentPlan(treatment: string) { + cy.get("#treatment_plan").type(treatment); + } + + typeSpecialInstruction(instruction: string) { + cy.get("#special_instruction").type(instruction); + } +} +export default PatientTreatmentPlan; diff --git a/cypress/pageobject/Shift/ShiftCreation.ts b/cypress/pageobject/Shift/ShiftCreation.ts new file mode 100644 index 00000000000..f0b133ed2f0 --- /dev/null +++ b/cypress/pageobject/Shift/ShiftCreation.ts @@ -0,0 +1,18 @@ +export class ShiftCreation { + typeCurrentFacilityPerson(name: string) { + cy.get("#refering_facility_contact_name").click().type(name); + } + + typeCurrentFacilityPhone(number: string) { + cy.get("#refering_facility_contact_number").click().type(number); + } + + typeShiftReason(reason: string) { + cy.get("#reason").click().type(reason); + } + + submitShiftForm() { + cy.get("#submit").contains("Submit").click(); + } +} +export default ShiftCreation; diff --git a/cypress/pageobject/constants.ts b/cypress/pageobject/constants.ts index 72e0d31c662..08411e84b6a 100644 --- a/cypress/pageobject/constants.ts +++ b/cypress/pageobject/constants.ts @@ -1,4 +1,7 @@ -export const phone_number = - "9" + Math.floor(100000000 + Math.random() * 900000000); -export const emergency_phone_number = - "9" + Math.floor(100000000 + Math.random() * 900000000); +export function generatePhoneNumber() { + return "9" + Math.floor(100000000 + Math.random() * 900000000).toString(); +} + +export function generateEmergencyPhoneNumber() { + return "9" + Math.floor(100000000 + Math.random() * 900000000).toString(); +} diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 0314f65feee..5170635647e 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -111,3 +111,73 @@ Cypress.Commands.add("getAttached", (selector) => { Cypress.Commands.add("clearAllFilters", () => { return cy.get("#clear-all-filters").click(); }); + +Cypress.Commands.add("submitButton", (buttonText = "Submit") => { + cy.get("button[type='submit']").contains(buttonText).click(); +}); + +Cypress.Commands.add( + "searchAndSelectOption", + (element: string, referance: string) => { + cy.get(element) + .click() + .type(referance) + .then(() => { + cy.get("[role='option']").contains(referance).click(); + }); + } +); + +Cypress.Commands.add( + "clickAndMultiSelectOption", + (selector: string, options: string | string[]) => { + const optionArray = Array.isArray(options) ? options : [options]; + cy.get(selector) + .click() + .then(() => { + optionArray.forEach((options) => { + cy.get("[role='option']").contains(options).click(); + }); + cy.get(selector).click(); + }); + } +); + +Cypress.Commands.add( + "clickAndSelectOption", + (element: string, reference: string) => { + cy.get(element) + .click() + .then(() => { + cy.get("[role='option']").contains(reference).click(); + }); + } +); + +Cypress.Commands.add("clickAndTypeDate", (selector: string, date: string) => { + cy.get(selector).scrollIntoView(); + cy.get(selector).click(); + cy.get("#date-input").click().type(date); +}); + +Cypress.Commands.add( + "verifyAndClickElement", + (element: string, reference: string) => { + cy.get(element).scrollIntoView(); + cy.get(element).contains(reference).should("be.visible").click(); + } +); + +Cypress.Commands.add("preventPrint", () => { + cy.window().then((win) => { + cy.stub(win, "print").as("verifyPrevent"); + }); +}); + +Cypress.Commands.add("closeNotification", () => { + cy.get(".pnotify") + .should("exist") + .each(($div) => { + cy.wrap($div).click(); + }); +}); diff --git a/cypress/support/index.ts b/cypress/support/index.ts index ea1a9b73a0b..46e695b6507 100644 --- a/cypress/support/index.ts +++ b/cypress/support/index.ts @@ -14,6 +14,26 @@ declare global { ): Chainable; getAttached(selector: string): Chainable; clearAllFilters(): Chainable; + submitButton(buttonText?: string): Chainable; + searchAndSelectOption( + element: string, + referance: string + ): Chainable; + clickAndMultiSelectOption( + selector: string, + symptoms: string | string[] + ): Chainable; + clickAndTypeDate(date: string, selector: string): Chainable; + clickAndSelectOption( + element: string, + reference: string + ): Chainable; + verifyAndClickElement( + element: string, + reference: string + ): Chainable; + preventPrint(): Chainable; + closeNotification(): Chainable; } } } diff --git a/src/Components/Common/prescription-builder/InvestigationBuilder.tsx b/src/Components/Common/prescription-builder/InvestigationBuilder.tsx index cb0bbac1f66..7cf7e3024ad 100644 --- a/src/Components/Common/prescription-builder/InvestigationBuilder.tsx +++ b/src/Components/Common/prescription-builder/InvestigationBuilder.tsx @@ -151,18 +151,20 @@ export default function InvestigationBuilder( Investigations Recommended {" *"} - setActiveIdx(i)} - onBlur={() => setActiveIdx(null)} - /> +
+ setActiveIdx(i)} + onBlur={() => setActiveIdx(null)} + /> +
@@ -170,6 +172,7 @@ export default function InvestigationBuilder( Is the investigation repetitive?
setActiveIdx(i)} onBlur={() => setActiveIdx(null)} @@ -191,14 +194,16 @@ export default function InvestigationBuilder(
Frequency{" *"}
- setActiveIdx(i)} - onBlur={() => setActiveIdx(null)} - /> +
+ setActiveIdx(i)} + onBlur={() => setActiveIdx(null)} + /> +
) : (
diff --git a/src/Components/Common/prescription-builder/PrescriptionDropdown.tsx b/src/Components/Common/prescription-builder/PrescriptionDropdown.tsx index 60da9a65e87..5730e4bcdfe 100644 --- a/src/Components/Common/prescription-builder/PrescriptionDropdown.tsx +++ b/src/Components/Common/prescription-builder/PrescriptionDropdown.tsx @@ -60,6 +60,7 @@ export function PrescriptionDropdown(props: { return (