Skip to content

Commit

Permalink
FINAL_COMMIT
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffrin2005 committed Dec 28, 2024
1 parent 197c9a9 commit 4c56047
Show file tree
Hide file tree
Showing 2 changed files with 154 additions and 18 deletions.
171 changes: 154 additions & 17 deletions cypress/e2e/patient_spec/PatientInvestigation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
import { PatientPage } from "pageobject/Patient/PatientCreation";
import PatientInvestigation from "pageobject/Patient/PatientInvestigation";
import { advanceFilters } from "pageobject/utils/advanceFilterHelpers";
import { pageNavigation } from "pageobject/utils/paginationHelpers";

import LoginPage from "../../pageobject/Login/LoginPage";
import PatientHome from "../../pageobject/Patient/PatientHome";

describe("Patient Investigation Creation from Patient consultation page", () => {
describe("Patient Homepage present functionalities", () => {
const loginPage = new LoginPage();
const patientPage = new PatientPage();
const patientInvestigation = new PatientInvestigation();
const patientName = "Dummy Patient Thirteen";
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.loginByRole("districtAdmin");
Expand All @@ -20,20 +37,140 @@ describe("Patient Investigation Creation from Patient consultation page", () =>
cy.awaitUrl("/patients");
});

it("Create a investigation for a patient and verify its reflection", () => {
patientPage.visitPatient(patientName);
patientInvestigation.clickInvestigationTab();
it("Date based advance filters applied in the patient tab", () => {
advanceFilters.clickAdvancedFiltersButton();
patientHome.typePatientCreatedBeforeDate(patientFromDate);
patientHome.typePatientCreatedAfterDate(patientToDate);
patientHome.typePatientModifiedBeforeDate(patientFromDate);
patientHome.typePatientModifiedAfterDate(patientToDate);
patientHome.typePatientAdmitedBeforeDate(patientFromDate);
patientHome.typePatientAdmitedAfterDate(patientToDate);
patientHome.clickPatientFilterApply();
// 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();
});

it("Facility Geography based advance filters applied in the patient tab", () => {
advanceFilters.clickAdvancedFiltersButton();
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();
});

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

cy.get("#investigations", { timeout: 15000 }).should("be.visible");
it("Patient Details based advance filters applied in the patient tab", () => {
// Patient Filtering based on patient details
advanceFilters.clickAdvancedFiltersButton();
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");
// 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();
});

patientInvestigation.clickLogLabResults();
patientInvestigation.selectInvestigationOption([
"Haematology",
"Urine Test",
]);
cy.clickSubmitButton("Save Investigation");
cy.verifyNotification("Please Enter at least one value");
it("Export the live patient list based on a date range", () => {
patientHome.clickPatientExport();
cy.verifyNotification("Please select a seven day period");
cy.closeNotification();
patientHome.typePatientModifiedBeforeDate("01122023");
patientHome.typePatientModifiedAfterDate("07122023");
patientHome.clickPatientFilterApply();
patientHome.interceptPatientExportRequest();
patientHome.clickPatientExport();
patientHome.verifyPatientExportRequest();
});

it("Test Pagination on Patient List Page", () => {
let firstPatientPageOne: string;
cy.get('[data-cy="patient"]')
.first()
.invoke("text")
.then((patientOne: string) => {
firstPatientPageOne = patientOne.trim();
pageNavigation.navigateToNextPage();
pageNavigation.verifyCurrentPageNumber(2);
cy.get('[data-cy="patient"]')
.first()
.invoke("text")
.then((patientTwo: string) => {
const firstPatientPageTwo = patientTwo.trim();
expect(firstPatientPageOne).not.to.eq(firstPatientPageTwo);
pageNavigation.navigateToPreviousPage();
});
});
});

afterEach(() => {
Expand Down
1 change: 0 additions & 1 deletion cypress/pageobject/Patient/PatientInvestigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ class PatientInvestigation {

clickInvestigationTab() {
cy.verifyAndClickElement("#consultation_tab_nav", "Investigations");
cy.get("#investigations", { timeout: 15000 }).should("exist");
}

selectInvestigation(investigation: string) {
Expand Down

0 comments on commit 4c56047

Please sign in to comment.