diff --git a/cypress/e2e/patient_spec/patient_registration.cy.ts b/cypress/e2e/patient_spec/patient_registration.cy.ts index ac600efc865..b4ba16e037d 100644 --- a/cypress/e2e/patient_spec/patient_registration.cy.ts +++ b/cypress/e2e/patient_spec/patient_registration.cy.ts @@ -29,6 +29,8 @@ describe("Patient Creation with consultation", () => { const phone_number = generatePhoneNumber(); const emergency_phone_number = generateEmergencyPhoneNumber(); const age = calculateAge(); + const patientage = "20"; + const yearOfBirthfromAge = new Date().getFullYear() - parseInt(patientage); const patientFacility = "Dummy Facility 40"; const patientDateOfBirth = "01012001"; const patientOneName = "Patient With No Consultation"; diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts index 9ad42f8b074..6adeac71331 100644 --- a/cypress/pageobject/Patient/PatientCreation.ts +++ b/cypress/pageobject/Patient/PatientCreation.ts @@ -51,9 +51,8 @@ export class PatientPage { cy.get("#date-input").click().type(dateOfBirth); } typePatientAge(age: string) { - cy.get("#age-input-type-selector").click(); - cy.get("#age-input-type-selector").contains("Age").click(); - cy.get("button").contains("Confirm").click(); + cy.clickAndSelectOption("#age-input-type-selector", "Age"); + cy.submitButton("Confirm"); cy.get("#age-div").click().type(age); }