-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7679 from coronasafe/patient-consultation-discharge
New Cypress Test | Patient Discharge | Patient Consultation Module
- Loading branch information
Showing
7 changed files
with
174 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress"; | ||
import LoginPage from "../../pageobject/Login/LoginPage"; | ||
import { PatientPage } from "../../pageobject/Patient/PatientCreation"; | ||
import PatientDischarge from "../../pageobject/Patient/PatientDischarge"; | ||
import PatientPrescription from "../../pageobject/Patient/PatientPrescription"; | ||
|
||
describe("Patient Discharge based on multiple reason", () => { | ||
const loginPage = new LoginPage(); | ||
const patientPage = new PatientPage(); | ||
const patientDischarge = new PatientDischarge(); | ||
const patientPrescription = new PatientPrescription(); | ||
const patientDischargeReason1 = "Recovered"; | ||
const patientDischargeReason2 = "Referred"; | ||
const patientDischargeReason3 = "Expired"; | ||
const patientDischargeReason4 = "LAMA"; | ||
const patientDischargeAdvice = "Discharge Advice"; | ||
const patientMedicine = "ZOLE"; | ||
const referringFacility = "Dummy Shifting Center, Ernakulam"; | ||
const referringFreetextFacility = "Aster Mims"; | ||
const patientDeathCause = "Cause Of Death"; | ||
const doctorName = "Custom Doctor"; | ||
|
||
before(() => { | ||
loginPage.loginAsDisctrictAdmin(); | ||
cy.saveLocalStorage(); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.restoreLocalStorage(); | ||
cy.clearLocalStorage(/filters--.+/); | ||
cy.awaitUrl("/patients"); | ||
}); | ||
|
||
it("Discharge a LAMA patient in the consultation", () => { | ||
patientPage.visitPatient("Dummy Patient 12"); | ||
patientDischarge.clickDischarge(); | ||
patientDischarge.selectDischargeReason(patientDischargeReason4); | ||
cy.submitButton("Confirm Discharge"); | ||
cy.verifyNotification("Patient Discharged Successfully"); | ||
cy.closeNotification(); | ||
// Verify the consultation dashboard reflection | ||
cy.verifyContentPresence("#consultation-buttons", ["LAMA"]); | ||
// verify the discharge information card | ||
cy.verifyContentPresence("#discharge-information", [ | ||
patientDischargeReason4, | ||
]); | ||
}); | ||
|
||
it("Discharge a expired patient in the consultation", () => { | ||
patientPage.visitPatient("Dummy Patient 13"); | ||
patientDischarge.clickDischarge(); | ||
patientDischarge.selectDischargeReason(patientDischargeReason3); | ||
patientDischarge.typeDischargeNote(patientDeathCause); | ||
patientDischarge.typeDoctorName(doctorName); | ||
cy.submitButton("Confirm Discharge"); | ||
cy.verifyNotification("Patient Discharged Successfully"); | ||
cy.closeNotification(); | ||
// Verify the consultation dashboard reflection | ||
cy.verifyContentPresence("#consultation-buttons", ["EXPIRED"]); | ||
// verify the discharge information card | ||
cy.verifyContentPresence("#discharge-information", [ | ||
patientDischargeReason3, | ||
patientDeathCause, | ||
doctorName, | ||
]); | ||
}); | ||
|
||
it("Discharge patient with referred reason to a facility", () => { | ||
patientPage.visitPatient("Dummy Patient 16"); | ||
patientDischarge.clickDischarge(); | ||
patientDischarge.selectDischargeReason(patientDischargeReason2); | ||
patientDischarge.typeDischargeNote(patientDischargeAdvice); | ||
// select a registrated facility from dropdown and clear | ||
patientDischarge.typeReferringFacility(referringFacility); | ||
patientDischarge.clickClearButton(); | ||
// select a non-registered facility and perform the discharge | ||
patientDischarge.typeReferringFacility(referringFreetextFacility); | ||
cy.wait(2000); | ||
cy.submitButton("Confirm Discharge"); | ||
cy.wait(2000); | ||
cy.verifyNotification("Patient Discharged Successfully"); | ||
cy.closeNotification(); | ||
// Verify the consultation dashboard reflection | ||
cy.verifyContentPresence("#consultation-buttons", ["Referred"]); | ||
// Verify the dashboard and discharge information | ||
cy.verifyContentPresence("#discharge-information", [ | ||
patientDischargeReason2, | ||
patientDischargeAdvice, | ||
referringFreetextFacility, | ||
]); | ||
}); | ||
|
||
it("Discharge a recovered patient with all relevant fields", () => { | ||
patientPage.visitPatient("Dummy Patient 15"); | ||
patientDischarge.clickDischarge(); | ||
patientDischarge.selectDischargeReason(patientDischargeReason1); | ||
patientDischarge.typeDischargeNote(patientDischargeAdvice); | ||
// Prescribe a medicine for the patient | ||
patientPrescription.clickAddPrescription(); | ||
patientPrescription.interceptMedibase(); | ||
patientPrescription.selectMedicinebox(); | ||
patientPrescription.selectMedicine(patientMedicine); | ||
patientPrescription.enterDosage("4"); | ||
patientPrescription.selectDosageFrequency("Twice daily"); | ||
cy.submitButton("Submit"); | ||
cy.verifyNotification("Medicine prescribed"); | ||
cy.wait(2000); | ||
cy.closeNotification(); | ||
// submit the discharge pop-up | ||
cy.submitButton("Confirm Discharge"); | ||
cy.wait(2000); | ||
cy.verifyNotification("Patient Discharged Successfully"); | ||
cy.closeNotification(); | ||
// Verify the consultation dashboard reflection | ||
cy.verifyContentPresence("#consultation-buttons", ["Recovered"]); | ||
// Verify the dashboard and discharge information | ||
cy.verifyContentPresence("#discharge-information", [ | ||
patientDischargeReason1, | ||
patientDischargeAdvice, | ||
patientMedicine, | ||
]); | ||
}); | ||
|
||
afterEach(() => { | ||
cy.saveLocalStorage(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
class PatientDischarge { | ||
clickDischarge() { | ||
cy.get("#show-more").scrollIntoView(); | ||
cy.verifyAndClickElement("#show-more", "Manage Patient"); | ||
cy.verifyAndClickElement("#show-more", "Discharge from CARE"); | ||
} | ||
|
||
selectDischargeReason(reason: string) { | ||
cy.clickAndSelectOption("#discharge_reason", reason); | ||
} | ||
|
||
typeDischargeNote(note: string) { | ||
cy.get("#discharge_notes").type(note); | ||
} | ||
|
||
typeReferringFacility(facility: string) { | ||
cy.searchAndSelectOption("#facility-referredto", facility); | ||
} | ||
|
||
clickClearButton() { | ||
cy.get("#clear-button").click(); | ||
} | ||
|
||
typeDoctorName(doctorName: string) { | ||
cy.get("#death_confirmed_by").type(doctorName); | ||
} | ||
} | ||
|
||
export default PatientDischarge; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters