diff --git a/cypress/e2e/facility_spec/facility.cy.ts b/cypress/e2e/facility_spec/facility.cy.ts index 5ae5d7cb9db..da06c65ed53 100644 --- a/cypress/e2e/facility_spec/facility.cy.ts +++ b/cypress/e2e/facility_spec/facility.cy.ts @@ -49,7 +49,7 @@ describe("Facility Creation", () => { facilityPage.visitUpdateFacilityPage(facilityUrl); facilityPage.clickManageFacilityDropdown(); facilityPage.clickUpdateFacilityOption(); - facilityPage.clickUpdateFacilityType(); + facilityPage.clickUpdateFacilityType("Request Approving Center"); facilityPage.fillFacilityName("cypress facility updated"); facilityPage.fillAddress("Cypress Facility Updated Address"); facilityPage.fillOxygenCapacity("100"); diff --git a/cypress/e2e/facility_spec/facility_homepage.cy.ts b/cypress/e2e/facility_spec/facility_homepage.cy.ts index bf6ce12536e..3d916b4ba47 100644 --- a/cypress/e2e/facility_spec/facility_homepage.cy.ts +++ b/cypress/e2e/facility_spec/facility_homepage.cy.ts @@ -4,17 +4,22 @@ import LoginPage from "../../pageobject/Login/LoginPage"; import FacilityHome from "../../pageobject/Facility/FacilityHome"; import ManageUserPage from "../../pageobject/Users/ManageUserPage"; import FacilityPage from "../../pageobject/Facility/FacilityCreation"; +import { UserPage } from "../../pageobject/Users/UserSearch"; -describe("Facility Creation", () => { +describe("Facility Homepage Function", () => { const loginPage = new LoginPage(); const facilityHome = new FacilityHome(); const facilityPage = new FacilityPage(); const manageUserPage = new ManageUserPage(); + const userPage = new UserPage(); const facilitiesAlias = "downloadFacilitiesCSV"; const capacitiesAlias = "downloadCapacitiesCSV"; const doctorsAlias = "downloadDoctorsCSV"; const triagesAlias = "downloadTriagesCSV"; const facilityname = "Dummy Facility 1"; + const statename = "Kerala"; + const district = "Ernakulam"; + const facilitytype = "Private Hospital"; before(() => { loginPage.loginAsDisctrictAdmin(); @@ -26,6 +31,23 @@ describe("Facility Creation", () => { cy.awaitUrl("/facility"); }); + it("Verify the functionality of advance filter", () => { + userPage.clickAdvancedFilters(); + facilityPage.selectState(statename); + facilityPage.selectDistrict(district); + // facilityPage.selectLocalBody("Anthikad Grama"); current dummy data have issue in local body + facilityPage.clickUpdateFacilityType(facilitytype); + userPage.applyFilter(); + facilityPage.verifyStateBadgeContent(statename); + facilityPage.verifyDistrictBadgeContent(district); + facilityPage.verifyFacilityTypeBadgeContent(facilitytype); + manageUserPage.assertFacilityInCard(facilityname); + userPage.clearFilters(); + userPage.verifyDataTestIdNotVisible("State"); + userPage.verifyDataTestIdNotVisible("District"); + userPage.verifyDataTestIdNotVisible("Facility type"); + }); + it("Search a facility in homepage", () => { manageUserPage.typeFacilitySearch(facilityname); facilityPage.verifyFacilityBadgeContent(facilityname); diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts index d27433f04e7..8c20b808c98 100644 --- a/cypress/pageobject/Facility/FacilityCreation.ts +++ b/cypress/pageobject/Facility/FacilityCreation.ts @@ -17,11 +17,11 @@ class FacilityPage { cy.get("#manage-facility-dropdown button").should("be.visible"); } - clickUpdateFacilityType() { + clickUpdateFacilityType(facilityType) { cy.get("#facility_type") .click() .then(() => { - cy.get("[role='option']").contains("Request Approving Center").click(); + cy.get("[role='option']").contains(facilityType).click(); }); } @@ -195,6 +195,18 @@ class FacilityPage { ); } + verifyStateBadgeContent(expectedText: string) { + cy.get("[data-testid='State']").should("contain", expectedText); + } + + verifyDistrictBadgeContent(expectedText: string) { + cy.get("[data-testid='District']").should("contain", expectedText); + } + + verifyFacilityTypeBadgeContent(expectedText: string) { + cy.get("[data-testid='Facility type']").should("contain", expectedText); + } + verifyfacilitycreateassetredirection() { cy.url().should("include", "/assets/new"); }