Skip to content

Commit

Permalink
convert to POM
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 committed Jan 18, 2024
1 parent 25f0e49 commit 44caf0c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
19 changes: 9 additions & 10 deletions cypress/e2e/facility_spec/facility_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe("Facility Manage Functions", () => {
const facilityHrfId = uuidv4();
const facilityUpdatedHrfId = uuidv4();
const doctorCapacity = "5";
const doctorModifiedCapacity = "7";

before(() => {
loginPage.loginAsDisctrictAdmin();
Expand Down Expand Up @@ -99,29 +100,27 @@ describe("Facility Manage Functions", () => {
facilityManage.verifyHrfIdValue(facilityUpdatedHrfId);
});

it("Modify Facility detail page doctor capacity ", () => {
it("Modify doctor capacity in Facility detail page", () => {
// Add a doctor capacity
cy.get("#facility-add-doctortype").scrollIntoView();
cy.get("#facility-add-doctortype").click();
facilityManage.clickFacilityAddDoctorTypeButton();
facilityPage.selectAreaOfSpecialization("General Medicine");
facilityPage.fillDoctorCount(doctorCapacity);
facilityPage.clickdoctorcapacityaddmore();
facilityPage.saveAndExitDoctorForm();
facilityManage.verifySuccessMessageVisibilityAndContent(
"Doctor count added successfully"
);
cy.get("#facility-doctor-totalcapacity").contains(doctorCapacity);
facilityManage.verifyTotalDoctorCapacity(doctorCapacity);
// edit a existing doctor
cy.get("#edit-facility-doctorcapacity").click();
facilityPage.fillDoctorCount("7");
facilityManage.clickEditFacilityDoctorCapacity();
facilityPage.fillDoctorCount(doctorModifiedCapacity);
facilityPage.clickdoctorcapacityaddmore();
facilityManage.verifySuccessMessageVisibilityAndContent(
"Doctor count updated successfully"
);
cy.get("#facility-doctor-totalcapacity").contains("7");
facilityManage.verifyTotalDoctorCapacity(doctorModifiedCapacity);
// delete a bed
cy.get("#delete-facility-doctorcapacity").click();
cy.get("#submit").click();
facilityManage.clickDeleteFacilityDoctorCapacity();
facilityManage.clickButtonWithText("Delete");
facilityManage.verifySuccessMessageVisibilityAndContent(
"Doctor specialization type deleted successfully"
);
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;

0 comments on commit 44caf0c

Please sign in to comment.