diff --git a/cypress/e2e/patient_spec/PatientHomepage.cy.ts b/cypress/e2e/patient_spec/PatientHomepage.cy.ts index 9f6e1f27480..4aee0e9b028 100644 --- a/cypress/e2e/patient_spec/PatientHomepage.cy.ts +++ b/cypress/e2e/patient_spec/PatientHomepage.cy.ts @@ -18,6 +18,8 @@ describe("Patient Homepage present functionalities", () => { const facilityType = "Private Hospital"; const facilityLsgBody = "Aikaranad Grama Panchayat, Ernakulam District"; const facilityDistrict = "Ernakulam"; + const patientBeforeDate = "01122023"; + const patientAfterDate = "07122023"; before(() => { loginPage.loginAsDisctrictAdmin(); @@ -30,6 +32,27 @@ describe("Patient Homepage present functionalities", () => { cy.awaitUrl("/patients"); }); + it("Date based advance filters applied in the patient tab", () => { + patientHome.clickPatientAdvanceFilters(); + patientHome.typePatientCreatedBeforeDate(patientBeforeDate); + patientHome.typePatientCreatedAfterDate(patientAfterDate); + patientHome.typePatientModifiedBeforeDate(patientBeforeDate); + patientHome.typePatientModifiedAfterDate(patientAfterDate); + patientHome.typePatientAdmitedBeforeDate(patientBeforeDate); + patientHome.typePatientAdmitedAfterDate(patientAfterDate); + patientHome.clickPatientFilterApply(); + patientHome.verifyTotalPatientCount("1"); + // verify the badge and clear the count + patientHome.verifyPatientCreatedBeforeDate(patientBeforeDate); + patientHome.verifyPatientCreatedAfterDate(patientAfterDate); + patientHome.verifyPatientModifiedBeforeDate(patientBeforeDate); + patientHome.verifyPatientModifiedAfterDate(patientAfterDate); + patientHome.verifyPatientAdmittedBeforeDate(patientBeforeDate); + patientHome.verifyPatientAdmittedAfterDate(patientAfterDate); + cy.clearAllFilters(); + patientHome.verifyTotalPatientCount("1"); + }); + it("Facility Geography based advance filters applied in the patient tab", () => { patientHome.clickPatientAdvanceFilters(); patientHome.typeFacilityName(facilityName); @@ -37,10 +60,14 @@ describe("Patient Homepage present functionalities", () => { patientHome.typeFacilityLsgBody(facilityLsgBody); patientHome.typeFacilityDistrict(facilityDistrict); patientHome.clickPatientFilterApply(); - patientHome.verifyTotalPatientCount("17"); + patientHome.verifyTotalPatientCount("1"); // Clear the badges and verify the patient count along with badges + patientHome.verifyFacilityNameBadgeContent(facilityName); + patientHome.verifyFacilityTypeBadgeContent(facilityType); + patientHome.verifyFacilityLsgBadgeContent(facilityLsgBody); + patientHome.verifyFacilityDistrictContent(facilityDistrict); cy.clearAllFilters(); - patientHome.verifyTotalPatientCount("18"); + patientHome.verifyTotalPatientCount("1"); }); it("Patient diagnosis based advance filters applied in the patient tab", () => { @@ -65,6 +92,12 @@ describe("Patient Homepage present functionalities", () => { ); patientHome.clickPatientFilterApply(); patientHome.verifyTotalPatientCount("0"); + // verify the badges presence in the platform + patientHome.verifyAnyDiagnosisBadgeContent(patientIcdDiagnosis); + patientHome.verifyConfirmedDiagnosisBadgeContent(patientIcdDiagnosis); + patientHome.verifyUnconfirmedDiagnosisBadgeContent(patientIcdDiagnosis); + patientHome.verifyProvisionalDiagnosisBadgeContent(patientIcdDiagnosis); + patientHome.verifyDifferentialDiagnosisBadgeContent(patientIcdDiagnosis); // Clear the badges and verify the patient count along with badges cy.clearAllFilters(); patientHome.verifyTotalPatientCount("1"); diff --git a/cypress/pageobject/Patient/PatientHome.ts b/cypress/pageobject/Patient/PatientHome.ts index e345b0c6baa..117494e28cb 100644 --- a/cypress/pageobject/Patient/PatientHome.ts +++ b/cypress/pageobject/Patient/PatientHome.ts @@ -34,6 +34,14 @@ class PatientHome { }); } + typePatientCreatedBeforeDate(startDate: string) { + cy.clickAndTypeDate("input[name='created_date_start']", startDate); + } + + typePatientCreatedAfterDate(endDate: string) { + cy.clickAndTypeDate("input[name='created_date_end']", endDate); + } + typePatientModifiedBeforeDate(startDate: string) { cy.clickAndTypeDate("input[name='modified_date_start']", startDate); } @@ -42,6 +50,20 @@ class PatientHome { cy.clickAndTypeDate("input[name='modified_date_end']", endDate); } + typePatientAdmitedBeforeDate(startDate: string) { + cy.clickAndTypeDate( + "input[name='last_consultation_encounter_date_start']", + startDate, + ); + } + + typePatientAdmitedAfterDate(endDate: string) { + cy.clickAndTypeDate( + "input[name='last_consultation_encounter_date_end']", + endDate, + ); + } + clickPatientAdvanceFilters() { cy.get("#advanced-filter").click(); } @@ -163,5 +185,75 @@ class PatientHome { typeFacilityDistrict(district: string) { cy.typeAndSelectOption("#facility-district", district); } + + verifyAnyDiagnosisBadgeContent(expectedText: string) { + cy.get("[data-testid='Diagnoses (of any verification status)']").should( + "contain", + expectedText, + ); + } + + verifyConfirmedDiagnosisBadgeContent(expectedText: string) { + cy.get("[data-testid='Confirmed Diagnoses']").should( + "contain", + expectedText, + ); + } + + verifyUnconfirmedDiagnosisBadgeContent(expectedText: string) { + cy.get("[data-testid='Unconfirmed Diagnoses']").should( + "contain", + expectedText, + ); + } + + verifyProvisionalDiagnosisBadgeContent(expectedText: string) { + cy.get("[data-testid='Provisional Diagnoses']").should( + "contain", + expectedText, + ); + } + + verifyDifferentialDiagnosisBadgeContent(expectedText: string) { + cy.get("[data-testid='Differential Diagnoses']").should( + "contain", + expectedText, + ); + } + + verifyFacilityNameBadgeContent(expectedText: string) { + cy.get("[data-testid='Facility']").should("contain", expectedText); + } + + verifyFacilityTypeBadgeContent(expectedText: string) { + cy.get("[data-testid='Facility Type']").should("contain", expectedText); + } + + verifyFacilityLsgBadgeContent(expectedText: string) { + cy.get("[data-testid='LSG Body']").should("contain", expectedText); + } + + verifyFacilityDistrictContent(expectedText: string) { + cy.get("[data-testid='District']").should("contain", expectedText); + } + + verifyPatientCreatedBeforeDate(expectedText: string) { + cy.get("[data-testid='Created before']").should("contain", expectedText); + } + verifyPatientCreatedAfterDate(expectedText: string) { + cy.get("[data-testid='Created after']").should("contain", expectedText); + } + verifyPatientModifiedBeforeDate(expectedText: string) { + cy.get("[data-testid='Modified before']").should("contain", expectedText); + } + verifyPatientModifiedAfterDate(expectedText: string) { + cy.get("[data-testid='Modified after']").should("contain", expectedText); + } + verifyPatientAdmittedAfterDate(expectedText: string) { + cy.get("[data-testid='Admitted after']").should("contain", expectedText); + } + verifyPatientAdmittedBeforeDate(expectedText: string) { + cy.get("[data-testid='Admitted before']").should("contain", expectedText); + } } export default PatientHome;