Skip to content

Commit

Permalink
Merge pull request #7075 from coronasafe/develop
Browse files Browse the repository at this point in the history
Production Release | January Week 4
  • Loading branch information
gigincg authored Jan 22, 2024
2 parents d55143d + 446256d commit 2581c97
Show file tree
Hide file tree
Showing 50 changed files with 591 additions and 136 deletions.
6 changes: 3 additions & 3 deletions cypress/e2e/assets_spec/asset_homepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ describe("Asset Tab", () => {

it("Filter Asset", () => {
assetFilters.filterAssets(
"Dummy Facility 1",
"Dummy Facility 40",
"INTERNAL",
"ACTIVE",
"ONVIF Camera",
"Camera Loc"
);
assetFilters.clickadvancefilter();
assetFilters.clickslideoverbackbutton(); // to verify the back button doesn't clear applied filters
assetFilters.assertFacilityText("Dummy Facility 1");
assetFilters.assertFacilityText("Dummy Facility 40");
assetFilters.assertAssetTypeText("INTERNAL");
assetFilters.assertAssetClassText("ONVIF");
assetFilters.assertStatusText("ACTIVE");
Expand All @@ -89,7 +89,7 @@ describe("Asset Tab", () => {
it("Import new asset", () => {
assetPage.selectassetimportbutton();
assetPage.selectImportOption();
assetPage.selectImportFacility("Dummy Facility 1");
assetPage.selectImportFacility("Dummy Facility 40");
assetPage.importAssetFile();
assetPage.selectImportLocation("Camera Loc");
assetPage.clickImportAsset();
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/assets_spec/assets_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("Asset", () => {

it("Verify asset creation fields throws error if empty", () => {
assetPage.createAsset();
assetPage.selectFacility("Dummy Facility 1");
assetPage.selectFacility("Dummy Facility 40");
assetPage.clickCreateAsset();

assetPage.verifyEmptyAssetNameError();
Expand All @@ -39,7 +39,7 @@ describe("Asset", () => {

it("Create an Asset", () => {
assetPage.createAsset();
assetPage.selectFacility("Dummy Facility 1");
assetPage.selectFacility("Dummy Facility 40");
assetPage.selectLocation("Camera Loc");
assetPage.selectAssetType("Internal");
assetPage.selectAssetClass("ONVIF Camera");
Expand Down Expand Up @@ -139,7 +139,7 @@ describe("Asset", () => {

it("Add an vital monitor asset and configure it", () => {
assetPage.createAsset();
assetPage.selectFacility("Dummy Facility 1");
assetPage.selectFacility("Dummy Facility 40");
assetPage.selectLocation("Camera Loc");
assetPage.selectAssetType("Internal");
assetPage.selectAssetClass("HL7 Vitals Monitor");
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/assets_spec/assets_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("Asset", () => {
const facilityPage = new FacilityPage();
const assetSearchPage = new AssetSearchPage();
const assetFilters = new AssetFilters();
const fillFacilityName = "Dummy Facility 1";
const fillFacilityName = "Dummy Facility 40";
const assetname = "Dummy Camera";
const locationName = "Dummy Location 1";
const initiallocationName = "Camera Location";
Expand Down
3 changes: 1 addition & 2 deletions cypress/e2e/death_report_spec/death_report.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ describe("Death Report", () => {
beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/");
cy.awaitUrl("/patients");
cy.intercept("**/api/v1/patient/**").as("getPatients");
cy.get("#facility-patients").contains("Patients").click({ force: true });
cy.url().should("include", "/patients");
cy.wait("@getPatients").get("a[data-cy=patient]").first().click();
cy.url().then((url) => {
Expand Down
9 changes: 1 addition & 8 deletions cypress/e2e/facility_spec/facility_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("Facility Creation", () => {
const doctorCapacity = "5";
const totalDoctor = "10";
const facilityName = "cypress facility";
const facilityName2 = "Dummy Facility 1";
const facilityName2 = "Dummy Facility 40";
const facilityAddress = "cypress address";
const facilityUpdateAddress = "cypress updated address";
const facilityNumber = "9898469865";
Expand Down Expand Up @@ -297,13 +297,6 @@ describe("Facility Creation", () => {
facilityPage.verifySuccessNotification("Facility updated successfully");
});

it("Delete a facility", () => {
facilityPage.visitUpdateFacilityPage(facilityUrl1);
facilityPage.clickManageFacilityDropdown();
facilityPage.clickDeleteFacilityOption();
facilityPage.confirmDeleteFacility();
});

afterEach(() => {
cy.saveLocalStorage();
});
Expand Down
50 changes: 35 additions & 15 deletions cypress/e2e/facility_spec/facility_homepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ describe("Facility Homepage Function", () => {
const capacitiesAlias = "downloadCapacitiesCSV";
const doctorsAlias = "downloadDoctorsCSV";
const triagesAlias = "downloadTriagesCSV";
const facilityname = "Dummy Facility 1";
const statename = "Kerala";
const facilityName = "Dummy Facility 40";
const facilityLocaion = "Dummy Location";
const stateName = "Kerala";
const district = "Ernakulam";
const localbody = "Aikaranad";
const facilitytype = "Private Hospital";
const localBody = "Aikaranad";
const facilityType = "Private Hospital";

before(() => {
loginPage.loginAsDisctrictAdmin();
Expand Down Expand Up @@ -58,16 +59,16 @@ describe("Facility Homepage Function", () => {

it("Verify the functionality of advance filter", () => {
userPage.clickAdvancedFilters();
facilityPage.selectState(statename);
facilityPage.selectState(stateName);
facilityPage.selectDistrict(district);
facilityPage.selectLocalBody(localbody);
facilityPage.clickUpdateFacilityType(facilitytype);
facilityPage.selectLocalBody(localBody);
facilityPage.clickUpdateFacilityType(facilityType);
userPage.applyFilter();
facilityPage.verifyStateBadgeContent(statename);
facilityPage.verifyStateBadgeContent(stateName);
facilityPage.verifyDistrictBadgeContent(district);
facilityPage.verifyLocalBodyBadgeContent(localbody);
facilityPage.verifyFacilityTypeBadgeContent(facilitytype);
manageUserPage.assertFacilityInCard(facilityname);
facilityPage.verifyLocalBodyBadgeContent(localBody);
facilityPage.verifyFacilityTypeBadgeContent(facilityType);
manageUserPage.assertFacilityInCard(facilityName);
userPage.clearFilters();
userPage.verifyDataTestIdNotVisible("State");
userPage.verifyDataTestIdNotVisible("District");
Expand All @@ -80,10 +81,10 @@ describe("Facility Homepage Function", () => {
assetPagination.navigateToNextPage();
assetPagination.navigateToPreviousPage();
// search for a facility
manageUserPage.typeFacilitySearch(facilityname);
facilityPage.verifyFacilityBadgeContent(facilityname);
manageUserPage.assertFacilityInCard(facilityname);
facilityHome.verifyURLContains(facilityname);
manageUserPage.typeFacilitySearch(facilityName);
facilityPage.verifyFacilityBadgeContent(facilityName);
manageUserPage.assertFacilityInCard(facilityName);
facilityHome.verifyURLContains(facilityName);
});

it("Verify Facility Export Functionality", () => {
Expand Down Expand Up @@ -113,6 +114,25 @@ describe("Facility Homepage Function", () => {
facilityHome.clickSearchButton();
});

it("Verify Facility Detail page redirection to CNS and Live Minitoring ", () => {
userPage.clickAdvancedFilters();
facilityPage.selectState(stateName);
facilityPage.selectDistrict(district);
facilityPage.selectLocalBody(localBody);
userPage.applyFilter();
// go to cns page in the facility details page
manageUserPage.assertFacilityInCard(facilityName);
facilityHome.clickViewFacilityDetails();
facilityHome.clickFacilityCnsButton();
facilityHome.verifyCnsUrl();
facilityHome.navigateBack();
// go to live monitoring page in the facility details page
facilityHome.clickFacilityLiveMonitorButton();
facilityHome.selectLocation(facilityLocaion);
facilityHome.clickLiveMonitorButton();
facilityHome.verifyLiveMonitorUrl();
});

afterEach(() => {
cy.saveLocalStorage();
});
Expand Down
175 changes: 175 additions & 0 deletions cypress/e2e/facility_spec/facility_manage.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
import { cy, describe, before, beforeEach, it, afterEach } from "local-cypress";
import LoginPage from "../../pageobject/Login/LoginPage";
import FacilityManage from "../../pageobject/Facility/FacilityManage";
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import { v4 as uuidv4 } from "uuid";

describe("Facility Manage Functions", () => {
const loginPage = new LoginPage();
const facilityManage = new FacilityManage();
const facilityPage = new FacilityPage();
const facilityMiddlewareUpdateButton = "Update";
const facilityMiddleware = "dev-middleware.coronasafe.live";
const facilityUpdatedMiddleware = "updated.coronasafe.live";
const facilityMiddlewareSuccessfullNotification =
"Facility updated successfully";
const facilityHrfidUpdateButton = "Link Health Facility";
const facilityHrfidSuccessfullNotification =
"Health Facility config updated successfully";
const facilityHrfId = uuidv4();
const facilityUpdatedHrfId = uuidv4();
const doctorCapacity = "5";
const doctorModifiedCapacity = "7";
const totalCapacity = "100";
const currentOccupied = "80";
const totalUpdatedCapacity = "120";
const currentUpdatedOccupied = "100";

before(() => {
loginPage.loginAsDisctrictAdmin();
cy.saveLocalStorage();
});

beforeEach(() => {
cy.viewport(1280, 720);
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/");
facilityPage.visitAlreadyCreatedFacility();
});

it("Facility Cover Image button functionality", () => {
// It's only button functionality because we can't access S3 bucket in local
facilityManage.clickCoverImage();
facilityManage.verifyUploadButtonVisible();
facilityManage.uploadCoverImage("facilitycoverimage.jpg");
facilityManage.clickSaveCoverImage();
});

it("Configure Facility Middleware", () => {
facilityPage.clickManageFacilityDropdown();
facilityManage.clickFacilityConfigureButton();
facilityManage.verifyMiddlewareAddressVisible();
// verify mandatory field error message
facilityManage.clickButtonWithText(facilityMiddlewareUpdateButton);
facilityManage.checkErrorMessageVisibility(
"Middleware Address is required"
);
// add middleware and verify the notification
facilityManage.typeMiddlewareAddress(facilityMiddleware);
facilityManage.clickButtonWithText(facilityMiddlewareUpdateButton);
facilityManage.verifySuccessMessageVisibilityAndContent(
facilityMiddlewareSuccessfullNotification
);
// update the existing middleware
facilityPage.clickManageFacilityDropdown();
facilityManage.clickFacilityConfigureButton();
facilityManage.verifyMiddlewareAddressVisible();
facilityManage.typeMiddlewareAddress(facilityUpdatedMiddleware);
facilityManage.clickButtonWithText(facilityMiddlewareUpdateButton);
facilityManage.verifySuccessMessageVisibilityAndContent(
facilityMiddlewareSuccessfullNotification
);
// verify the updated middleware
facilityPage.clickManageFacilityDropdown();
facilityManage.clickFacilityConfigureButton();
facilityManage.verifyMiddlewareAddressValue(facilityUpdatedMiddleware);
});

it("Configure Facility Health ID", () => {
facilityPage.clickManageFacilityDropdown();
facilityManage.clickFacilityConfigureButton();
// verify mandatory field error message
facilityManage.clickButtonWithText(facilityHrfidUpdateButton);
facilityManage.checkErrorMessageVisibility(
"Health Facility Id is required"
);
// add facility health ID and verify notification
facilityManage.typeHrfId(facilityHrfId);
facilityManage.clickButtonWithText(facilityHrfidUpdateButton);
facilityManage.verifySuccessMessageVisibilityAndContent(
facilityHrfidSuccessfullNotification
);
// update the existing middleware
facilityPage.clickManageFacilityDropdown();
facilityManage.clickFacilityConfigureButton();
facilityManage.typeHrfId(facilityUpdatedHrfId);
facilityManage.clickButtonWithText(facilityHrfidUpdateButton);
facilityManage.verifySuccessMessageVisibilityAndContent(
facilityHrfidSuccessfullNotification
);
// verify its reflection
facilityPage.clickManageFacilityDropdown();
facilityManage.clickFacilityConfigureButton();
facilityManage.verifyHrfIdValue(facilityUpdatedHrfId);
});

it("Modify doctor capacity in Facility detail page", () => {
// Add a doctor capacity
facilityManage.clickFacilityAddDoctorTypeButton();
facilityPage.selectAreaOfSpecialization("General Medicine");
facilityPage.fillDoctorCount(doctorCapacity);
facilityPage.saveAndExitDoctorForm();
facilityManage.verifySuccessMessageVisibilityAndContent(
"Doctor count added successfully"
);
facilityManage.verifyTotalDoctorCapacity(doctorCapacity);
// edit a existing doctor
facilityManage.clickEditFacilityDoctorCapacity();
facilityPage.fillDoctorCount(doctorModifiedCapacity);
facilityPage.clickdoctorcapacityaddmore();
facilityManage.verifySuccessMessageVisibilityAndContent(
"Doctor count updated successfully"
);
facilityManage.verifyTotalDoctorCapacity(doctorModifiedCapacity);
// delete a bed
facilityManage.clickDeleteFacilityDoctorCapacity();
facilityManage.clickButtonWithText("Delete");
facilityManage.verifySuccessMessageVisibilityAndContent(
"Doctor specialization type deleted successfully"
);
});

it("Modify bed capacity in Facility detail page", () => {
// add multiple new bed capacity
facilityManage.clickFacilityAddBedTypeButton();
facilityPage.selectBedType("Oxygen beds");
facilityPage.fillTotalCapacity(totalCapacity);
facilityPage.fillCurrentlyOccupied(currentOccupied);
facilityPage.saveAndExitBedCapacityForm();
facilityManage.verifySuccessMessageVisibilityAndContent(
"Bed capacity added successfully"
);
facilityManage.verifyFacilityBedCapacity(totalCapacity);
facilityManage.verifyFacilityBedCapacity(currentOccupied);
// edit a existing bed
facilityManage.clickEditFacilityBedCapacity();
facilityPage.fillTotalCapacity(totalUpdatedCapacity);
facilityPage.fillCurrentlyOccupied(currentUpdatedOccupied);
facilityPage.clickbedcapcityaddmore();
facilityManage.verifySuccessMessageVisibilityAndContent(
"Bed capacity updated successfully"
);
facilityManage.verifyFacilityBedCapacity(totalUpdatedCapacity);
facilityManage.verifyFacilityBedCapacity(currentUpdatedOccupied);
// delete a bed
facilityManage.clickDeleteFacilityBedCapacity();
facilityManage.clickButtonWithText("Delete");
facilityManage.verifySuccessMessageVisibilityAndContent(
"Bed type deleted successfully"
);
});

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();
});
});
Loading

1 comment on commit 2581c97

@vercel
Copy link

@vercel vercel bot commented on 2581c97 Jan 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

care-storybook – ./

care-storybook-ohcnetwork.vercel.app
care-storybook-git-master-ohcnetwork.vercel.app

Please sign in to comment.