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 | Modify Facility Doctor Capacity | Facility Module #7054

Merged
merged 2 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 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,8 @@ describe("Facility Manage Functions", () => {
"Health Facility config updated successfully";
const facilityHrfId = uuidv4();
const facilityUpdatedHrfId = uuidv4();
const doctorCapacity = "5";
const doctorModifiedCapacity = "7";

before(() => {
loginPage.loginAsDisctrictAdmin();
Expand Down Expand Up @@ -98,6 +100,32 @@ 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"
);
});

afterEach(() => {
cy.saveLocalStorage();
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/pageobject/Facility/FacilityCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 17 additions & 0 deletions cypress/pageobject/Facility/FacilityManage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ class FacilityManage {
.wait(100); // Adjust the wait time as needed
}

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

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

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

clickSaveCoverImage() {
cy.get("#save-cover-image").scrollIntoView();
cy.get("#save-cover-image").click();
Expand Down Expand Up @@ -54,5 +66,10 @@ 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();
}
}
export default FacilityManage;
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
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