Skip to content

Commit

Permalink
update cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rash-27 committed Mar 20, 2024
1 parent 38c34ce commit 154e910
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
30 changes: 16 additions & 14 deletions cypress/e2e/patient_spec/patient_registration.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ describe("Patient Creation with consultation", () => {
const patientExternal = new PatientExternal();
const patientInsurance = new PatientInsurance();
const patientMedicalHistory = new PatientMedicalHistory();
const phone_number = generatePhoneNumber();
const emergency_phone_number = generateEmergencyPhoneNumber();
let phone_number = generatePhoneNumber();
let emergency_phone_number = generateEmergencyPhoneNumber();
const age = calculateAge();
const patientFacility = "Dummy Facility 40";
const patientDateOfBirth = "01012001";
Expand Down Expand Up @@ -72,15 +72,15 @@ describe("Patient Creation with consultation", () => {
cy.awaitUrl("/patients");
});

it("Create a new patient with all field in registration form and no consultation", () => {
it("Create a new patient with all field in registration form with age and verify", () => {
// patient details with all the available fields except covid
patientPage.createPatient();
patientPage.selectFacility(patientFacility);
patientPage.patientformvisibility();
// Patient Details page
patientPage.typePatientPhoneNumber(phone_number);
patientPage.typePatientEmergencyNumber(emergency_phone_number);
patientPage.typePatientDateOfBirth(patientDateOfBirth);
patientPage.typePatientAge(age.toString());
patientPage.typePatientName(patientOneName);
patientPage.selectPatientGender(patientOneGender);
patientPage.typePatientAddress(patientOneAddress);
Expand All @@ -89,7 +89,6 @@ 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 @@ -118,7 +117,7 @@ describe("Patient Creation with consultation", () => {
emergency_phone_number,
yearOfBirth,
patientOneBloodGroup,
patientOccupation
"-" //Occupation
);
patientMedicalHistory.verifyPatientMedicalDetails(
patientOnePresentHealth,
Expand All @@ -132,21 +131,18 @@ describe("Patient Creation with consultation", () => {
"Cancer",
"Other"
);
// verify its presence in the patient detail page
cy.visit("/patients");
patientPage.typePatientNameList(patientOneName);
patientPage.verifyPatientNameList(patientOneName);
});

it("Create a new patient with all field in registration form with age and verify", () => {
it("Create a new patient with all field in registration form and no consultation", () => {
// patient details with all the available fields except covid
phone_number = generatePhoneNumber();
emergency_phone_number = generateEmergencyPhoneNumber();
patientPage.createPatient();
patientPage.selectFacility(patientFacility);
patientPage.patientformvisibility();
// Patient Details page
patientPage.typePatientPhoneNumber(phone_number);
patientPage.typePatientEmergencyNumber(emergency_phone_number);
patientPage.typePatientAge(age.toString());
patientPage.typePatientDateOfBirth(patientDateOfBirth);
patientPage.typePatientName(patientOneName);
patientPage.selectPatientGender(patientOneGender);
patientPage.typePatientAddress(patientOneAddress);
Expand All @@ -155,6 +151,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 @@ -182,7 +179,8 @@ describe("Patient Creation with consultation", () => {
phone_number,
emergency_phone_number,
yearOfBirth,
patientOneBloodGroup
patientOneBloodGroup,
patientOccupation
);
patientMedicalHistory.verifyPatientMedicalDetails(
patientOnePresentHealth,
Expand All @@ -196,6 +194,10 @@ describe("Patient Creation with consultation", () => {
"Cancer",
"Other"
);
// verify its presence in the patient detail page
cy.visit("/patients");
patientPage.typePatientNameList(patientOneName);
patientPage.verifyPatientNameList(patientOneName);
});

it("Edit the patient details with no consultation and verify", () => {
Expand Down
8 changes: 6 additions & 2 deletions src/Components/Patient/PatientHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,14 @@ export const PatientHome = (props: any) => {
<div className="mb-8 mt-2 grid grid-cols-1 gap-x-4 gap-y-2 md:grid-cols-2 md:gap-y-8 lg:grid-cols-4">
<div className="sm:col-span-1">
<div className="text-sm font-semibold leading-5 text-zinc-400">
Date of Birth
{patientData.date_of_birth
? "Date of Birth"
: "Year of Birth"}
</div>
<div className="mt-1 text-sm font-medium leading-5">
{formatDate(patientData?.date_of_birth)}
{patientData.date_of_birth
? formatDate(patientData.date_of_birth)
: patientData.year_of_birth}
</div>
</div>
<div className="sm:col-span-1">
Expand Down

0 comments on commit 154e910

Please sign in to comment.