Skip to content

Commit

Permalink
Merge branch 'develop' into facility_delete
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 authored Nov 29, 2023
2 parents 8f796f5 + a18016b commit 452f7ba
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 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
6 changes: 3 additions & 3 deletions src/Components/Facility/Consultations/Feed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ export const Feed: React.FC<IFeedProps> = ({ consultationId, facilityId }) => {
const [isFullscreen, setFullscreen] = useFullscreen();
const [videoStartTime, setVideoStartTime] = useState<Date | null>(null);
const [statusReported, setStatusReported] = useState(false);
const [facilityMiddlewareHostname, setFacilityMiddlewareHostname] =
useState("");
const authUser = useAuthUser();

let facilityMiddlewareHostname = "";

useQuery(routes.getPermittedFacility, {
pathParams: { id: facilityId || "" },
onResponse: ({ res, data }) => {
if (res && res.status === 200 && data && data.middleware_address) {
facilityMiddlewareHostname = data.middleware_address;
setFacilityMiddlewareHostname(data.middleware_address);
}
},
});
Expand Down

0 comments on commit 452f7ba

Please sign in to comment.