Skip to content

Commit

Permalink
Merge branch 'develop' into IncreaseAddBtnHeight#7142
Browse files Browse the repository at this point in the history
  • Loading branch information
shyamprakash123 committed Feb 7, 2024
2 parents 30b7390 + 26a74a9 commit c2a5bf5
Show file tree
Hide file tree
Showing 67 changed files with 4,288 additions and 2,880 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 c2a5bf5

Please sign in to comment.