Skip to content

Commit

Permalink
Merge branch 'develop' into fix#7036-1
Browse files Browse the repository at this point in the history
  • Loading branch information
sriharsh05 authored Jan 19, 2024
2 parents ebe5960 + 85b6a30 commit cd4ff48
Show file tree
Hide file tree
Showing 14 changed files with 191 additions and 34 deletions.
3 changes: 1 addition & 2 deletions cypress/e2e/death_report_spec/death_report.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ describe("Death Report", () => {
beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/");
cy.awaitUrl("/patients");
cy.intercept("**/api/v1/patient/**").as("getPatients");
cy.get("#facility-patients").contains("Patients").click({ force: true });
cy.url().should("include", "/patients");
cy.wait("@getPatients").get("a[data-cy=patient]").first().click();
cy.url().then((url) => {
Expand Down
7 changes: 0 additions & 7 deletions cypress/e2e/facility_spec/facility_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,6 @@ describe("Facility Creation", () => {
facilityPage.verifySuccessNotification("Facility updated successfully");
});

it("Delete a facility", () => {
facilityPage.visitUpdateFacilityPage(facilityUrl1);
facilityPage.clickManageFacilityDropdown();
facilityPage.clickDeleteFacilityOption();
facilityPage.confirmDeleteFacility();
});

afterEach(() => {
cy.saveLocalStorage();
});
Expand Down
50 changes: 35 additions & 15 deletions cypress/e2e/facility_spec/facility_homepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ describe("Facility Homepage Function", () => {
const capacitiesAlias = "downloadCapacitiesCSV";
const doctorsAlias = "downloadDoctorsCSV";
const triagesAlias = "downloadTriagesCSV";
const facilityname = "Dummy Facility 1";
const statename = "Kerala";
const facilityName = "Dummy Facility 1";
const facilityLocaion = "Dummy Location";
const stateName = "Kerala";
const district = "Ernakulam";
const localbody = "Aikaranad";
const facilitytype = "Private Hospital";
const localBody = "Aikaranad";
const facilityType = "Private Hospital";

before(() => {
loginPage.loginAsDisctrictAdmin();
Expand Down Expand Up @@ -58,16 +59,16 @@ describe("Facility Homepage Function", () => {

it("Verify the functionality of advance filter", () => {
userPage.clickAdvancedFilters();
facilityPage.selectState(statename);
facilityPage.selectState(stateName);
facilityPage.selectDistrict(district);
facilityPage.selectLocalBody(localbody);
facilityPage.clickUpdateFacilityType(facilitytype);
facilityPage.selectLocalBody(localBody);
facilityPage.clickUpdateFacilityType(facilityType);
userPage.applyFilter();
facilityPage.verifyStateBadgeContent(statename);
facilityPage.verifyStateBadgeContent(stateName);
facilityPage.verifyDistrictBadgeContent(district);
facilityPage.verifyLocalBodyBadgeContent(localbody);
facilityPage.verifyFacilityTypeBadgeContent(facilitytype);
manageUserPage.assertFacilityInCard(facilityname);
facilityPage.verifyLocalBodyBadgeContent(localBody);
facilityPage.verifyFacilityTypeBadgeContent(facilityType);
manageUserPage.assertFacilityInCard(facilityName);
userPage.clearFilters();
userPage.verifyDataTestIdNotVisible("State");
userPage.verifyDataTestIdNotVisible("District");
Expand All @@ -80,10 +81,10 @@ describe("Facility Homepage Function", () => {
assetPagination.navigateToNextPage();
assetPagination.navigateToPreviousPage();
// search for a facility
manageUserPage.typeFacilitySearch(facilityname);
facilityPage.verifyFacilityBadgeContent(facilityname);
manageUserPage.assertFacilityInCard(facilityname);
facilityHome.verifyURLContains(facilityname);
manageUserPage.typeFacilitySearch(facilityName);
facilityPage.verifyFacilityBadgeContent(facilityName);
manageUserPage.assertFacilityInCard(facilityName);
facilityHome.verifyURLContains(facilityName);
});

it("Verify Facility Export Functionality", () => {
Expand Down Expand Up @@ -113,6 +114,25 @@ describe("Facility Homepage Function", () => {
facilityHome.clickSearchButton();
});

it("Verify Facility Detail page redirection to CNS and Live Minitoring ", () => {
userPage.clickAdvancedFilters();
facilityPage.selectState(stateName);
facilityPage.selectDistrict(district);
facilityPage.selectLocalBody(localBody);
userPage.applyFilter();
// go to cns page in the facility details page
manageUserPage.assertFacilityInCard(facilityName);
facilityHome.clickViewFacilityDetails();
facilityHome.clickFacilityCnsButton();
facilityHome.verifyCnsUrl();
facilityHome.navigateBack();
// go to live monitoring page in the facility details page
facilityHome.clickFacilityLiveMonitorButton();
facilityHome.selectLocation(facilityLocaion);
facilityHome.clickLiveMonitorButton();
facilityHome.verifyLiveMonitorUrl();
});

afterEach(() => {
cy.saveLocalStorage();
});
Expand Down
71 changes: 71 additions & 0 deletions cypress/e2e/facility_spec/facility_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ describe("Facility Manage Functions", () => {
"Health Facility config updated successfully";
const facilityHrfId = uuidv4();
const facilityUpdatedHrfId = uuidv4();
const doctorCapacity = "5";
const doctorModifiedCapacity = "7";
const totalCapacity = "100";
const currentOccupied = "80";
const totalUpdatedCapacity = "120";
const currentUpdatedOccupied = "100";

before(() => {
loginPage.loginAsDisctrictAdmin();
Expand Down Expand Up @@ -98,6 +104,71 @@ describe("Facility Manage Functions", () => {
facilityManage.verifyHrfIdValue(facilityUpdatedHrfId);
});

it("Modify doctor capacity in Facility detail page", () => {
// Add a doctor capacity
facilityManage.clickFacilityAddDoctorTypeButton();
facilityPage.selectAreaOfSpecialization("General Medicine");
facilityPage.fillDoctorCount(doctorCapacity);
facilityPage.saveAndExitDoctorForm();
facilityManage.verifySuccessMessageVisibilityAndContent(
"Doctor count added successfully"
);
facilityManage.verifyTotalDoctorCapacity(doctorCapacity);
// edit a existing doctor
facilityManage.clickEditFacilityDoctorCapacity();
facilityPage.fillDoctorCount(doctorModifiedCapacity);
facilityPage.clickdoctorcapacityaddmore();
facilityManage.verifySuccessMessageVisibilityAndContent(
"Doctor count updated successfully"
);
facilityManage.verifyTotalDoctorCapacity(doctorModifiedCapacity);
// delete a bed
facilityManage.clickDeleteFacilityDoctorCapacity();
facilityManage.clickButtonWithText("Delete");
facilityManage.verifySuccessMessageVisibilityAndContent(
"Doctor specialization type deleted successfully"
);
});

it("Modify bed capacity in Facility detail page", () => {
// add multiple new bed capacity
facilityManage.clickFacilityAddBedTypeButton();
facilityPage.selectBedType("Oxygen beds");
facilityPage.fillTotalCapacity(totalCapacity);
facilityPage.fillCurrentlyOccupied(currentOccupied);
facilityPage.saveAndExitBedCapacityForm();
facilityManage.verifySuccessMessageVisibilityAndContent(
"Bed capacity added successfully"
);
facilityManage.verifyFacilityBedCapacity(totalCapacity);
facilityManage.verifyFacilityBedCapacity(currentOccupied);
// edit a existing bed
facilityManage.clickEditFacilityBedCapacity();
facilityPage.fillTotalCapacity(totalUpdatedCapacity);
facilityPage.fillCurrentlyOccupied(currentUpdatedOccupied);
facilityPage.clickbedcapcityaddmore();
facilityManage.verifySuccessMessageVisibilityAndContent(
"Bed capacity updated successfully"
);
facilityManage.verifyFacilityBedCapacity(totalUpdatedCapacity);
facilityManage.verifyFacilityBedCapacity(currentUpdatedOccupied);
// delete a bed
facilityManage.clickDeleteFacilityBedCapacity();
facilityManage.clickButtonWithText("Delete");
facilityManage.verifySuccessMessageVisibilityAndContent(
"Bed type deleted successfully"
);
});

it("Delete a existing facility and verify the error message", () => {
facilityPage.clickManageFacilityDropdown();
facilityPage.clickDeleteFacilityOption();
facilityPage.confirmDeleteFacility();
facilityManage.verifySuccessMessageVisibilityAndContent(
"You do not have permission to perform this action."
);
});

afterEach(() => {
cy.saveLocalStorage();
});
Expand Down
6 changes: 3 additions & 3 deletions cypress/pageobject/Facility/FacilityCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ class FacilityPage {
}

fillTotalCapacity(capacity: string) {
cy.get("input#total-capacity").click().type(capacity);
cy.get("input#total-capacity").click().clear().click().type(capacity);
}

fillCurrentlyOccupied(occupied: string) {
cy.get("input#currently-occupied").click().type(occupied);
cy.get("input#currently-occupied").click().clear().click().type(occupied);
}

saveAndExitBedCapacityForm() {
Expand All @@ -96,7 +96,7 @@ class FacilityPage {
}

fillDoctorCount(count: string) {
cy.get("input#count").click().type(count);
cy.get("input#count").click().clear().click().type(count);
}

fillOxygenCapacity(capacity: string) {
Expand Down
24 changes: 24 additions & 0 deletions cypress/pageobject/Facility/FacilityHome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,34 @@ class FacilityHome {
cy.url().should("include", "/cns");
}

verifyLiveMonitorUrl() {
cy.url().should("include", "/live-monitoring?location=");
}

clickFacilityNotifyButton() {
cy.get("#facility-notify").first().click();
}

clickLiveMonitorButton() {
cy.get("#live-monitoring-button").scrollIntoView();
cy.get("#live-monitoring-button").click();
}

clickFacilityLiveMonitorButton() {
cy.get("#facility-detailspage-livemonitoring").scrollIntoView();
cy.get("#facility-detailspage-livemonitoring").click();
}

clickFacilityCnsButton() {
cy.get("#facility-detailspage-cns").scrollIntoView();
cy.get("#facility-detailspage-cns").click();
}

selectLocation(location) {
cy.get("#location").click().type(location);
cy.get("li[role=option]").contains(location).click();
}

verifyFacilityDetailsUrl() {
cy.url().should("match", /\/facility\/[\w-]+/);
}
Expand Down
34 changes: 34 additions & 0 deletions cypress/pageobject/Facility/FacilityManage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,30 @@ class FacilityManage {
.wait(100); // Adjust the wait time as needed
}

verifyTotalDoctorCapacity(expectedCapacity) {
cy.get("#facility-doctor-totalcapacity").contains(expectedCapacity);
}

verifyFacilityBedCapacity(expectedCapacity) {
cy.get("#facility-bed-capacity-details").contains(expectedCapacity);
}

clickEditFacilityDoctorCapacity() {
cy.get("#edit-facility-doctorcapacity").click();
}

clickEditFacilityBedCapacity() {
cy.get("#edit-facility-bedcapacity").click();
}

clickDeleteFacilityDoctorCapacity() {
cy.get("#delete-facility-doctorcapacity").click();
}

clickDeleteFacilityBedCapacity() {
cy.get("#delete-facility-bedcapacity").click();
}

clickSaveCoverImage() {
cy.get("#save-cover-image").scrollIntoView();
cy.get("#save-cover-image").click();
Expand Down Expand Up @@ -54,5 +78,15 @@ class FacilityManage {
verifyHrfIdValue(expectedValue) {
cy.get("#hf_id").should("have.value", expectedValue);
}

clickFacilityAddDoctorTypeButton() {
cy.get("#facility-add-doctortype").scrollIntoView();
cy.get("#facility-add-doctortype").click();
}

clickFacilityAddBedTypeButton() {
cy.get("#facility-add-bedtype").scrollIntoView();
cy.get("#facility-add-bedtype").click();
}
}
export default FacilityManage;
2 changes: 1 addition & 1 deletion cypress/pageobject/Patient/PatientConsultation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class PatientConsultationPage {
cy.get("#icd11-search input[role='combobox']")
.scrollIntoView()
.click()
.type("1A");
.type("1A00");
cy.get("#icd11-search [role='option']")
.contains("1A00 Cholera")
.scrollIntoView()
Expand Down
6 changes: 3 additions & 3 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ status = 200
[[headers]]
for = "/*"
[headers.values]
cache-control = '''
max-age=0,
no-store'''
cache-control = "max-age=0, no-store"
X-Frame-Options = "DENY"
X-Content-Type-Options = "nosniff"
2 changes: 2 additions & 0 deletions src/Components/Facility/BedTypeCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export const BedTypeCard: React.FC<BedTypeCardProps> = ({
</div>
<div className="flex items-stretch justify-between gap-4 self-stretch">
<ButtonV2
id="edit-facility-bedcapacity"
onClick={() => {
setSelectedId(room_type || 0);
setOpen(true);
Expand All @@ -125,6 +126,7 @@ export const BedTypeCard: React.FC<BedTypeCardProps> = ({
</ButtonV2>

<ButtonV2
id="delete-facility-bedcapacity"
onClick={() => setOpenDeleteDialog(true)}
authorizeFor={NonReadOnlyUsers}
className=" tooltip bg-opacity/10 flex aspect-square h-7 w-7 flex-col items-center justify-center rounded bg-red-100 px-4 py-0 hover:bg-red-200"
Expand Down
2 changes: 2 additions & 0 deletions src/Components/Facility/DoctorsCountCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const DoctorsCountCard = (props: DoctorsCountProps) => {
</div>
<div className="flex justify-end gap-4 border-t border-[#D2D6DC] bg-[#FBF9FB] px-3 py-2">
<ButtonV2
id="edit-facility-doctorcapacity"
variant="secondary"
ghost
onClick={() => {
Expand All @@ -75,6 +76,7 @@ const DoctorsCountCard = (props: DoctorsCountProps) => {
Edit
</ButtonV2>
<ButtonV2
id="delete-facility-doctorcapacity"
variant="danger"
ghost
onClick={() => setOpenDeleteDialog(true)}
Expand Down
1 change: 1 addition & 0 deletions src/Components/Facility/FacilityBedCapacity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export const FacilityBedCapacity = (props: any) => {
<div className="justify-between md:flex md:pb-2">
<div className="mb-2 text-xl font-semibold">Bed Capacity</div>
<ButtonV2
id="facility-add-bedtype"
className="w-full md:w-auto"
onClick={() => setBedCapacityModalOpen(true)}
authorizeFor={NonReadOnlyUsers}
Expand Down
7 changes: 5 additions & 2 deletions src/Components/Facility/FacilityDoctorList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const FacilityDoctorList = (props: any) => {
<div className="rounded-full bg-primary-500 p-4">
<DoctorIcon className="h-5 w-5 fill-current text-white" />
</div>
<div>
<div id="facility-doctor-totalcapacity">
<div className="text-sm font-medium text-[#808080]">
Total Doctors
</div>
Expand Down Expand Up @@ -88,6 +88,7 @@ export const FacilityDoctorList = (props: any) => {
<div className="justify-between md:flex md:pb-2">
<div className="mb-2 text-xl font-bold">Doctors List</div>
<ButtonV2
id="facility-add-doctortype"
className="w-full md:w-auto"
onClick={() => setDoctorCapacityModalOpen(true)}
disabled={doctorList.length === DOCTOR_SPECIALIZATION.length}
Expand All @@ -97,7 +98,9 @@ export const FacilityDoctorList = (props: any) => {
Add Doctor Types
</ButtonV2>
</div>
<div className="mt-4">{doctorList}</div>
<div className="mt-4" id="facility-totaldoctor-capacity">
{doctorList}
</div>
</div>

{doctorCapacityModalOpen && (
Expand Down
Loading

0 comments on commit cd4ff48

Please sign in to comment.