Skip to content

Commit

Permalink
Add Cypress Test Suite for Sample Test Request Workflow (#8977)
Browse files Browse the repository at this point in the history
Co-authored-by: Mohammed Nihal <57055998+nihal467@users.noreply.github.com>
  • Loading branch information
JavidSumra and nihal467 authored Nov 19, 2024
1 parent 2dc5923 commit b17eb22
Show file tree
Hide file tree
Showing 23 changed files with 350 additions and 83 deletions.
4 changes: 2 additions & 2 deletions cypress/e2e/facility_spec/FacilityHomepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,15 @@ describe("Facility Homepage Function", () => {
facilityNotify.verifyFacilityName(facilityName);
facilityNotify.fillNotifyText(notificationMessage);
facilityNotify.interceptPostNotificationReq();
cy.submitButton("Notify");
cy.clickSubmitButton("Notify");
facilityNotify.verifyPostNotificationReq();
cy.verifyNotification("Facility Notified");
cy.closeNotification();
cy.wait(2000);
// Verify the frontend error on empty message
facilityHome.clickFacilityNotifyButton();
facilityNotify.verifyFacilityName(facilityName);
cy.submitButton("Notify");
cy.clickSubmitButton("Notify");
facilityNotify.verifyErrorMessage(notificationErrorMsg);
// close pop-up and verify
facilityHome.verifyAndCloseNotifyModal();
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/facility_spec/FacilityLocation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,14 @@ describe("Location Management Section", () => {
facilityLocation.clickAddNewLocationButton();
facilityLocation.enterLocationName("Test Location with Beds");
facilityLocation.selectLocationType("OTHER");
cy.submitButton("Add Location");
cy.clickSubmitButton("Add Location");
cy.verifyNotification("Location created successfully");
cy.closeNotification();
facilityLocation.clickManageBedButton();
facilityLocation.clickAddBedButton();
facilityLocation.enterBedName("Bed 1");
facilityLocation.selectBedType("Regular");
cy.submitButton("Add Bed(s)");
cy.clickSubmitButton("Add Bed(s)");
cy.verifyNotification("1 Bed created successfully");
cy.closeNotification();
facilityLocation.loadLocationManagementPage("Dummy Shifting Center");
Expand Down
4 changes: 3 additions & 1 deletion cypress/e2e/hcx_spec/HcxClaims.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe("HCX Claims configuration and approval workflow", () => {
firstInsuranceIdentifier,
patientInsurerName,
);
cy.submitButton("Save Details");
cy.clickSubmitButton("Save Details");
cy.verifyNotification("Patient updated successfully");
cy.closeNotification();
// Navigate to Consultation View and capture dynamic consultation ID
Expand Down Expand Up @@ -80,6 +80,8 @@ describe("HCX Claims configuration and approval workflow", () => {
// Raise a HCX Pre-auth
patientConsultationPage.clickManagePatientButton();
patientConsultationPage.clickClaimsButton();
cy.verifyAndClickElement("#edit-insurance-policy", "Edit Insurance Policy");
cy.clickCancelButton();
hcxClaims.selectEligiblePolicy(patientInsurerName);
hcxClaims.verifyPolicyEligibility();
cy.verifyNotification("Checking Policy Eligibility");
Expand Down
22 changes: 11 additions & 11 deletions cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ describe("Patient Consultation in multiple combination", () => {
patientTreatmentPlan.typePatientGeneralInstruction(generalInstruction);
patientTreatmentPlan.typeSpecialInstruction(specialInstruction);
patientTreatmentPlan.fillTreatingPhysican(doctorName);
cy.submitButton("Create Consultation");
cy.clickSubmitButton("Create Consultation");
// the above submit should fail as IP number is missing
patientConsultationPage.typePatientNumber(patientIpNumber);
patientConsultationPage.selectBed("Dummy Bed 6");
cy.submitButton("Create Consultation");
cy.clickSubmitButton("Create Consultation");
cy.verifyNotification("Consultation created successfully");
// Below code for the prescription module only present while creating a new consultation
patientPrescription.clickAddPrescription();
Expand All @@ -104,7 +104,7 @@ describe("Patient Consultation in multiple combination", () => {
patientPrescription.selectMedicine(medicineOne);
patientPrescription.enterDosage("3");
patientPrescription.selectDosageFrequency("Twice daily");
cy.submitButton("Submit");
cy.clickSubmitButton("Submit");
cy.wait(2000);
cy.verifyNotification("Medicine prescribed");
patientPrescription.clickReturnToDashboard();
Expand Down Expand Up @@ -189,7 +189,7 @@ describe("Patient Consultation in multiple combination", () => {
"#encounter_date",
"220220241230",
);
cy.submitButton("Create Consultation");
cy.clickSubmitButton("Create Consultation");
cy.verifyNotification(
"Create Diagnoses - Atleast one diagnosis is required",
);
Expand All @@ -198,7 +198,7 @@ describe("Patient Consultation in multiple combination", () => {
diagnosis4,
"add-icd11-diagnosis-as-confirmed",
);
cy.submitButton("Create Consultation");
cy.clickSubmitButton("Create Consultation");
cy.verifyNotification("Consultation created successfully");
// verify the data and death report
patientConsultationPage.verifyTextInConsultation(
Expand All @@ -215,7 +215,7 @@ describe("Patient Consultation in multiple combination", () => {
"#cause_of_death",
"Cause of Death",
);
cy.submitButton("Preview");
cy.clickSubmitButton("Preview");
cy.preventPrint();
patientDeathReport.clickPrintDeathReport();
cy.get("@verifyPrevent").should("be.called");
Expand Down Expand Up @@ -261,7 +261,7 @@ describe("Patient Consultation in multiple combination", () => {
// add telemedicine
patientTreatmentPlan.clickTelemedicineCheckbox();
patientTreatmentPlan.assignTelemedicineDoctor(doctorName);
cy.submitButton("Create Consultation");
cy.clickSubmitButton("Create Consultation");
cy.verifyNotification("Consultation created successfully");
// verify the data reflection -
patientConsultationPage.verifyTextInConsultation(
Expand Down Expand Up @@ -312,7 +312,7 @@ describe("Patient Consultation in multiple combination", () => {
patientTreatmentPlan.typePatientGeneralInstruction(generalInstruction);
// no review after and no action
patientTreatmentPlan.fillTreatingPhysican(doctorName);
cy.submitButton("Create Consultation");
cy.clickSubmitButton("Create Consultation");
cy.verifyNotification("Patient discharged successfully");
// verify the Discharge Reason, Diagnosis, treatment physican
patientConsultationPage.verifyTextInConsultation(
Expand Down Expand Up @@ -364,13 +364,13 @@ describe("Patient Consultation in multiple combination", () => {
patientTreatmentPlan.typePatientGeneralInstruction(generalInstruction);
patientTreatmentPlan.fillTreatingPhysican(doctorName);
// no review after and no action
cy.submitButton("Create Consultation");
cy.clickSubmitButton("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.clickSubmitButton("Submit");
cy.verifyNotification("Shift request created successfully");
});

Expand All @@ -386,7 +386,7 @@ describe("Patient Consultation in multiple combination", () => {
cy.get("#condition-verification-status-menu").click();
cy.get("#add-icd11-diagnosis-as-entered-in-error").click();
});
cy.submitButton("Update Consultation");
cy.clickSubmitButton("Update Consultation");
cy.verifyNotification("Consultation updated successfully");
cy.get("#diagnoses-view").should("not.contain.text", diagnosis5);
patientConsultationPage.verifyTextInConsultation(
Expand Down
18 changes: 9 additions & 9 deletions cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ describe("Patient Discharge based on multiple reason", () => {
patientPage.visitPatient("Dummy Patient 12");
patientDischarge.clickDischarge();
patientDischarge.selectDischargeReason(patientDischargeReason4);
cy.submitButton("Confirm Discharge");
cy.submitButton("Acknowledge & Submit");
cy.clickSubmitButton("Confirm Discharge");
cy.clickSubmitButton("Acknowledge & Submit");
cy.verifyNotification("Patient Discharged Successfully");
cy.closeNotification();
// Verify the consultation dashboard reflection
Expand All @@ -52,8 +52,8 @@ describe("Patient Discharge based on multiple reason", () => {
patientDischarge.selectDischargeReason(patientDischargeReason3);
patientDischarge.typeDischargeNote(patientDeathCause);
patientDischarge.typeDoctorName(doctorName);
cy.submitButton("Confirm Discharge");
cy.submitButton("Acknowledge & Submit");
cy.clickSubmitButton("Confirm Discharge");
cy.clickSubmitButton("Acknowledge & Submit");
cy.verifyNotification("Patient Discharged Successfully");
cy.closeNotification();
// Verify the consultation dashboard reflection
Expand All @@ -77,8 +77,8 @@ describe("Patient Discharge based on multiple reason", () => {
// select a non-registered facility and perform the discharge
patientDischarge.typeReferringFacility(referringFreetextFacility);
cy.wait(2000);
cy.submitButton("Confirm Discharge");
cy.submitButton("Acknowledge & Submit");
cy.clickSubmitButton("Confirm Discharge");
cy.clickSubmitButton("Acknowledge & Submit");
cy.wait(2000);
cy.verifyNotification("Patient Discharged Successfully");
cy.closeNotification();
Expand All @@ -104,13 +104,13 @@ describe("Patient Discharge based on multiple reason", () => {
patientPrescription.selectMedicine(patientMedicine);
patientPrescription.enterDosage("4");
patientPrescription.selectDosageFrequency("Twice daily");
cy.submitButton("Submit");
cy.clickSubmitButton("Submit");
cy.verifyNotification("Medicine prescribed");
cy.wait(2000);
cy.closeNotification();
// submit the discharge pop-up
cy.submitButton("Confirm Discharge");
cy.submitButton("Acknowledge & Submit");
cy.clickSubmitButton("Confirm Discharge");
cy.clickSubmitButton("Acknowledge & Submit");
cy.wait(2000);
cy.verifyNotification("Patient Discharged Successfully");
cy.closeNotification();
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/patient_spec/PatientInvestigation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("Patient Investigation Creation from Patient consultation page", () =>
"Haematology",
"Urine Test",
]);
cy.submitButton("Save Investigation");
cy.clickSubmitButton("Save Investigation");
cy.verifyNotification("Please Enter at least one value");
cy.closeNotification();
// Temporary workflow for investigation since we dont have dummy data and moving away from existing module
Expand Down
40 changes: 20 additions & 20 deletions cypress/e2e/patient_spec/PatientLogUpdate.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientPage.visitPatient(domicilaryPatient);
patientConsultationPage.clickEditConsultationButton();
patientConsultationPage.selectPatientSuggestion("Domiciliary Care");
cy.submitButton("Update Consultation");
cy.clickSubmitButton("Update Consultation");
cy.verifyNotification("Consultation updated successfully");
cy.closeNotification();
patientLogupdate.clickLogupdate();
Expand All @@ -74,7 +74,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.selectRhythm(patientRhythmType);
patientLogupdate.typeRhythm(patientRhythm);
cy.get("#consciousness_level-option-RESPONDS_TO_PAIN").click();
cy.submitButton("Save");
cy.clickSubmitButton("Save");
cy.verifyNotification("Tele-medicine Log created successfully");
});

Expand Down Expand Up @@ -108,25 +108,25 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientPrescription.selectMedicine("DOLO");
patientPrescription.enterDosage("4");
patientPrescription.selectDosageFrequency("Twice daily");
cy.submitButton("Submit");
cy.clickSubmitButton("Submit");
cy.verifyNotification("Medicine prescribed");
cy.closeNotification();
// Submit the doctors log update
cy.submitButton("Save and Continue");
cy.clickSubmitButton("Save and Continue");
cy.wait(2000);
cy.verifyNotification("Progress Note created successfully");
cy.closeNotification();
// modify the relevant critical care log update
patientLogupdate.selectCriticalCareSection("Neurological Monitoring");
cy.get("#consciousness_level-option-RESPONDS_TO_PAIN").click();
cy.get("#left_pupil_light_reaction-option-FIXED").click();
cy.submitButton("Update Details");
cy.clickSubmitButton("Update Details");
cy.verifyNotification(
"Neurological Monitoring details succesfully updated.",
);
cy.closeNotification();
// Final Submission of the form
cy.submitButton("Complete");
cy.clickSubmitButton("Complete");
cy.verifyNotification("Progress Note Log Update filed successfully");
cy.closeNotification();
// Verify the data reflection
Expand All @@ -143,7 +143,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.clickUpdateDetail();
patientLogupdate.typeSystolic(patientModifiedSystolic);
patientLogupdate.typeDiastolic(patientModifiedDiastolic);
cy.submitButton("Continue");
cy.clickSubmitButton("Continue");
cy.verifyNotification("Progress Note updated successfully");
});

Expand All @@ -156,7 +156,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.clickLogupdate();
patientLogupdate.selectRoundType("Detailed Update");
patientLogupdate.selectPatientCategory(patientCategory);
cy.submitButton("Save and Continue");
cy.clickSubmitButton("Save and Continue");
cy.verifyNotification("Detailed Update created successfully");
cy.closeNotification();
// Select two Section - First One is Respiratory Support
Expand All @@ -166,18 +166,18 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.selectOxygenSupport();
patientLogupdate.typeOxygenFlowRate(patientOxygenFlowRate);
patientLogupdate.typeVentilatorSpo2(patientSpo2);
cy.submitButton("Update Details");
cy.clickSubmitButton("Update Details");
cy.verifyNotification("Respiratory Support details succesfully updated.");
cy.closeNotification();
// Second Section will be Blood Sugar
patientLogupdate.selectCriticalCareSection("Blood Sugar");
patientLogupdate.typeBloodSugar(patientBloodSugar);
patientLogupdate.typeInsulinDosage(patientInsulinDosage);
cy.get("#insulin_intake_frequency-option-BD").click();
cy.submitButton("Update Details");
cy.clickSubmitButton("Update Details");
cy.verifyNotification("Blood Sugar details succesfully updated.");
// Submit the form and verify the details
cy.submitButton("Complete");
cy.clickSubmitButton("Complete");
cy.verifyNotification("Detailed Log Update filed successfully");
cy.closeNotification();
cy.contains("button", "Log Updates").click();
Expand All @@ -203,10 +203,10 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.selectCriticalCareSection("Dialysis");
patientLogupdate.typeFluidBalance(patientFluidBalance);
patientLogupdate.typeNetBalance(patientNetBalance);
cy.submitButton("Update Details");
cy.clickSubmitButton("Update Details");
cy.verifyNotification("Dialysis details succesfully updated.");
cy.closeNotification();
cy.submitButton("Complete");
cy.clickSubmitButton("Complete");
cy.verifyNotification("Detailed Log Update filed successfully");
cy.closeNotification();
//Reverify the editted and newly added data
Expand Down Expand Up @@ -251,7 +251,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.selectRhythm(patientRhythmType);
patientLogupdate.typeRhythm(patientRhythm);
cy.get("#consciousness_level-option-RESPONDS_TO_PAIN").click();
cy.submitButton("Save");
cy.clickSubmitButton("Save");
cy.wait(2000);
cy.verifyNotification("Brief Update created successfully");
// Verify the card content
Expand All @@ -263,7 +263,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientPage.visitPatient(domicilaryPatient);
patientConsultationPage.clickEditConsultationButton();
patientConsultationPage.selectPatientSuggestion("Domiciliary Care");
cy.submitButton("Update Consultation");
cy.clickSubmitButton("Update Consultation");
cy.verifyNotification("Consultation updated successfully");
cy.closeNotification();
patientLogupdate.clickLogupdate();
Expand All @@ -281,7 +281,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.selectRhythm(patientRhythmType);
patientLogupdate.typeRhythm(patientRhythm);
cy.get("#consciousness_level-option-RESPONDS_TO_PAIN").click();
cy.submitButton("Save");
cy.clickSubmitButton("Save");
cy.verifyNotification("Brief Update created successfully");
cy.closeNotification();
// edit the card and verify the data.
Expand All @@ -307,7 +307,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.typeSystolic(patientModifiedSystolic);
patientLogupdate.clearIntoElementById("#diastolic");
patientLogupdate.typeDiastolic(patientModifiedDiastolic);
cy.submitButton("Continue");
cy.clickSubmitButton("Continue");
cy.verifyNotification("Brief Update updated successfully");
cy.contains("button", "Log Updates").click();
patientLogupdate.clickLogUpdateViewDetails(
Expand All @@ -324,7 +324,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientPage.visitPatient(domicilaryPatient);
patientConsultationPage.clickEditConsultationButton();
patientConsultationPage.selectPatientSuggestion("Domiciliary Care");
cy.submitButton("Update Consultation");
cy.clickSubmitButton("Update Consultation");
cy.verifyNotification("Consultation updated successfully");
cy.closeNotification();
patientLogupdate.clickLogupdate();
Expand All @@ -336,7 +336,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.typeTemperature(patientTemperature);
patientLogupdate.typeRespiratory(patientRespiratory);
cy.get("#consciousness_level-option-RESPONDS_TO_PAIN").click();
cy.submitButton("Save");
cy.clickSubmitButton("Save");
cy.verifyNotification("Brief Update created successfully");
cy.closeNotification();
cy.verifyContentPresence("#consultation-buttons", ["9"]);
Expand All @@ -346,7 +346,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.typeSystolic(patientSystolic);
patientLogupdate.typeDiastolic(patientDiastolic);
patientLogupdate.typePulse(patientPulse);
cy.submitButton("Save");
cy.clickSubmitButton("Save");
cy.verifyNotification("Brief Update created successfully");
cy.closeNotification();
cy.verifyContentPresence("#consultation-buttons", ["-"]);
Expand Down
Loading

0 comments on commit b17eb22

Please sign in to comment.