diff --git a/cypress/e2e/facility_spec/facility_creation.cy.ts b/cypress/e2e/facility_spec/facility_creation.cy.ts index ea27938c7e9..f318f422893 100644 --- a/cypress/e2e/facility_spec/facility_creation.cy.ts +++ b/cypress/e2e/facility_spec/facility_creation.cy.ts @@ -136,15 +136,18 @@ describe("Facility Creation", () => { facilityPage.fillExpectedDTypeCylinderRequirement(oxygenExpected); facilityPage.selectLocation("Kochi, Kerala"); facilityPage.submitForm(); + cy.closeNotification(); // create multiple bed capacity and verify card reflection facilityPage.selectBedType("Oxygen beds"); facilityPage.fillTotalCapacity(bedCapacity); facilityPage.fillCurrentlyOccupied(bedOccupancy); facilityPage.clickbedcapcityaddmore(); + cy.closeNotification(); facilityPage.selectBedType("Ordinary Bed"); facilityPage.fillTotalCapacity(bedCapacity); facilityPage.fillCurrentlyOccupied(bedOccupancy); facilityPage.clickbedcapcityaddmore(); + cy.closeNotification(); facilityPage.getTotalBedCapacity().contains(totalCapacity); facilityPage.getTotalBedCapacity().contains(totalOccupancy); facilityPage.clickcancelbutton(); @@ -152,9 +155,11 @@ describe("Facility Creation", () => { facilityPage.selectAreaOfSpecialization("General Medicine"); facilityPage.fillDoctorCount(doctorCapacity); facilityPage.clickdoctorcapacityaddmore(); + cy.closeNotification(); facilityPage.selectAreaOfSpecialization("Pulmonology"); facilityPage.fillDoctorCount(doctorCapacity); facilityPage.clickdoctorcapacityaddmore(); + cy.closeNotification(); facilityPage.getTotalDoctorCapacity().contains(doctorCapacity); facilityPage.clickcancelbutton(); facilityPage.verifyfacilitynewurl(); @@ -186,6 +191,12 @@ describe("Facility Creation", () => { facilityPage.getFacilityTotalBedCapacity().contains(totalOccupancy); facilityPage.getFacilityTotalDoctorCapacity().scrollIntoView(); facilityPage.getFacilityTotalDoctorCapacity().contains(totalDoctor); + // verify the delete functionality + cy.get("#manage-facility-dropdown button").scrollIntoView(); + facilityPage.clickManageFacilityDropdown(); + facilityPage.clickDeleteFacilityOption(); + facilityPage.confirmDeleteFacility(); + cy.verifyNotification("Facility deleted successfully"); }); it("Create a new facility with single bed and doctor capacity", () => { diff --git a/cypress/e2e/facility_spec/facility_manage.cy.ts b/cypress/e2e/facility_spec/facility_manage.cy.ts index 612a95001d6..c5f56f97170 100644 --- a/cypress/e2e/facility_spec/facility_manage.cy.ts +++ b/cypress/e2e/facility_spec/facility_manage.cy.ts @@ -161,15 +161,6 @@ describe("Facility Manage Functions", () => { ); }); - 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(); }); diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts index 6be99cf5758..f799197b7cb 100644 --- a/cypress/pageobject/Facility/FacilityCreation.ts +++ b/cypress/pageobject/Facility/FacilityCreation.ts @@ -289,9 +289,7 @@ class FacilityPage { } confirmDeleteFacility() { - cy.intercept("DELETE", "**/api/v1/facility/**").as("deleteFacility"); - cy.get("#submit").contains("Delete").click(); - cy.wait("@deleteFacility").its("response.statusCode").should("eq", 403); + cy.submitButton("Delete"); } selectLocation(location: string) {