Skip to content

Commit

Permalink
Merge branch 'coronasafe:develop' into Fix-ohcnetwork#6944
Browse files Browse the repository at this point in the history
  • Loading branch information
AshrafMd-1 authored Jul 5, 2024
2 parents b9261c3 + 2b9cb55 commit 5d07d63
Show file tree
Hide file tree
Showing 32 changed files with 626 additions and 517 deletions.
12 changes: 6 additions & 6 deletions cypress/e2e/patient_spec/patient_logupdate.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.typeRhythm(patientRhythm);
cy.get("#consciousness_level-2").click();
cy.submitButton("Save");
cy.verifyNotification("Tele-medicine log update created successfully");
cy.verifyNotification("Telemedicine log created successfully");
});

it("Create a new log normal update for a domicilary care patient and edit it", () => {
Expand All @@ -84,7 +84,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.typeRhythm(patientRhythm);
cy.get("#consciousness_level-2").click();
cy.submitButton("Save");
cy.verifyNotification("Normal log update created successfully");
cy.verifyNotification("Brief Update log created successfully");
cy.closeNotification();
// edit the card and verify the data.
cy.contains("Daily Rounds").click();
Expand All @@ -107,7 +107,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.clickClearButtonInElement("#diastolic");
patientLogupdate.typeDiastolic(patientModifiedDiastolic);
cy.submitButton("Continue");
cy.verifyNotification("Normal log update details updated successfully");
cy.verifyNotification("Brief Update log updated successfully");
cy.contains("Daily Rounds").click();
patientLogupdate.clickLogupdateCard("#dailyround-entry", patientCategory);
cy.verifyContentPresence("#consultation-preview", [
Expand Down Expand Up @@ -140,7 +140,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
cy.get("#consciousness_level-2").click();
cy.submitButton("Save");
cy.wait(2000);
cy.verifyNotification("Normal log update created successfully");
cy.verifyNotification("Brief Update log created successfully");
// Verify the card content
cy.get("#basic-information").scrollIntoView();
cy.verifyContentPresence("#encounter-symptoms", [additionalSymptoms]);
Expand All @@ -163,7 +163,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.typeRespiratory(patientRespiratory);
cy.get("#consciousness_level-2").click();
cy.submitButton("Save");
cy.verifyNotification("Normal log update created successfully");
cy.verifyNotification("Brief Update log created successfully");
cy.closeNotification();
cy.verifyContentPresence("#consultation-buttons", ["9"]);
// Verify the Incomplete data will give blank info
Expand All @@ -173,7 +173,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.typeDiastolic(patientDiastolic);
patientLogupdate.typePulse(patientPulse);
cy.submitButton("Save");
cy.verifyNotification("Normal log update created successfully");
cy.verifyNotification("Brief Update log created successfully");
cy.closeNotification();
cy.verifyContentPresence("#consultation-buttons", ["-"]);
});
Expand Down
86 changes: 80 additions & 6 deletions cypress/e2e/patient_spec/patient_prescription.cy.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress";
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();
const medicineName = "DOLO";
const medicineNameOne = "DOLO";
const medicineNameTwo = "FDEP PLUS";
const medicineBaseDosage = "4";
const medicineTargetDosage = "9";
const medicineFrequency = "Twice daily";
const medicineAdministerNote = "Medicine Administration Note";
const medicineIndicator = "Test Indicator";

describe("Patient Medicine Administration", () => {
before(() => {
Expand All @@ -23,14 +26,85 @@ describe("Patient Medicine Administration", () => {
cy.awaitUrl("/patients");
});

it("Add a new medicine | Verify the Edit and Discontinue Medicine workflow |", () => {
patientPage.visitPatient("Dummy Patient 9");
patientPrescription.visitMedicineTab();
patientPrescription.visitEditPrescription();
// Add a normal Medicine to the patient
patientPrescription.clickAddPrescription();
patientPrescription.interceptMedibase();
patientPrescription.selectMedicinebox();
patientPrescription.selectMedicine(medicineNameOne);
patientPrescription.enterDosage(medicineBaseDosage);
patientPrescription.selectDosageFrequency(medicineFrequency);
cy.submitButton("Submit");
cy.verifyNotification("Medicine prescribed");
cy.closeNotification();
// Edit the existing medicine & Verify they are properly moved to discontinue position
patientPrescription.clickReturnToDashboard();
patientPrescription.visitMedicineTab();
cy.verifyAndClickElement("#0", medicineNameOne);
cy.verifyContentPresence("#submit", ["Discontinue"]); // To verify the pop-up is open
cy.submitButton("Edit");
patientPrescription.enterDosage(medicineTargetDosage);
cy.submitButton("Submit");
cy.verifyNotification("Prescription edited successfully");
cy.closeNotification();
// Discontinue a medicine & Verify the notification
cy.verifyAndClickElement("#0", medicineNameOne);
cy.submitButton("Discontinue");
patientPrescription.enterDiscontinueReason("Medicine is been discontinued");
cy.submitButton("Discontinue");
cy.verifyNotification("Prescription discontinued");
cy.closeNotification();
// verify the discontinue medicine view
cy.verifyContentPresence("#discontinued-medicine", [
"discontinued prescription(s)",
]);
});

it("Add a PRN Prescription medicine | Group Administrate it |", () => {
patientPage.visitPatient("Dummy Patient 6");
patientPrescription.visitMedicineTab();
patientPrescription.visitEditPrescription();
// Add First Medicine
patientPrescription.clickAddPrnPrescriptionButton();
patientPrescription.interceptMedibase();
patientPrescription.selectMedicinebox();
patientPrescription.selectMedicine(medicineNameOne);
patientPrescription.enterDosage(medicineBaseDosage);
patientPrescription.enterIndicator(medicineIndicator);
cy.submitButton("Submit");
cy.verifyNotification("Medicine prescribed");
cy.closeNotification();
// Add Second Medicine
patientPrescription.clickAddPrnPrescriptionButton();
patientPrescription.interceptMedibase();
patientPrescription.selectMedicinebox();
patientPrescription.selectMedicine(medicineNameTwo);
patientPrescription.enterDosage(medicineBaseDosage);
patientPrescription.enterIndicator(medicineIndicator);
cy.submitButton("Submit");
cy.verifyNotification("Medicine prescribed");
cy.closeNotification();
patientPrescription.clickReturnToDashboard();
// Group Administer the PRN Medicine
patientPrescription.visitMedicineTab();
patientPrescription.clickAdministerBulkMedicine();
patientPrescription.clickAllVisibleAdministration();
patientPrescription.clickAdministerSelectedMedicine();
cy.verifyNotification("Medicine(s) administered");
cy.closeNotification();
});

it("Add a new titrated medicine for a patient | Individual Administeration |", () => {
patientPage.visitPatient("Dummy Patient 5");
patientPrescription.visitMedicineTab();
patientPrescription.visitEditPrescription();
patientPrescription.clickAddPrescription();
patientPrescription.interceptMedibase();
patientPrescription.selectMedicinebox();
patientPrescription.selectMedicine(medicineName);
patientPrescription.selectMedicine(medicineNameOne);
patientPrescription.clickTitratedDosage();
patientPrescription.enterDosage(medicineBaseDosage);
patientPrescription.enterTargetDosage(medicineTargetDosage);
Expand All @@ -47,14 +121,14 @@ describe("Patient Medicine Administration", () => {
cy.closeNotification();
// Verify the Reflection on the Medicine
cy.verifyContentPresence("#medicine-preview", [
medicineName,
medicineNameOne,
medicineBaseDosage,
medicineTargetDosage,
]);
patientPrescription.clickReturnToDashboard();
// Go to medicine tab and administer it again
patientPrescription.visitMedicineTab();
cy.verifyAndClickElement("#0", medicineName);
cy.verifyAndClickElement("#0", medicineNameOne);
cy.submitButton("Administer");
patientPrescription.enterAdministerDosage(medicineBaseDosage);
cy.submitButton("Administer Medicine");
Expand All @@ -68,7 +142,7 @@ describe("Patient Medicine Administration", () => {
patientPrescription.clickAddPrescription();
patientPrescription.interceptMedibase();
patientPrescription.selectMedicinebox();
patientPrescription.selectMedicine(medicineName);
patientPrescription.selectMedicine(medicineNameOne);
patientPrescription.enterDosage(medicineBaseDosage);
patientPrescription.selectDosageFrequency(medicineFrequency);
cy.submitButton("Submit");
Expand All @@ -78,7 +152,7 @@ describe("Patient Medicine Administration", () => {
patientPrescription.clickAddPrescription();
patientPrescription.interceptMedibase();
patientPrescription.selectMedicinebox();
patientPrescription.selectMedicine(medicineName);
patientPrescription.selectMedicine(medicineNameOne);
patientPrescription.enterDosage(medicineBaseDosage);
patientPrescription.selectDosageFrequency(medicineFrequency);
cy.submitButton("Submit");
Expand Down
2 changes: 1 addition & 1 deletion cypress/pageobject/Patient/PatientLogupdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class PatientLogupdate {

selectBed(bed: string) {
cy.searchAndSelectOption("input[name='bed']", bed);
cy.submitButton("Move to bed");
cy.submitButton("Update");
cy.wait(2000);
}

Expand Down
36 changes: 28 additions & 8 deletions cypress/pageobject/Patient/PatientPrescription.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { cy } from "local-cypress";
export class PatientPrescription {
clickAddPrescription() {
cy.get("#add-prescription").scrollIntoView();
Expand All @@ -7,6 +8,10 @@ export class PatientPrescription {
);
}

clickAddPrnPrescriptionButton() {
cy.contains("button", "Add PRN Prescription").click();
}

interceptMedibase() {
cy.intercept("GET", "**/api/v1/medibase/**").as("getMedibase");
}
Expand All @@ -27,6 +32,15 @@ export class PatientPrescription {
cy.verifyAndClickElement("#administer-medicine", "Administer");
}

clickAdministerBulkMedicine() {
cy.get("#bulk-administer").should("be.visible");
cy.get("#bulk-administer").click();
}

clickAllVisibleAdministration() {
cy.get("#should_administer").should("be.visible").click();
}

selectMedicinebox() {
cy.get(
"div#medicine_object input[placeholder='Select'][role='combobox']",
Expand All @@ -38,9 +52,20 @@ export class PatientPrescription {
}

enterDosage(doseAmount: string) {
cy.get("#base_dosage").clear({ force: true });
cy.get("#base_dosage").click({ force: true });
cy.get("#base_dosage").type(doseAmount, { force: true });
}

enterIndicator(indicator: string) {
cy.get("#indicator").type(indicator);
}

enterDiscontinueReason(reason: string) {
cy.wait(2000);
cy.get("#discontinuedReason").type(reason);
}

enterAdministerDosage(dosage: string) {
cy.get("#dosage").type(dosage);
}
Expand All @@ -64,14 +89,9 @@ export class PatientPrescription {
);
}

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);
clickAdministerSelectedMedicine() {
cy.get("#administer-selected-medicine").should("be.visible");
cy.get("#administer-selected-medicine").click();
}

visitMedicineTab() {
Expand Down
1 change: 1 addition & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ Cypress.Commands.add("clearAllFilters", () => {
});

Cypress.Commands.add("submitButton", (buttonText = "Submit") => {
cy.get("button[type='submit']").contains(buttonText).scrollIntoView();
cy.get("button[type='submit']").contains(buttonText).click();
});

Expand Down
Loading

0 comments on commit 5d07d63

Please sign in to comment.