diff --git a/README.md b/README.md index 002afc979bc..7f2c3e926bd 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=coronasafe_care_fe&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=coronasafe_care_fe) ![Code scanning - action](https://github.com/coronasafe/care_fe/workflows/Code%20scanning%20-%20action/badge.svg) ![OSSAR](https://github.com/coronasafe/care_fe/workflows/OSSAR/badge.svg) -[![Cypress Tests](https://github.com/coronasafe/care_fe/actions/workflows/cypress.yaml/badge.svg)](https://github.com/coronasafe/care_fe/actions/workflows/cypress.yaml) +[![Cypress Tests](https://img.shields.io/endpoint?url=https://cloud.cypress.io/badge/simple/wf7d2m/develop&style=flat&logo=cypress)](https://cloud.cypress.io/projects/wf7d2m/runs) ![Staging Release](https://github.com/coronasafe/care_fe/workflows/CARE%20Develop%20Registry/badge.svg) ![Production Release](https://github.com/coronasafe/care_fe/workflows/Production%20Release/badge.svg) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/200482ab117e4b5397ff3f5ae5719aa2)](https://www.codacy.com/gh/coronasafe/care_fe?utm_source=github.com&utm_medium=referral&utm_content=coronasafe/care_fe&utm_campaign=Badge_Grade) @@ -50,7 +50,7 @@ Once the development server has started, open [localhost:4000](http://localhost: Authenticate to staging API with any of the following credentials ```yaml -- username: devdistrictadmin +- username: dev-districtadmin password: Coronasafe@123 role: District Admin diff --git a/cypress/e2e/facility_spec/facility.cy.ts b/cypress/e2e/facility_spec/facility.cy.ts deleted file mode 100644 index f2ff847c9d9..00000000000 --- a/cypress/e2e/facility_spec/facility.cy.ts +++ /dev/null @@ -1,82 +0,0 @@ -// FacilityCreation -import { cy, describe, before, beforeEach, it, afterEach } from "local-cypress"; -import FacilityPage from "../../pageobject/Facility/FacilityCreation"; -import LoginPage from "../../pageobject/Login/LoginPage"; - -describe("Facility Creation", () => { - let facilityUrl: string; - const facilityPage = new FacilityPage(); - const loginPage = new LoginPage(); - - before(() => { - loginPage.loginAsDisctrictAdmin(); - cy.saveLocalStorage(); - }); - - beforeEach(() => { - cy.viewport(1280, 720); - cy.restoreLocalStorage(); - cy.awaitUrl("/facility"); - }); - - it("Create a new facility", () => { - facilityPage.visitCreateFacilityPage(); - facilityPage.fillFacilityName("cypress facility"); - facilityPage.fillPincode("682001"); - facilityPage.selectState("Kerala"); - facilityPage.selectDistrict("Ernakulam"); - facilityPage.selectLocalBody("Aluva"); - facilityPage.selectWard("4"); - facilityPage.fillAddress("Cypress Address"); - facilityPage.fillPhoneNumber("9898469865"); - facilityPage.submitForm(); - - facilityPage.selectBedType("Non-Covid Oxygen beds"); - facilityPage.fillTotalCapacity("10"); - facilityPage.fillCurrentlyOccupied("5"); - facilityPage.saveAndExitBedCapacityForm(); - - facilityPage.selectAreaOfSpecialization("General Medicine"); - facilityPage.fillDoctorCount("5"); - facilityPage.saveAndExitDoctorForm(); - facilityPage.verifyfacilitynewurl(); - cy.url().then((newUrl) => { - facilityUrl = newUrl; - }); - }); - - it("Update the existing facility", () => { - facilityPage.visitUpdateFacilityPage(facilityUrl); - facilityPage.clickManageFacilityDropdown(); - facilityPage.clickUpdateFacilityOption(); - facilityPage.clickUpdateFacilityType(); - facilityPage.fillFacilityName("cypress facility updated"); - facilityPage.fillAddress("Cypress Facility Updated Address"); - facilityPage.fillOxygenCapacity("100"); - facilityPage.fillExpectedOxygenRequirement("80"); - facilityPage.selectLocation("Kochi, Kerala"); - facilityPage.submitForm(); - - cy.url().should("not.include", "/update"); - }); - - it("Configure the existing facility", () => { - facilityPage.visitUpdateFacilityPage(facilityUrl); - facilityPage.clickManageFacilityDropdown(); - facilityPage.clickConfigureFacilityOption(); - facilityPage.fillMiddleWareAddress("dev_middleware.coronasafe.live"); - facilityPage.clickupdateMiddleWare(); - facilityPage.verifySuccessNotification("Facility updated successfully"); - }); - - it("Delete a facility", () => { - facilityPage.visitUpdateFacilityPage(facilityUrl); - facilityPage.clickManageFacilityDropdown(); - facilityPage.clickDeleteFacilityOption(); - facilityPage.confirmDeleteFacility(); - }); - - afterEach(() => { - cy.saveLocalStorage(); - }); -}); diff --git a/cypress/e2e/facility_spec/facility_creation.cy.ts b/cypress/e2e/facility_spec/facility_creation.cy.ts new file mode 100644 index 00000000000..d43aa093a69 --- /dev/null +++ b/cypress/e2e/facility_spec/facility_creation.cy.ts @@ -0,0 +1,245 @@ +// FacilityCreation +import { cy, describe, before, beforeEach, it, afterEach } from "local-cypress"; +import FacilityPage from "../../pageobject/Facility/FacilityCreation"; +import LoginPage from "../../pageobject/Login/LoginPage"; +import FacilityHome from "../../pageobject/Facility/FacilityHome"; +import ManageUserPage from "../../pageobject/Users/ManageUserPage"; +import { UserCreationPage } from "../../pageobject/Users/UserCreation"; + +describe("Facility Creation", () => { + let facilityUrl1: string; + const facilityPage = new FacilityPage(); + const loginPage = new LoginPage(); + const facilityHome = new FacilityHome(); + const manageUserPage = new ManageUserPage(); + const userCreationPage = new UserCreationPage(); + const facilityFeature = [ + "CT Scan", + "X-Ray", + "Maternity Care", + "Neonatal Care", + "Operation Theater", + "Blood Bank", + ]; + const bedCapacity = "10"; + const bedOccupancy = "5"; + const oxygenCapacity = "100"; + const oxygenExpected = "80"; + const totalCapacity = "20"; + const totalOccupancy = "10"; + const doctorCapacity = "5"; + const totalDoctor = "10"; + const facilityName = "cypress facility"; + const facilityAddress = "cypress address"; + const facilityNumber = "9898469865"; + const facilityErrorMessage = [ + "Required", + "Invalid Pincode", + "Required", + "Required", + "Required", + "Required", + "Required", + "Required", + "Invalid Phone Number", + ]; + const bedErrorMessage = [ + "Field is required", + "Total capacity cannot be 0", + "Field is required", + ]; + const doctorErrorMessage = ["Field is required", "Field is required"]; + + before(() => { + loginPage.loginAsDisctrictAdmin(); + cy.saveLocalStorage(); + }); + + beforeEach(() => { + cy.viewport(1280, 720); + cy.restoreLocalStorage(); + cy.awaitUrl("/facility"); + }); + + it("Create a new facility with multiple bed and doctor capacity", () => { + // create facility with multiple capacity and verify form error message for facility form + facilityPage.visitCreateFacilityPage(); + facilityPage.submitForm(); + userCreationPage.verifyErrorMessages(facilityErrorMessage); + facilityPage.fillFacilityName(facilityName); + facilityPage.clickfacilityfeatureoption(); + facilityFeature.forEach((featureText) => { + cy.get("[role='option']").contains(featureText).click(); + }); + facilityPage.fillPincode("682001"); + facilityPage.selectLocalBody("Aluva"); + facilityPage.selectWard("4"); + facilityPage.fillAddress(facilityAddress); + facilityPage.fillPhoneNumber(facilityNumber); + facilityPage.fillOxygenCapacity(oxygenCapacity); + facilityPage.fillExpectedOxygenRequirement(oxygenExpected); + facilityPage.fillBTypeCylinderCapacity(oxygenCapacity); + facilityPage.fillExpectedBTypeCylinderRequirement(oxygenExpected); + facilityPage.fillCTypeCylinderCapacity(oxygenCapacity); + facilityPage.fillExpectedCTypeCylinderRequirement(oxygenExpected); + facilityPage.fillDTypeCylinderCapacity(oxygenCapacity); + facilityPage.fillExpectedDTypeCylinderRequirement(oxygenExpected); + facilityPage.selectLocation("Kochi, Kerala"); + facilityPage.submitForm(); + // create multiple bed capacity and verify card reflection + facilityPage.selectBedType("Oxygen beds"); + facilityPage.fillTotalCapacity(bedCapacity); + facilityPage.fillCurrentlyOccupied(bedOccupancy); + facilityPage.clickbedcapcityaddmore(); + facilityPage.selectBedType("Ordinary Bed"); + facilityPage.fillTotalCapacity(bedCapacity); + facilityPage.fillCurrentlyOccupied(bedOccupancy); + facilityPage.clickbedcapcityaddmore(); + facilityPage.getTotalBedCapacity().contains(totalCapacity); + facilityPage.getTotalBedCapacity().contains(totalOccupancy); + facilityPage.clickcancelbutton(); + // create multiple bed capacity and verify card reflection + facilityPage.selectAreaOfSpecialization("General Medicine"); + facilityPage.fillDoctorCount(doctorCapacity); + facilityPage.clickdoctorcapacityaddmore(); + facilityPage.selectAreaOfSpecialization("Pulmonology"); + facilityPage.fillDoctorCount(doctorCapacity); + facilityPage.clickdoctorcapacityaddmore(); + facilityPage.getTotalDoctorCapacity().contains(doctorCapacity); + facilityPage.clickcancelbutton(); + facilityPage.verifyfacilitynewurl(); + // verify the facility card + facilityPage.getFacilityName().contains(facilityName).should("be.visible"); + facilityPage + .getAddressDetailsView() + .contains(facilityAddress) + .should("be.visible"); + facilityPage + .getPhoneNumberView() + .contains(facilityNumber) + .should("be.visible"); + facilityPage + .getFacilityAvailableFeatures() + .invoke("text") + .then((text) => { + facilityFeature.forEach((feature) => { + expect(text).to.contain(feature); + }); + }); + facilityPage.getFacilityOxygenInfo().scrollIntoView(); + facilityPage + .getFacilityOxygenInfo() + .contains(oxygenCapacity) + .should("be.visible"); + facilityPage.getFacilityTotalBedCapacity().scrollIntoView(); + facilityPage.getFacilityTotalBedCapacity().contains(totalCapacity); + facilityPage.getFacilityTotalBedCapacity().contains(totalOccupancy); + facilityPage.getFacilityTotalDoctorCapacity().scrollIntoView(); + facilityPage.getFacilityTotalDoctorCapacity().contains(totalDoctor); + }); + + it("Create a new facility with single bed and doctor capacity", () => { + facilityPage.visitCreateFacilityPage(); + facilityPage.fillFacilityName(facilityName); + facilityPage.fillPincode("682001"); + facilityPage.selectLocalBody("Aluva"); + facilityPage.selectWard("4"); + facilityPage.fillAddress(facilityAddress); + facilityPage.fillPhoneNumber(facilityNumber); + facilityPage.submitForm(); + // add the bed capacity + facilityPage.selectBedType("Oxygen beds"); + facilityPage.fillTotalCapacity(oxygenCapacity); + facilityPage.fillCurrentlyOccupied(oxygenExpected); + facilityPage.saveAndExitBedCapacityForm(); + // add the doctor capacity + facilityPage.selectAreaOfSpecialization("General Medicine"); + facilityPage.fillDoctorCount(doctorCapacity); + facilityPage.saveAndExitDoctorForm(); + facilityPage.verifyfacilitynewurl(); + // verify the created facility details + facilityPage.getFacilityName().contains(facilityName).should("be.visible"); + facilityPage + .getAddressDetailsView() + .contains(facilityAddress) + .should("be.visible"); + facilityPage + .getPhoneNumberView() + .contains(facilityNumber) + .should("be.visible"); + // verify the facility homepage + cy.visit("/facility"); + manageUserPage.typeFacilitySearch(facilityName); + facilityPage.verifyFacilityBadgeContent(facilityName); + manageUserPage.assertFacilityInCard(facilityName); + facilityHome.verifyURLContains(facilityName); + }); + + it("Create a new facility with no bed and doctor capacity", () => { + facilityPage.visitCreateFacilityPage(); + facilityPage.fillFacilityName(facilityName); + facilityPage.fillPincode("682001"); + facilityPage.selectLocalBody("Aluva"); + facilityPage.selectWard("4"); + facilityPage.fillAddress(facilityAddress); + facilityPage.fillPhoneNumber(facilityNumber); + facilityPage.submitForm(); + // add no bed capacity and verify form error message + facilityPage.isVisibleselectBedType(); + facilityPage.saveAndExitBedCapacityForm(); + userCreationPage.verifyErrorMessages(bedErrorMessage); + facilityPage.clickcancelbutton(); + // add no doctor capacity and verify form error message + facilityPage.isVisibleAreaOfSpecialization(); + facilityPage.clickdoctorcapacityaddmore(); + userCreationPage.verifyErrorMessages(doctorErrorMessage); + facilityPage.clickcancelbutton(); + cy.url().then((newUrl) => { + facilityUrl1 = newUrl; + }); + // verify the created facility details + facilityPage.getFacilityName().contains(facilityName).should("be.visible"); + facilityPage + .getAddressDetailsView() + .contains(facilityAddress) + .should("be.visible"); + facilityPage + .getPhoneNumberView() + .contains(facilityNumber) + .should("be.visible"); + }); + + it("Update the existing facility", () => { + facilityPage.visitUpdateFacilityPage(facilityUrl1); + facilityPage.clickManageFacilityDropdown(); + facilityPage.clickUpdateFacilityOption(); + facilityPage.clickUpdateFacilityType("Request Approving Center"); + facilityPage.fillFacilityName("cypress facility updated"); + facilityPage.fillAddress("Cypress Facility Updated Address"); + facilityPage.fillOxygenCapacity("100"); + facilityPage.fillExpectedOxygenRequirement("80"); + facilityPage.selectLocation("Kochi, Kerala"); + facilityPage.submitForm(); + cy.url().should("not.include", "/update"); + }); + + it("Configure the existing facility", () => { + facilityPage.visitUpdateFacilityPage(facilityUrl1); + facilityPage.clickManageFacilityDropdown(); + facilityPage.clickConfigureFacilityOption(); + facilityPage.fillMiddleWareAddress("dev_middleware.coronasafe.live"); + facilityPage.clickupdateMiddleWare(); + facilityPage.verifySuccessNotification("Facility updated successfully"); + }); + + it("Delete a facility", () => { + facilityPage.visitUpdateFacilityPage(facilityUrl1); + facilityPage.clickManageFacilityDropdown(); + facilityPage.clickDeleteFacilityOption(); + facilityPage.confirmDeleteFacility(); + }); + + afterEach(() => { + cy.saveLocalStorage(); + }); +}); diff --git a/cypress/e2e/facility_spec/facility_homepage.cy.ts b/cypress/e2e/facility_spec/facility_homepage.cy.ts new file mode 100644 index 00000000000..3d916b4ba47 --- /dev/null +++ b/cypress/e2e/facility_spec/facility_homepage.cy.ts @@ -0,0 +1,88 @@ +// FacilityCreation +import { cy, describe, before, beforeEach, it, afterEach } from "local-cypress"; +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 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(); + cy.saveLocalStorage(); + }); + + beforeEach(() => { + cy.restoreLocalStorage(); + 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); + manageUserPage.assertFacilityInCard(facilityname); + facilityHome.verifyURLContains(facilityname); + }); + + it("Verify Facility Export Functionality", () => { + // Download the Facilities CSV + facilityHome.csvDownloadIntercept(facilitiesAlias, ""); + facilityHome.clickExportButton(); + facilityHome.clickMenuItem("Facilities"); + facilityHome.verifyDownload(facilitiesAlias); + facilityHome.clickSearchButton(); // to avoid flaky test, as sometimes, the test is unable to focus on the object + // Download the Capacities CSV + facilityHome.csvDownloadIntercept(capacitiesAlias, "&capacity"); + facilityHome.clickExportButton(); + facilityHome.clickMenuItem("Capacities"); + facilityHome.verifyDownload(capacitiesAlias); + facilityHome.clickSearchButton(); + // Download the Doctors CSV + facilityHome.csvDownloadIntercept(doctorsAlias, "&doctors"); + facilityHome.clickExportButton(); + facilityHome.clickMenuItem("Doctors"); + facilityHome.verifyDownload(doctorsAlias); + facilityHome.clickSearchButton(); + // Download the Triages CSV + facilityHome.csvDownloadIntercept(triagesAlias, "&triage"); + facilityHome.clickExportButton(); + facilityHome.clickMenuItem("Triages"); + facilityHome.verifyDownload(triagesAlias); + facilityHome.clickSearchButton(); + }); + + afterEach(() => { + cy.saveLocalStorage(); + }); +}); diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts index d27433f04e7..b4d3808d645 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(); }); } @@ -70,6 +70,10 @@ class FacilityPage { cy.get("[role='option']").contains(bedType).click(); } + isVisibleselectBedType() { + cy.get("div#bed-type button").should("be.visible"); + } + fillTotalCapacity(capacity: string) { cy.get("input#total-capacity").click().type(capacity); } @@ -87,6 +91,10 @@ class FacilityPage { cy.get("[role='option']").contains(area).click(); } + isVisibleAreaOfSpecialization() { + cy.get("div#area-of-specialization button").should("be.visible"); + } + fillDoctorCount(count: string) { cy.get("input#count").click().type(count); } @@ -99,6 +107,33 @@ class FacilityPage { cy.get("#expected_oxygen_requirement").click().clear().type(requirement); } + fillBTypeCylinderCapacity(capacity: string) { + cy.get("#type_b_cylinders").click().clear().type(capacity); + } + + fillExpectedBTypeCylinderRequirement(requirement: string) { + cy.get("#expected_type_b_cylinders").focus().clear(); + cy.get("#expected_type_b_cylinders").focus().type(requirement); + } + + fillCTypeCylinderCapacity(capacity: string) { + cy.get("#type_c_cylinders").click().clear().type(capacity); + } + + fillExpectedCTypeCylinderRequirement(requirement: string) { + cy.get("#expected_type_c_cylinders").focus().clear(); + cy.get("#expected_type_c_cylinders").focus().type(requirement); + } + + fillDTypeCylinderCapacity(capacity: string) { + cy.get("#type_d_cylinders").click().clear().type(capacity); + } + + fillExpectedDTypeCylinderRequirement(requirement: string) { + cy.get("#expected_type_d_cylinders").focus().clear(); + cy.get("#expected_type_d_cylinders").focus().type(requirement); + } + saveAndExitDoctorForm() { cy.intercept("GET", "**/api/v1/facility/**").as("createFacilities"); cy.get("button#save-and-exit").click(); @@ -138,6 +173,42 @@ class FacilityPage { cy.get("#inventory-management").click(); } + getTotalBedCapacity() { + return cy.get("#total-bed-capacity"); + } + + getFacilityTotalBedCapacity() { + return cy.get("#facility-bed-capacity-details"); + } + + getFacilityTotalDoctorCapacity() { + return cy.get("#facility-doctor-capacity-details"); + } + + getTotalDoctorCapacity() { + return cy.get("#total-doctor-capacity"); + } + + getFacilityName() { + return cy.get("#facility-name"); + } + + getAddressDetailsView() { + return cy.get("#address-details-view"); + } + + getPhoneNumberView() { + return cy.get("#phone-number-view"); + } + + getFacilityAvailableFeatures() { + return cy.get("#facility-available-features"); + } + + getFacilityOxygenInfo() { + return cy.get("#facility-oxygen-info"); + } + clickResourceRequestOption() { cy.get("#resource-request").contains("Resource Request").click(); } @@ -146,6 +217,22 @@ class FacilityPage { cy.get("#delete-facility").contains("Delete Facility").click(); } + clickfacilityfeatureoption() { + cy.get("#features").click(); + } + + clickbedcapcityaddmore() { + cy.get("#bed-capacity-save").click(); + } + + clickdoctorcapacityaddmore() { + cy.get("#doctor-save").click(); + } + + clickcancelbutton() { + cy.get("#cancel").click(); + } + verifyfacilitynewurl() { cy.url().should("match", /facility\/[a-z\d-]+/); } @@ -195,6 +282,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"); } diff --git a/cypress/pageobject/Facility/FacilityHome.ts b/cypress/pageobject/Facility/FacilityHome.ts new file mode 100644 index 00000000000..04dfe94d002 --- /dev/null +++ b/cypress/pageobject/Facility/FacilityHome.ts @@ -0,0 +1,40 @@ +// cypress/support/pageObjects/FacilityHome.ts + +class FacilityHome { + // Selectors + exportButton = "#export-button"; + searchButton = "#search"; + menuItem = "[role='menuitem']"; + + // Operations + clickExportButton() { + cy.get(this.exportButton).click(); + } + + clickSearchButton() { + cy.get(this.searchButton).click(); + } + + clickMenuItem(itemName: string) { + cy.get(this.menuItem).contains(itemName).click(); + } + + csvDownloadIntercept(alias: string, queryParam: string) { + cy.intercept("GET", `**/api/v1/facility/?csv${queryParam}`).as(alias); + } + + verifyDownload(alias: string) { + cy.wait(`@${alias}`).its("response.statusCode").should("eq", 200); + } + + getURL() { + return cy.url(); + } + + verifyURLContains(searchText) { + const encodedText = encodeURIComponent(searchText).replace(/%20/g, "+"); + this.getURL().should("include", `search=${encodedText}`); + } +} + +export default FacilityHome; diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts index 4fb299a4965..26d75feba2e 100644 --- a/cypress/pageobject/Patient/PatientConsultation.ts +++ b/cypress/pageobject/Patient/PatientConsultation.ts @@ -203,7 +203,6 @@ export class PatientConsultationPage { } addDoctorsNotes(notes: string) { - cy.get("#expand_doctor_notes").click(); cy.get("#doctor_notes_textarea").type(notes); } @@ -214,7 +213,8 @@ export class PatientConsultationPage { } clickDischargePatient() { - cy.get("#discharge_patient_from_care").click(); + cy.get("#show-more").click(); + cy.contains("p", "Discharge from CARE").click(); } selectDischargeReason(reason: string) { diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx index 065e7ccd759..069a39e1539 100644 --- a/src/Common/constants.tsx +++ b/src/Common/constants.tsx @@ -213,10 +213,10 @@ export const getBedTypes = ({ : []; return [ - { id: 1, text: "Non-Covid Ordinary Beds" }, - { id: 150, text: "Non-Covid Oxygen beds" }, - { id: 10, text: "Non-Covid ICU (ICU without ventilator)" }, - { id: 20, text: "Non-Covid Ventilator (ICU with ventilator)" }, + { id: 1, text: "Ordinary Beds" }, + { id: 150, text: "Oxygen beds" }, + { id: 10, text: "ICU (ICU without ventilator)" }, + { id: 20, text: "Ventilator (ICU with ventilator)" }, { id: 30, text: "Covid Ordinary Beds" }, { id: 120, text: "Covid Oxygen beds" }, { id: 110, text: "Covid ICU (ICU without ventilator)" }, diff --git a/src/Common/utils.tsx b/src/Common/utils.tsx index 270e2f5efe6..3596469a6d5 100644 --- a/src/Common/utils.tsx +++ b/src/Common/utils.tsx @@ -44,16 +44,6 @@ export const parseOptionId: ( return textArray.join(", "); }; -export const getDimensionOrDash = ( - value: number | string | null | undefined, - unit: string -) => { - if (value === undefined || value === null || value === 0 || value === "0") { - return "-"; - } - return value + unit; -}; - export const deepEqual = (x: any, y: any): boolean => { if (x === y) return true; diff --git a/src/Components/ABDM/ConfigureHealthFacility.tsx b/src/Components/ABDM/ConfigureHealthFacility.tsx index a84e4b6d4b9..bccf58e47c2 100644 --- a/src/Components/ABDM/ConfigureHealthFacility.tsx +++ b/src/Components/ABDM/ConfigureHealthFacility.tsx @@ -178,7 +178,7 @@ export const ConfigureHealthFacility = (props: any) => { > {state.form.health_facility?.registered ? ( <> -