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 authored Feb 4, 2024
2 parents d14d5bf + d259c20 commit 8727a03
Show file tree
Hide file tree
Showing 29 changed files with 2,909 additions and 1,815 deletions.
223 changes: 160 additions & 63 deletions cypress/e2e/patient_spec/patient_crud.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
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 {
Expand All @@ -18,9 +17,34 @@ const calculateAge = () => {
describe("Patient Creation with consultation", () => {
const loginPage = new LoginPage();
const patientPage = new PatientPage();
const updatePatientPage = new UpdatePatientPage();
const patientConsultationPage = new PatientConsultationPage();
const facilityPage = new FacilityPage();
const age = calculateAge();
const patientDateOfBirth = "01012001";
const patientOneName = "Patient With No Consultation";
const patientOneGender = "Male";
const patientOneUpdatedGender = "Female";
const patientOneAddress = "Test Patient Address";
const patientOnePincode = "682001";
const patientOneState = "Kerala";
const patientOneDistrict = "Ernakulam";
const patientOneLocalbody = "Aluva";
const patientOneWard = "4";
const patientOnePresentHealth = "Present Health Condition";
const patientOneOngoingMedication = "Ongoing Medication";
const patientOneAllergies = "Allergies";
const patientOneBloodGroup = "O+";
const patientOneUpdatedBloodGroup = "AB+";
const patientOneFirstInsuranceId = "insurance-details-0";
const patientOneFirstSubscriberId = "member id 01";
const patientOneFirstPolicyId = "policy name 01";
const patientOneFirstInsurerId = "insurer id 01";
const patientOneFirstInsurerName = "insurer name 01";
const patientOneSecondInsuranceId = "insurance-details-1";
const patientOneSecondSubscriberId = "member id 02";
const patientOneSecondPolicyId = "policy name 02";
const patientOneSecondInsurerId = "insurer id 02";
const patientOneSecondInsurerName = "insurer name 02";

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

it("Create a new patient with no consultation", () => {
it("Create a new patient with all field in registration form and no consultation", () => {
// patient details with all the available fields except covid
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");
// Patient Details page
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);
// Patient Medical History
patientPage.typePatientPresentHealth(patientOnePresentHealth);
patientPage.typePatientOngoingMedication(patientOneOngoingMedication);
patientPage.typeMedicalHistory(2, "Diabetes");
patientPage.typeMedicalHistory(3, "Heart Disease");
patientPage.typeMedicalHistory(4, "HyperTension");
patientPage.typeMedicalHistory(5, "Kidney Diseases");
patientPage.typeMedicalHistory(6, "Lung Diseases/Asthma");
patientPage.typeMedicalHistory(7, "Cancer");
patientPage.typeMedicalHistory(8, "Other");
patientPage.typePatientAllergies(patientOneAllergies);
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(
// Verify the patient details
patientPage.clickCancelButton();
cy.wait(3000);
patientPage.savePatientUrl();
patientPage.verifyPatientDashboardDetails(
patientOneGender,
age,
"Test E2E User",
patientOneName,
phone_number,
emergency_phone_number,
yearOfBirth,
"O+"
patientOneBloodGroup
);
patientPage.verifyPatientMedicalDetails(
patientOnePresentHealth,
patientOneOngoingMedication,
patientOneAllergies,
"Diabetes",
"Heart Disease",
"HyperTension",
"Kidney Diseases",
"Lung Diseases/Asthma",
"Cancer",
"Other"
);
// verify its presence in the patient detail page
cy.visit("/patients");
patientPage.typePatientNameList(patientOneName);
patientPage.verifyPatientNameList(patientOneName);
});

it("Edit the patient details", () => {
it("Edit the patient details with no consultation and verify", () => {
patientPage.interceptFacilities();
patientPage.visitUpdatePatientUrl();
patientPage.verifyStatusCode();
patientPage.patientformvisibility();
updatePatientPage.enterPatientDetails(
"Test E2E User Edited",
"O+",
// change the gender to female and input data to related changed field
cy.wait(3000);
patientPage.selectPatientGender(patientOneUpdatedGender);
patientPage.clickPatientAntenatalStatusYes();
patientPage.selectPatientBloodGroup(patientOneUpdatedBloodGroup);
// Edit the patient consultation , select none medical history and multiple health ID
patientPage.clickNoneMedicialHistory();
patientPage.clickAddInsruanceDetails();
patientPage.typeSubscriberId(
patientOneFirstInsuranceId,
patientOneFirstSubscriberId
);
patientPage.typePolicyId(
patientOneFirstInsuranceId,
patientOneFirstPolicyId
);
patientPage.typeInsurerId(
patientOneFirstInsuranceId,
patientOneFirstInsurerId
);
patientPage.typeInsurerName(
patientOneFirstInsuranceId,
patientOneFirstInsurerName
);
patientPage.clickAddInsruanceDetails();
patientPage.typeSubscriberId(
patientOneSecondInsuranceId,
patientOneSecondSubscriberId
);
patientPage.typePolicyId(
patientOneSecondInsuranceId,
patientOneSecondPolicyId
);
patientPage.typeInsurerId(
patientOneSecondInsuranceId,
patientOneSecondInsurerId
);
patientPage.typeInsurerName(
patientOneSecondInsuranceId,
patientOneSecondInsurerName
);
patientPage.clickUpdatePatient();
cy.wait(3000);
patientPage.verifyPatientUpdated();
patientPage.visitPatientUrl();
// Verify Female Gender change reflection, No Medical History and Insurance Details
cy.wait(5000);
patientPage.verifyPatientDashboardDetails(
patientOneUpdatedGender,
age,
patientOneName,
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"
yearOfBirth,
patientOneUpdatedBloodGroup
);
// Verify No medical history
patientPage.verifyNoSymptosPresent("Diabetes");
// verify insurance details and dedicatd page
cy.get("[data-testid=patient-details]")
.contains(patientOneFirstSubscriberId)
.scrollIntoView();
cy.wait(2000);
patientPage.verifyPatientPolicyDetails(
patientOneFirstSubscriberId,
patientOneFirstPolicyId,
patientOneFirstInsurerId,
patientOneFirstInsurerName
);
patientPage.clickPatientInsuranceViewDetail();
cy.wait(3000);
patientPage.verifyPatientPolicyDetails(
patientOneFirstSubscriberId,
patientOneFirstPolicyId,
patientOneFirstInsurerId,
patientOneFirstInsurerName
);
patientPage.verifyPatientPolicyDetails(
patientOneSecondSubscriberId,
patientOneSecondPolicyId,
patientOneSecondInsurerId,
patientOneSecondInsurerName
);
});

it("Create a New consultation to existing patient", () => {
patientPage.interceptFacilities();
updatePatientPage.visitConsultationPage();
patientPage.visitConsultationPage();
patientPage.verifyStatusCode();
patientConsultationPage.fillIllnessHistory("history");
patientConsultationPage.selectConsultationStatus(
Expand Down Expand Up @@ -145,7 +242,7 @@ describe("Patient Creation with consultation", () => {
});

it("Edit created consultation to existing patient", () => {
updatePatientPage.visitUpdatedPatient();
patientPage.visitPatientUrl();
patientConsultationPage.visitEditConsultationPage();
patientConsultationPage.fillIllnessHistory("editted");
patientConsultationPage.updateSymptoms("FEVER");
Expand Down
2 changes: 1 addition & 1 deletion cypress/pageobject/Asset/AssetCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class AssetPage {
cy.get(
"[data-testid=asset-last-serviced-on-input] input[type='text']"
).click();
cy.get("#date-input").click().type(lastServicedOn);
cy.get("#date-input").click().clear().type(lastServicedOn);
cy.get("[data-testid=asset-notes-input] textarea").clear().type(notes);
}

Expand Down
Loading

0 comments on commit 8727a03

Please sign in to comment.