Skip to content

Commit

Permalink
Merge branch 'develop' into fix#6771
Browse files Browse the repository at this point in the history
  • Loading branch information
thedevildude authored Feb 6, 2024
2 parents fb9ba13 + 4a79ff2 commit ac487c5
Show file tree
Hide file tree
Showing 30 changed files with 833 additions and 376 deletions.
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress";
import LoginPage from "../../pageobject/Login/LoginPage";
import { PatientPage } from "../../pageobject/Patient/PatientCreation";
import { UpdatePatientPage } from "../../pageobject/Patient/PatientUpdate";
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import { PatientConsultationPage } from "../../pageobject/Patient/PatientConsultation";
import {
emergency_phone_number,
phone_number,
} from "../../pageobject/constants";
const yearOfBirth = "2001";

const calculateAge = () => {
const currentYear = new Date().getFullYear();
return currentYear - parseInt(yearOfBirth);
};
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import PatientMedicalHistory from "../../pageobject/Patient/PatientMedicalHistory";

describe("Patient Creation with consultation", () => {
const patientConsultationPage = new PatientConsultationPage();
const loginPage = new LoginPage();
const patientPage = new PatientPage();
const updatePatientPage = new UpdatePatientPage();
const patientConsultationPage = new PatientConsultationPage();
const facilityPage = new FacilityPage();
const patientMedicalHistory = new PatientMedicalHistory();
const patientDateOfBirth = "01012001";
const patientOneName = "Patient With Consultation";
const patientOneGender = "Male";
const patientOneAddress = "Test Patient Address";
const patientOnePincode = "682001";
const patientOneState = "Kerala";
const patientOneDistrict = "Ernakulam";
const patientOneLocalbody = "Aluva";
const patientOneWard = "4";
const patientOneBloodGroup = "O+";

before(() => {
loginPage.loginAsDisctrictAdmin();
Expand All @@ -33,89 +37,25 @@ describe("Patient Creation with consultation", () => {
cy.awaitUrl("/patients");
});

it("Create a new patient with no consultation", () => {
it("Create a patient with consultation", () => {
patientPage.createPatient();
patientPage.selectFacility("dummy facility 40");
patientPage.selectFacility("Dummy Facility 40");
patientPage.patientformvisibility();
patientPage.enterPatientDetails(
phone_number,
emergency_phone_number,
"Test E2E User",
"Male",
"Test Patient Address",
"682001",
"O+",
"01012001"
);
facilityPage.selectStateOnPincode("Kerala");
facilityPage.selectDistrictOnPincode("Ernakulam");
facilityPage.selectLocalBody("Aluva");
facilityPage.selectWard("4");
patientPage.typePatientPhoneNumber(phone_number);
patientPage.typePatientEmergencyNumber(emergency_phone_number);
patientPage.typePatientDateOfBirth(patientDateOfBirth);
patientPage.typePatientName(patientOneName);
patientPage.selectPatientGender(patientOneGender);
patientPage.typePatientAddress(patientOneAddress);
facilityPage.fillPincode(patientOnePincode);
facilityPage.selectStateOnPincode(patientOneState);
facilityPage.selectDistrictOnPincode(patientOneDistrict);
facilityPage.selectLocalBody(patientOneLocalbody);
facilityPage.selectWard(patientOneWard);
patientMedicalHistory.clickNoneMedicialHistory();
patientPage.selectPatientBloodGroup(patientOneBloodGroup);
patientPage.clickCreatePatient();

patientPage.verifyPatientIsCreated();
patientPage.saveCreatedPatientUrl();
});

it("Patient Detail verification post registration", () => {
patientPage.interceptFacilities();
patientPage.visitCreatedPatient();
patientPage.verifyStatusCode();
const age = calculateAge();
patientPage.verifyPatientDetails(
age,
"Test E2E User",
phone_number,
emergency_phone_number,
yearOfBirth,
"O+"
);
});

it("Edit the patient details", () => {
patientPage.interceptFacilities();
patientPage.visitUpdatePatientUrl();
patientPage.verifyStatusCode();
patientPage.patientformvisibility();
updatePatientPage.enterPatientDetails(
"Test E2E User Edited",
"O+",
phone_number,
emergency_phone_number,
"Test Patient Address Edited",
"Severe Cough",
"Paracetamol",
"Dust",
["2 months ago", "1 month ago"],
"SUB123",
"P123",
"GICOFINDIA",
"GICOFINDIA"
);
updatePatientPage.clickUpdatePatient();

updatePatientPage.verifyPatientUpdated();
updatePatientPage.saveUpdatedPatientUrl();
});

it("Patient Detail verification post edit", () => {
patientPage.interceptFacilities();
updatePatientPage.visitUpdatedPatient();
patientPage.verifyStatusCode();

updatePatientPage.verifyPatientDetails(
"Test E2E User Edited",
phone_number,
"Severe Cough",
"Paracetamol",
"Dust"
);
});

it("Create a New consultation to existing patient", () => {
patientPage.interceptFacilities();
updatePatientPage.visitConsultationPage();
patientPage.verifyStatusCode();
patientConsultationPage.fillIllnessHistory("history");
patientConsultationPage.selectConsultationStatus(
"Outpatient/Emergency Room"
Expand All @@ -142,11 +82,13 @@ describe("Patient Creation with consultation", () => {
patientConsultationPage.enterDosage("3");
patientConsultationPage.selectDosageFrequency("Twice daily");
patientConsultationPage.submitPrescriptionAndReturn();
patientConsultationPage.verifyConsultationPatientName(patientOneName);
});

it("Edit created consultation to existing patient", () => {
updatePatientPage.visitUpdatedPatient();
patientConsultationPage.visitEditConsultationPage();
// temporary fixing, whole file will be refactored soon
cy.get("[data-cy='patient']").first().click();
patientConsultationPage.clickEditConsultationButton();
patientConsultationPage.fillIllnessHistory("editted");
patientConsultationPage.updateSymptoms("FEVER");
patientConsultationPage.setSymptomsDate("01082023");
Expand Down
Loading

0 comments on commit ac487c5

Please sign in to comment.