Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into fix-ohcnetwork#7333
Browse files Browse the repository at this point in the history
  • Loading branch information
UdaySagar-Git committed Mar 26, 2024
2 parents cbe26c2 + a27fe83 commit d467c35
Show file tree
Hide file tree
Showing 135 changed files with 1,262 additions and 560 deletions.
1 change: 0 additions & 1 deletion cypress/e2e/patient_spec/patient_consultation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,6 @@ describe("Patient Consultation in multiple combination", () => {
it("Edit created consultation to existing patient", () => {
patientPage.visitPatient("Dummy Patient 13");
patientConsultationPage.clickEditConsultationButton();
cy.wait(5000);
patientConsultationPage.typePatientIllnessHistory("editted");
patientConsultationPage.selectPatientDiagnosis(
diagnosis5,
Expand Down
156 changes: 156 additions & 0 deletions cypress/e2e/patient_spec/patient_logupdate.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
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 PatientLogupdate from "../../pageobject/Patient/PatientLogupdate";

describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
const loginPage = new LoginPage();
const patientConsultationPage = new PatientConsultationPage();
const patientPage = new PatientPage();
const patientLogupdate = new PatientLogupdate();
const domicilaryPatient = "Dummy Patient 11";
const patientCategory = "Abnormal";
const additionalSymptoms = "ASYMPTOMATIC";
const physicalExamination = "physical examination details";
const otherExamination = "Other";
const patientSystolic = "119";
const patientDiastolic = "150";
const patientModifiedSystolic = "120";
const patientModifiedDiastolic = "145";
const patientPulse = "152";
const patientTemperature = "96.6";
const patientRespiratory = "140";
const patientSpo2 = "15";
const patientRhythmType = "Regular";
const patientRhythm = "Normal Rhythm";

before(() => {
loginPage.loginAsDisctrictAdmin();
cy.saveLocalStorage();
});

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/patients");
});

it("Create a new log teleicu update for a domicilary care patient and verify the copy previous value function", () => {
patientPage.visitPatient("Dummy Patient 11");
patientConsultationPage.clickEditConsultationButton();
patientConsultationPage.selectPatientSuggestion("Domiciliary Care");
cy.submitButton("Update Consultation");
cy.verifyNotification("Consultation updated successfully");
patientLogupdate.clickLogupdate();
patientLogupdate.typePhysicalExamination(physicalExamination);
patientLogupdate.typeOtherDetails(otherExamination);
patientLogupdate.typeAdditionalSymptoms(additionalSymptoms);
patientLogupdate.selectPatientCategory(patientCategory);
patientLogupdate.typeSystolic(patientSystolic);
patientLogupdate.typeDiastolic(patientDiastolic);
patientLogupdate.typePulse(patientPulse);
patientLogupdate.typeTemperature(patientTemperature);
patientLogupdate.typeRespiratory(patientRespiratory);
patientLogupdate.typeSpo2(patientSpo2);
patientLogupdate.selectRhythm(patientRhythmType);
patientLogupdate.typeRhythm(patientRhythm);
cy.get("#consciousness_level-2").click();
cy.submitButton("Save");
cy.verifyNotification("Consultation Updates details created successfully");
// verify the copied previous value
cy.closeNotification();
patientLogupdate.clickLogupdate();
patientLogupdate.clickCopyPreviousValue();
patientLogupdate.selectPatientCategory(patientCategory);
cy.submitButton("Save");
cy.closeNotification();
cy.verifyContentPresence("#physical_examination_info", [
physicalExamination,
]);
cy.verifyContentPresence("#rhythm_detail", [patientRhythm]);
cy.submitButton("Continue");
cy.verifyNotification("Consultation Updates details updated successfully");
});

it("Create a new log normal update for a domicilary care patient and edit it", () => {
patientPage.visitPatient(domicilaryPatient);
patientConsultationPage.clickEditConsultationButton();
patientConsultationPage.selectPatientSuggestion("Domiciliary Care");
cy.submitButton("Update Consultation");
cy.verifyNotification("Consultation updated successfully");
patientLogupdate.clickLogupdate();
patientLogupdate.typePhysicalExamination(physicalExamination);
patientLogupdate.typeOtherDetails(otherExamination);
patientLogupdate.typeAdditionalSymptoms(additionalSymptoms);
patientLogupdate.selectPatientCategory(patientCategory);
patientLogupdate.typeSystolic(patientSystolic);
patientLogupdate.typeDiastolic(patientDiastolic);
patientLogupdate.typePulse(patientPulse);
patientLogupdate.typeTemperature(patientTemperature);
patientLogupdate.typeRespiratory(patientRespiratory);
patientLogupdate.typeSpo2(patientSpo2);
patientLogupdate.selectRhythm(patientRhythmType);
patientLogupdate.typeRhythm(patientRhythm);
cy.get("#consciousness_level-2").click();
cy.submitButton("Save");
cy.verifyNotification("Consultation Updates details created successfully");
// edit the card and verify the data.
patientLogupdate.clickLogupdateCard("#dailyround-entry", patientCategory);
cy.verifyContentPresence("#consultation-preview", [
patientCategory,
patientDiastolic,
patientSystolic,
physicalExamination,
otherExamination,
patientPulse,
patientTemperature,
patientRespiratory,
patientSpo2,
patientRhythm,
]);
patientLogupdate.clickUpdateDetail();
patientLogupdate.clickClearButtonInElement("#systolic");
patientLogupdate.typeSystolic(patientModifiedSystolic);
patientLogupdate.clickClearButtonInElement("#diastolic");
patientLogupdate.typeDiastolic(patientModifiedDiastolic);
cy.submitButton("Continue");
cy.verifyNotification("Consultation Updates details updated successfully");
patientLogupdate.clickLogupdateCard("#dailyround-entry", patientCategory);
cy.verifyContentPresence("#consultation-preview", [
patientModifiedDiastolic,
patientModifiedSystolic,
]);
});

it("Create a new log normal update for a admission patient and verify its reflection in cards", () => {
patientPage.visitPatient("Dummy Patient 13");
patientLogupdate.clickLogupdate();
cy.verifyNotification("Please assign a bed to the patient");
patientLogupdate.selectBed("Dummy Bed 6");
cy.closeNotification();
patientLogupdate.clickLogupdate();
patientLogupdate.typePhysicalExamination(physicalExamination);
patientLogupdate.typeOtherDetails(otherExamination);
patientLogupdate.typeAdditionalSymptoms(additionalSymptoms);
patientLogupdate.selectPatientCategory(patientCategory);
patientLogupdate.typeSystolic(patientSystolic);
patientLogupdate.typeDiastolic(patientDiastolic);
patientLogupdate.typePulse(patientPulse);
patientLogupdate.typeTemperature(patientTemperature);
patientLogupdate.typeRespiratory(patientRespiratory);
patientLogupdate.typeSpo2(patientSpo2);
patientLogupdate.selectRhythm(patientRhythmType);
patientLogupdate.typeRhythm(patientRhythm);
cy.get("#consciousness_level-2").click();
cy.submitButton("Save");
cy.verifyNotification("Consultation Updates details created successfully");
// Verify the card content
cy.get("#basic-information").scrollIntoView();
cy.verifyContentPresence("#basic-information", [additionalSymptoms]);
});

afterEach(() => {
cy.saveLocalStorage();
});
});
8 changes: 6 additions & 2 deletions cypress/e2e/patient_spec/patient_registration.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ describe("Patient Creation with consultation", () => {
const patientTransferFacility = "Dummy Shifting Center";
const patientTransferName = "Dummy Patient 10";
const patientExternalName = "Patient 20";
const patientOccupation = "Student";

before(() => {
loginPage.loginAsDisctrictAdmin();
Expand Down Expand Up @@ -88,6 +89,7 @@ describe("Patient Creation with consultation", () => {
facilityPage.selectDistrictOnPincode(patientOneDistrict);
facilityPage.selectLocalBody(patientOneLocalbody);
facilityPage.selectWard(patientOneWard);
patientPage.selectPatientOccupation(patientOccupation);
// Patient Medical History
patientMedicalHistory.typePatientPresentHealth(patientOnePresentHealth);
patientMedicalHistory.typePatientOngoingMedication(
Expand Down Expand Up @@ -115,7 +117,8 @@ describe("Patient Creation with consultation", () => {
phone_number,
emergency_phone_number,
yearOfBirth,
patientOneBloodGroup
patientOneBloodGroup,
patientOccupation
);
patientMedicalHistory.verifyPatientMedicalDetails(
patientOnePresentHealth,
Expand Down Expand Up @@ -202,7 +205,8 @@ describe("Patient Creation with consultation", () => {
phone_number,
emergency_phone_number,
yearOfBirth,
patientOneUpdatedBloodGroup
patientOneUpdatedBloodGroup,
patientOccupation
);
// Verify No medical history
patientMedicalHistory.verifyNoSymptosPresent("Diabetes");
Expand Down
1 change: 1 addition & 0 deletions cypress/pageobject/Patient/PatientConsultation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export class PatientConsultationPage {
"#consultation-buttons",
"Edit Consultation Details"
);
cy.wait(3000);
}

visitShiftRequestPage() {
Expand Down
29 changes: 11 additions & 18 deletions cypress/pageobject/Patient/PatientCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,8 @@ export class PatientPage {
}

selectFacility(facilityName: string) {
cy.get("input[name='facilities']")
.type(facilityName)
.then(() => {
cy.get("[role='option']").contains(facilityName).click();
});
cy.get("button").should("contain", "Select");
cy.get("button").get("#submit").click();
cy.searchAndSelectOption("input[name='facilities']", facilityName);
cy.submitButton("Select");
}

interceptCreatePatientAPI() {
Expand Down Expand Up @@ -85,19 +80,15 @@ export class PatientPage {
}

selectPatientGender(gender: string) {
cy.get("[data-testid=Gender] button")
.click()
.then(() => {
cy.get("[role='option']").contains(gender).click();
});
cy.clickAndSelectOption("[data-testid=Gender] button", gender);
}

selectPatientBloodGroup(bloodgroup: string) {
cy.get("#blood_group")
.click()
.then(() => {
cy.get("[role='option']").contains(bloodgroup).click();
});
cy.clickAndSelectOption("#blood_group", bloodgroup);
}

selectPatientOccupation(occupation: string) {
cy.clickAndSelectOption("#occupation", occupation);
}

clickCreatePatient() {
Expand Down Expand Up @@ -146,7 +137,8 @@ export class PatientPage {
phoneNumber,
emergencyPhoneNumber,
yearOfBirth,
bloodGroup
bloodGroup,
occupation
) {
cy.url().should("include", "/facility/");
cy.get("[data-testid=patient-dashboard]").then(($dashboard) => {
Expand All @@ -157,6 +149,7 @@ export class PatientPage {
expect($dashboard).to.contain(emergencyPhoneNumber);
expect($dashboard).to.contain(yearOfBirth);
expect($dashboard).to.contain(bloodGroup);
expect($dashboard).to.contain(occupation);
});
}

Expand Down
88 changes: 88 additions & 0 deletions cypress/pageobject/Patient/PatientLogupdate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
class PatientLogupdate {
clickLogupdate() {
cy.get("#log-update").scrollIntoView();
cy.verifyAndClickElement("#log-update", "Log Update");
cy.wait(2000);
}

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

selectPatientCategory(category: string) {
cy.clickAndSelectOption("#patient_category", category);
}

typePhysicalExamination(examination: string) {
cy.get("#physical_examination_info").click().type(examination);
cy.get("#physical_examination_info").should("contain", examination);
}

typeOtherDetails(details: string) {
cy.get("#other_details").click().type(details);
}

typeAdditionalSymptoms(symptoms: string) {
cy.clickAndSelectOption("#additional_symptoms", symptoms);
}

typeSystolic(systolic: string) {
cy.searchAndSelectOption("#systolic", systolic);
}

typeDiastolic(diastolic: string) {
cy.searchAndSelectOption("#diastolic", diastolic);
}

typePulse(pulse: string) {
cy.searchAndSelectOption("#pulse", pulse);
}

typeTemperature(temperature: string) {
cy.searchAndSelectOption("#temperature", temperature);
}

typeRespiratory(respiratory: string) {
cy.searchAndSelectOption("#resp", respiratory);
}

typeSpo2(spo: string) {
cy.searchAndSelectOption("#ventilator_spo2", spo);
}

selectRhythm(rhythm: string) {
cy.clickAndSelectOption("#rhythm", rhythm);
}

typeRhythm(rhythm: string) {
cy.get("#rhythm_detail").click().type(rhythm);
}

clickLogupdateCard(element, patientCategory) {
cy.get(element).scrollIntoView();
cy.verifyContentPresence(element, [patientCategory]);
cy.get(element).first().contains("View Details").click();
cy.wait(3000);
}

clickUpdateDetail() {
cy.verifyAndClickElement("#consultation-preview", "Update Details");
cy.wait(3000);
}

clickClearButtonInElement(elementId) {
cy.get(elementId).find("#clear-button").click();
}

clickVitals() {
cy.get("#consultation_tab_nav").scrollIntoView();
cy.verifyAndClickElement("#consultation_tab_nav", "Vitals");
}

clickCopyPreviousValue() {
cy.get("#clone_last").click();
}
}
export default PatientLogupdate;
8 changes: 8 additions & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,11 @@ Cypress.Commands.add("closeNotification", () => {
cy.wrap($div).click();
});
});

Cypress.Commands.add("verifyContentPresence", (selector, texts) => {
cy.get(selector).then(($el) => {
texts.forEach((text) => {
cy.wrap($el).should("contain", text);
});
});
});
4 changes: 4 additions & 0 deletions cypress/support/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ declare global {
): Chainable<Element>;
preventPrint(): Chainable<Window>;
closeNotification(): Chainable<Element>;
verifyContentPresence(
selector: string,
texts: string[]
): Chainable<Element>;
}
}
}
Loading

0 comments on commit d467c35

Please sign in to comment.