Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Cypress Test | Patient Details Advance Filters #8750

Merged
merged 15 commits into from
Oct 12, 2024
Merged
128 changes: 128 additions & 0 deletions cypress/e2e/patient_spec/PatientHomepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@ import PatientHome from "../../pageobject/Patient/PatientHome";
describe("Patient Homepage present functionalities", () => {
const loginPage = new LoginPage();
const patientHome = new PatientHome();
const patientGender = "Male";
const patientCategory = "Moderate";
const patientMinimumAge = "18";
const patientMaximumAge = "24";
const patientLastAdmittedBed = "No bed assigned";
const PatientLastConsentType = "No consents";
const patientTelemedicinePerference = "No";
const patientReviewStatus = "No";
const patientMedicoStatus = "Non-Medico-Legal";
const patientIcdDiagnosis = "1A00";
const facilityName = "Dummy Facility 40";
const facilityType = "Private Hospital";
const facilityLsgBody = "Aikaranad Grama Panchayat, Ernakulam District";
const facilityDistrict = "Ernakulam";
const patientFromDate = "01122023";
const patientToDate = "07122023";
const patientFromDateBadge = "2023-12-01";
const patientToDateBadge = "2023-12-07";

before(() => {
loginPage.loginAsDisctrictAdmin();
Expand All @@ -16,6 +34,116 @@ describe("Patient Homepage present functionalities", () => {
cy.awaitUrl("/patients");
});

it("Date based advance filters applied in the patient tab", () => {
patientHome.clickPatientAdvanceFilters();
patientHome.typePatientCreatedBeforeDate(patientFromDate);
patientHome.typePatientCreatedAfterDate(patientToDate);
patientHome.typePatientModifiedBeforeDate(patientFromDate);
patientHome.typePatientModifiedAfterDate(patientToDate);
patientHome.typePatientAdmitedBeforeDate(patientFromDate);
patientHome.typePatientAdmitedAfterDate(patientToDate);
patientHome.clickPatientFilterApply();
patientHome.verifyTotalPatientCount("1");
// verify the badge and clear the count
patientHome.verifyPatientCreatedBeforeDate(patientToDateBadge);
patientHome.verifyPatientCreatedAfterDate(patientFromDateBadge);
patientHome.verifyPatientModifiedBeforeDate(patientToDateBadge);
patientHome.verifyPatientModifiedAfterDate(patientFromDateBadge);
patientHome.verifyPatientAdmittedBeforeDate(patientToDateBadge);
patientHome.verifyPatientAdmittedAfterDate(patientFromDateBadge);
cy.clearAllFilters();
patientHome.verifyTotalPatientCount("1");
});

it("Facility Geography based advance filters applied in the patient tab", () => {
patientHome.clickPatientAdvanceFilters();
patientHome.typeFacilityName(facilityName);
patientHome.selectFacilityType(facilityType);
patientHome.typeFacilityLsgBody(facilityLsgBody);
patientHome.typeFacilityDistrict(facilityDistrict);
patientHome.clickPatientFilterApply();
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("1");
});

it("Patient diagnosis based advance filters applied in the patient tab", () => {
// Patient Filtering based on icd-11 data
patientHome.clickPatientAdvanceFilters();
patientHome.selectAnyIcdDiagnosis(patientIcdDiagnosis, patientIcdDiagnosis);
patientHome.selectConfirmedIcdDiagnosis(
patientIcdDiagnosis,
patientIcdDiagnosis,
);
patientHome.selectUnconfirmedIcdDiagnosis(
patientIcdDiagnosis,
patientIcdDiagnosis,
);
patientHome.selectProvisionalIcdDiagnosis(
patientIcdDiagnosis,
patientIcdDiagnosis,
);
patientHome.selectDifferentialIcdDiagnosis(
patientIcdDiagnosis,
patientIcdDiagnosis,
);
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");
// Apply Any and confirmed diagonsis to verify patient count 17
patientHome.clickPatientAdvanceFilters();
patientHome.selectAnyIcdDiagnosis(patientIcdDiagnosis, patientIcdDiagnosis);
patientHome.selectConfirmedIcdDiagnosis(
patientIcdDiagnosis,
patientIcdDiagnosis,
);
patientHome.clickPatientFilterApply();
patientHome.verifyTotalPatientCount("1");
});

it("Patient Details based advance filters applied in the patient tab", () => {
// Patient Filtering based on patient details
patientHome.clickPatientAdvanceFilters();
patientHome.selectPatientGenderfilter(patientGender);
patientHome.selectPatientCategoryfilter(patientCategory);
patientHome.typePatientMinimumAgeFilter(patientMinimumAge);
patientHome.typePatientMaximumAgeFilter(patientMaximumAge);
patientHome.selectPatientLastAdmittedBed(patientLastAdmittedBed);
patientHome.selectPatientLastConsentType(PatientLastConsentType);
patientHome.selectPatientTelemedicineFilter(patientTelemedicinePerference);
patientHome.selectPatientReviewFilter(patientReviewStatus);
patientHome.selectPatientMedicoFilter(patientMedicoStatus);
patientHome.clickPatientFilterApply();
cy.get("a[data-cy='patient']").should("contain.text", "Dummy Patient");
patientHome.verifyTotalPatientCount("1");
// Verify the presence of badges
patientHome.verifyGenderBadgeContent(patientGender);
patientHome.verifyCategoryBadgeContent(patientCategory);
patientHome.verifyMinAgeBadgeContent(patientMinimumAge);
patientHome.verifyMaxAgeBadgeContent(patientMaximumAge);
patientHome.verifyLastAdmittedBedBadgeContent(patientLastAdmittedBed);
patientHome.verifyLastConsentTypeBadgeContent("No Consents");
patientHome.verifyTelemedicineBadgeContent("false");
patientHome.verifyReviewMissedBadgeContent("false");
patientHome.verifyMedicoBadgeContent("false");
// Clear the badges and verify the patient count along with badges
cy.clearAllFilters();
patientHome.verifyTotalPatientCount("1");
});

it("Export the live patient list based on a date range", () => {
patientHome.clickPatientExport();
cy.verifyNotification("Please select a seven day period");
Expand Down
10 changes: 5 additions & 5 deletions cypress/pageobject/Patient/PatientConsultation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ export class PatientConsultationPage {
}

selectPatientReferance(referance: string) {
cy.searchAndSelectOption("#referred_to", referance);
cy.typeAndSelectOption("#referred_to", referance);
}

selectBed(bedNo: string) {
cy.searchAndSelectOption("#bed", bedNo);
cy.typeAndSelectOption("#bed", bedNo);
}

selectPatientWard(ward: string) {
cy.searchAndSelectOption("#transferred_from_location", ward);
cy.typeAndSelectOption("#transferred_from_location", ward);
}

selectPatientSuggestion(suggestion: string) {
Expand All @@ -49,7 +49,7 @@ export class PatientConsultationPage {
}

selectPatientDiagnosis(icdCode, statusId) {
cy.searchAndSelectOption("#icd11-search", icdCode);
cy.typeAndSelectOption("#icd11-search", icdCode);
cy.get("#diagnosis-list")
.contains("Add as")
.scrollIntoView()
Expand Down Expand Up @@ -98,7 +98,7 @@ export class PatientConsultationPage {
}

typeReferringFacility(referringFacility: string) {
cy.searchAndSelectOption("#referred_from_facility", referringFacility);
cy.typeAndSelectOption("#referred_from_facility", referringFacility);
}

clickEditConsultationButton() {
Expand Down
4 changes: 2 additions & 2 deletions cypress/pageobject/Patient/PatientCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class PatientPage {
}

selectFacility(facilityName: string) {
cy.searchAndSelectOption("input[name='facilities']", facilityName);
cy.typeAndSelectOption("input[name='facilities']", facilityName);
cy.submitButton("Select");
}

Expand Down Expand Up @@ -114,7 +114,7 @@ export class PatientPage {
}

selectPatientOccupation(occupation: string) {
cy.searchAndSelectOption("#occupation", occupation);
cy.typeAndSelectOption("#occupation", occupation);
}

selectSocioeconomicStatus(value: string) {
Expand Down
2 changes: 1 addition & 1 deletion cypress/pageobject/Patient/PatientDischarge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PatientDischarge {
}

typeReferringFacility(facility: string) {
cy.searchAndSelectOption("#facility-referredto", facility);
cy.typeAndSelectOption("#facility-referredto", facility);
}

clickClearButton() {
Expand Down
Loading
Loading