Skip to content

Commit

Permalink
facility advance filter (#6736)
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 authored Nov 29, 2023
1 parent 9b2d947 commit a18016b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/facility_spec/facility.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
24 changes: 23 additions & 1 deletion cypress/e2e/facility_spec/facility_homepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand Down
16 changes: 14 additions & 2 deletions cypress/pageobject/Facility/FacilityCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
}

Expand Down Expand Up @@ -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");
}
Expand Down

0 comments on commit a18016b

Please sign in to comment.