-
Notifications
You must be signed in to change notification settings - Fork 426
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
54 additions
and
20 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
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,49 @@ | ||
import PatientPrescription from "../../pageobject/Patient/PatientPrescription"; | ||
import LoginPage from "../../pageobject/Login/LoginPage"; | ||
import { PatientPage } from "../../pageobject/Patient/PatientCreation"; | ||
|
||
const patientPrescription = new PatientPrescription(); | ||
const loginPage = new LoginPage(); | ||
const patientPage = new PatientPage(); | ||
|
||
describe("Patient Medicine Administration", () => { | ||
before(() => { | ||
loginPage.loginAsDisctrictAdmin(); | ||
cy.saveLocalStorage(); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.restoreLocalStorage(); | ||
cy.clearLocalStorage(/filters--.+/); | ||
cy.awaitUrl("/patients"); | ||
}); | ||
|
||
it("Add a new medicine for a patient and verify the duplicate medicine validation", () => { | ||
patientPage.visitPatient("Dummy Patient 4"); | ||
patientPrescription.visitMedicineTab(); | ||
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(); | ||
// verify the duplicate medicine error message | ||
patientPrescription.clickAddPrescription(); | ||
patientPrescription.interceptMedibase(); | ||
patientPrescription.selectMedicinebox(); | ||
patientPrescription.selectMedicine("DOLO"); | ||
patientPrescription.enterDosage("4"); | ||
patientPrescription.selectDosageFrequency("Twice daily"); | ||
cy.submitButton("Submit"); | ||
cy.verifyNotification( | ||
"Medicine - This medicine is already prescribed to this patient. Please discontinue the existing prescription to prescribe again.", | ||
); | ||
}); | ||
|
||
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