Skip to content

Commit

Permalink
Merge pull request #9204 from ohcnetwork/staging
Browse files Browse the repository at this point in the history
Production Release v24.48.0
  • Loading branch information
gigincg authored Nov 25, 2024
2 parents b247dbe + 30739f1 commit 2a8a4a2
Show file tree
Hide file tree
Showing 84 changed files with 1,699 additions and 800 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/cypress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ jobs:
group: "UI-Chrome"
env:
CYPRESS_SPLIT_TESTS: "true"
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: --max_old_space_size=4096
COMMIT_INFO_MESSAGE: ${{github.event.pull_request.title}}
Expand All @@ -133,7 +132,7 @@ jobs:

- name: Upload cypress videos 📹
uses: actions/upload-artifact@v3
if: steps.pr_origin.outputs.is_forked == 'true'
if: ${{ failure() && steps.pr_origin.outputs.is_forked == 'true' }}
with:
name: cypress-videos
path: cypress/videos
5 changes: 4 additions & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { defineConfig } from "cypress";
import cypressSplit from "cypress-split";
import * as dotenv from "dotenv";
import fs from "fs";

dotenv.config();

export default defineConfig({
projectId: "wf7d2m",
defaultCommandTimeout: 10000,
Expand Down Expand Up @@ -32,7 +35,7 @@ export default defineConfig({
requestTimeout: 15000,
},
env: {
API_URL: process.env.REACT_CARE_API_URL ?? "http://localhost:9000",
API_URL: process.env.REACT_CARE_API_URL,
ENABLE_HCX: process.env.REACT_ENABLE_HCX ?? false,
},
});
16 changes: 8 additions & 8 deletions cypress/e2e/assets_spec/AssetHomepage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { advanceFilters } from "pageobject/utils/advanceFilterHelpers";
import { pageNavigation } from "pageobject/utils/paginationHelpers";
import { v4 as uuidv4 } from "uuid";

import { AssetPage } from "../../pageobject/Asset/AssetCreation";
import { AssetFilters } from "../../pageobject/Asset/AssetFilters";
import { AssetPagination } from "../../pageobject/Asset/AssetPagination";
import { AssetQRScanPage } from "../../pageobject/Asset/AssetQRScan";
import { AssetSearchPage } from "../../pageobject/Asset/AssetSearch";
import LoginPage from "../../pageobject/Login/LoginPage";

describe("Asset Tab", () => {
const assetSearchPage = new AssetSearchPage();
const assetQRScanPage = new AssetQRScanPage();
const assetPagination = new AssetPagination();
const assetFilters = new AssetFilters();
const assetPage = new AssetPage();
const loginPage = new LoginPage();
Expand Down Expand Up @@ -65,23 +65,23 @@ describe("Asset Tab", () => {
"ONVIF Camera",
"Camera Loc",
);
assetFilters.clickadvancefilter();
advanceFilters.clickAdvancedFiltersButton();
assetFilters.clickslideoverbackbutton(); // to verify the back button doesn't clear applied filters
assetFilters.assertFacilityText("Dummy Facility 40");
assetFilters.assertAssetClassText("ONVIF");
assetFilters.assertStatusText("ACTIVE");
assetFilters.assertLocationText("Camera Loc");
assetFilters.clickadvancefilter();
advanceFilters.clickAdvancedFiltersButton();
assetFilters.clearFilters();
});

// Verify the pagination in the page

it("Next/Previous Page", () => {
assetPagination.navigateToNextPage();
assetPagination.verifyNextUrl();
assetPagination.navigateToPreviousPage();
assetPagination.verifyPreviousUrl();
pageNavigation.navigateToNextPage();
pageNavigation.verifyCurrentPageNumber(2);
pageNavigation.navigateToPreviousPage();
pageNavigation.verifyCurrentPageNumber(1);
});

it("Import new asset", () => {
Expand Down
42 changes: 38 additions & 4 deletions cypress/e2e/facility_spec/FacilityCreation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ describe("Facility Creation", () => {
"This field is required",
];
const triageErrorMessage = ["This field is required"];
const facilityType = "Primary Health Centres";

before(() => {
loginPage.loginAsDistrictAdmin();
Expand Down Expand Up @@ -117,7 +118,7 @@ describe("Facility Creation", () => {
facilityPage.submitForm();
userCreationPage.verifyErrorMessages(facilityErrorMessage);
facilityPage.fillFacilityName(facilityName);
facilityPage.clickUpdateFacilityType("Primary Health Centres");
facilityPage.selectFacilityType(facilityType);
facilityPage.clickfacilityfeatureoption();
facilityFeature.forEach((featureText) => {
cy.get("[role='option']").contains(featureText).click();
Expand Down Expand Up @@ -206,7 +207,7 @@ describe("Facility Creation", () => {
it("Create a new facility with single bed and doctor capacity", () => {
facilityPage.visitCreateFacilityPage();
facilityPage.fillFacilityName(facilityName);
facilityPage.clickUpdateFacilityType("Primary Health Centres");
facilityPage.selectFacilityType(facilityType);
facilityPage.fillPincode("682001");
facilityPage.selectStateOnPincode("Kerala");
facilityPage.selectDistrictOnPincode("Ernakulam");
Expand Down Expand Up @@ -246,7 +247,7 @@ describe("Facility Creation", () => {
it("Create a new facility with no bed and doctor capacity", () => {
facilityPage.visitCreateFacilityPage();
facilityPage.fillFacilityName(facilityName);
facilityPage.clickUpdateFacilityType("Primary Health Centres");
facilityPage.selectFacilityType(facilityType);
facilityPage.fillPincode("682001");
facilityPage.selectStateOnPincode("Kerala");
facilityPage.selectDistrictOnPincode("Ernakulam");
Expand Down Expand Up @@ -285,7 +286,7 @@ describe("Facility Creation", () => {
facilityPage.visitUpdateFacilityPage(facilityUrl1);
facilityPage.clickManageFacilityDropdown();
facilityPage.clickUpdateFacilityOption();
facilityPage.clickUpdateFacilityType("Primary Health Centres");
facilityPage.selectFacilityType(facilityType);
facilityPage.fillAddress(facilityUpdateAddress);
facilityPage.fillOxygenCapacity(oxygenCapacity);
facilityPage.fillExpectedOxygenRequirement(oxygenExpected);
Expand Down Expand Up @@ -316,6 +317,39 @@ describe("Facility Creation", () => {
);
});

it("Should display error when district admin tries to create facility in a different district", () => {
facilityPage.visitCreateFacilityPage();
facilityPage.fillFacilityName(facilityName);
facilityPage.selectFacilityType(facilityType);
facilityPage.fillPincode("682001");
facilityPage.selectStateOnPincode("Kerala");
facilityPage.selectDistrictOnPincode("Kottayam");
facilityPage.selectLocalBody("Arpookara");
facilityPage.selectWard("5");
facilityPage.fillAddress(facilityAddress);
facilityPage.fillPhoneNumber(facilityNumber);
facilityPage.submitForm();
facilityPage.verifyErrorNotification(
"You do not have permission to perform this action.",
);
});

it("Access Restriction for Non-Admin Users to facility creation page", () => {
const nonAdminLoginMethods = [
loginPage.loginAsDevDoctor.bind(loginPage),
loginPage.loginAsStaff.bind(loginPage),
];

nonAdminLoginMethods.forEach((loginMethod) => {
loginMethod();
cy.visit("/facility/create");
facilityPage.verifyErrorNotification(
"You don't have permission to perform this action. Contact the admin",
);
cy.clearCookies();
});
});

afterEach(() => {
cy.saveLocalStorage();
});
Expand Down
42 changes: 22 additions & 20 deletions cypress/e2e/facility_spec/FacilityHomepage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// FacilityCreation
import { AssetPagination } from "../../pageobject/Asset/AssetPagination";
import { pageNavigation } from "pageobject/utils/paginationHelpers";

import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import FacilityHome from "../../pageobject/Facility/FacilityHome";
import FacilityNotify from "../../pageobject/Facility/FacilityNotify";
import LoginPage from "../../pageobject/Login/LoginPage";
import ManageUserPage from "../../pageobject/Users/ManageUserPage";
import { UserPage } from "../../pageobject/Users/UserSearch";
import { advanceFilters } from "../../pageobject/utils/advanceFilterHelpers";

describe("Facility Homepage Function", () => {
const loginPage = new LoginPage();
Expand All @@ -14,7 +16,6 @@ describe("Facility Homepage Function", () => {
const facilityPage = new FacilityPage();
const manageUserPage = new ManageUserPage();
const userPage = new UserPage();
const assetPagination = new AssetPagination();
const facilitiesAlias = "downloadFacilitiesCSV";
const doctorsAlias = "downloadDoctorsCSV";
const triagesAlias = "downloadTriagesCSV";
Expand Down Expand Up @@ -61,18 +62,19 @@ describe("Facility Homepage Function", () => {
});

it("Verify the functionality of advance filter", () => {
userPage.clickAdvancedFilters();
facilityPage.selectState(stateName);
facilityPage.selectDistrict(district);
facilityPage.selectLocalBody(localBody);
facilityPage.clickUpdateFacilityType(facilityType);
userPage.applyFilter();
advanceFilters.clickAdvancedFiltersButton();
advanceFilters.selectState(stateName);
advanceFilters.selectDistrict(district);
advanceFilters.selectLocalBody(localBody);
advanceFilters.selectFacilityType(facilityType);
advanceFilters.applySelectedFilter();
facilityPage.verifyStateBadgeContent(stateName);
facilityPage.verifyDistrictBadgeContent(district);
facilityPage.verifyLocalBodyBadgeContent(localBody);
facilityPage.verifyFacilityTypeBadgeContent(facilityType);
manageUserPage.assertFacilityInCard(facilityName);
userPage.clearFilters();
advanceFilters.clickAdvancedFiltersButton();
advanceFilters.clickClearAdvanceFilters();
userPage.verifyDataTestIdNotVisible("State");
userPage.verifyDataTestIdNotVisible("District");
userPage.verifyDataTestIdNotVisible("Facility type");
Expand All @@ -81,10 +83,10 @@ describe("Facility Homepage Function", () => {

it("Search a facility in homepage and pagination", () => {
// pagination of the facility page
assetPagination.navigateToNextPage();
assetPagination.verifyNextUrl();
assetPagination.navigateToPreviousPage();
assetPagination.verifyPreviousUrl();
pageNavigation.navigateToNextPage();
pageNavigation.verifyCurrentPageNumber(2);
pageNavigation.navigateToPreviousPage();
pageNavigation.verifyCurrentPageNumber(1);
// search for a facility
manageUserPage.typeFacilitySearch(facilityName);
facilityPage.verifyFacilityBadgeContent(facilityName);
Expand Down Expand Up @@ -116,11 +118,11 @@ describe("Facility Homepage Function", () => {
});

it("Verify Facility Detail page redirection to CNS and Live Minitoring ", () => {
userPage.clickAdvancedFilters();
facilityPage.selectState(stateName);
facilityPage.selectDistrict(district);
facilityPage.selectLocalBody(localBody);
userPage.applyFilter();
advanceFilters.clickAdvancedFiltersButton();
advanceFilters.selectState(stateName);
advanceFilters.selectDistrict(district);
advanceFilters.selectLocalBody(localBody);
advanceFilters.applySelectedFilter();
// go to cns page in the facility details page
manageUserPage.typeFacilitySearch(facilityName);
facilityPage.verifyFacilityBadgeContent(facilityName);
Expand Down Expand Up @@ -150,15 +152,15 @@ describe("Facility Homepage Function", () => {
facilityNotify.verifyFacilityName(facilityName);
facilityNotify.fillNotifyText(notificationMessage);
facilityNotify.interceptPostNotificationReq();
cy.submitButton("Notify");
cy.clickSubmitButton("Notify");
facilityNotify.verifyPostNotificationReq();
cy.verifyNotification("Facility Notified");
cy.closeNotification();
cy.wait(2000);
// Verify the frontend error on empty message
facilityHome.clickFacilityNotifyButton();
facilityNotify.verifyFacilityName(facilityName);
cy.submitButton("Notify");
cy.clickSubmitButton("Notify");
facilityNotify.verifyErrorMessage(notificationErrorMsg);
// close pop-up and verify
facilityHome.verifyAndCloseNotifyModal();
Expand Down
11 changes: 5 additions & 6 deletions cypress/e2e/facility_spec/FacilityLocation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { pageNavigation } from "pageobject/utils/paginationHelpers";
import { v4 as uuidv4 } from "uuid";

import { AssetPage } from "../../pageobject/Asset/AssetCreation";
import { AssetPagination } from "../../pageobject/Asset/AssetPagination";
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import FacilityHome from "../../pageobject/Facility/FacilityHome";
import FacilityLocation from "../../pageobject/Facility/FacilityLocation";
Expand All @@ -12,7 +12,6 @@ describe("Location Management Section", () => {
const userCreationPage = new UserCreationPage();
const facilityPage = new FacilityPage();
const facilityLocation = new FacilityLocation();
const assetPagination = new AssetPagination();
const facilityHome = new FacilityHome();

const EXPECTED_LOCATION_ERROR_MESSAGES = [
Expand Down Expand Up @@ -172,8 +171,8 @@ describe("Location Management Section", () => {
facilityLocation.setMultipleBeds(numberOfModifiedBeds);
assetPage.clickassetupdatebutton();
// pagination
assetPagination.navigateToNextPage();
assetPagination.navigateToPreviousPage();
pageNavigation.navigateToNextPage();
pageNavigation.navigateToPreviousPage();
facilityLocation.closeNotification();
});

Expand All @@ -194,14 +193,14 @@ describe("Location Management Section", () => {
facilityLocation.clickAddNewLocationButton();
facilityLocation.enterLocationName("Test Location with Beds");
facilityLocation.selectLocationType("OTHER");
cy.submitButton("Add Location");
cy.clickSubmitButton("Add Location");
cy.verifyNotification("Location created successfully");
cy.closeNotification();
facilityLocation.clickManageBedButton();
facilityLocation.clickAddBedButton();
facilityLocation.enterBedName("Bed 1");
facilityLocation.selectBedType("Regular");
cy.submitButton("Add Bed(s)");
cy.clickSubmitButton("Add Bed(s)");
cy.verifyNotification("1 Bed created successfully");
cy.closeNotification();
facilityLocation.loadLocationManagementPage("Dummy Shifting Center");
Expand Down
6 changes: 4 additions & 2 deletions cypress/e2e/hcx_spec/HcxClaims.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe("HCX Claims configuration and approval workflow", () => {
const patientConsultationPage = new PatientConsultationPage();
const patientInsurance = new PatientInsurance();
const hcxClaims = new HcxClaims();
const hcxPatientName = "Dummy Patient 14";
const hcxPatientName = "Dummy Patient Thirteen";
const firstInsuranceIdentifier = "insurance-details-0";
const patientMemberId = "001";
const patientPolicyId = "100";
Expand Down Expand Up @@ -48,7 +48,7 @@ describe("HCX Claims configuration and approval workflow", () => {
firstInsuranceIdentifier,
patientInsurerName,
);
cy.submitButton("Save Details");
cy.clickSubmitButton("Save Details");
cy.verifyNotification("Patient updated successfully");
cy.closeNotification();
// Navigate to Consultation View and capture dynamic consultation ID
Expand Down Expand Up @@ -80,6 +80,8 @@ describe("HCX Claims configuration and approval workflow", () => {
// Raise a HCX Pre-auth
patientConsultationPage.clickManagePatientButton();
patientConsultationPage.clickClaimsButton();
cy.verifyAndClickElement("#edit-insurance-policy", "Edit Insurance Policy");
cy.clickCancelButton();
hcxClaims.selectEligiblePolicy(patientInsurerName);
hcxClaims.verifyPolicyEligibility();
cy.verifyNotification("Checking Policy Eligibility");
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/patient_spec/PatientBedManagement.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ describe("Patient swtich bed functionality", () => {
const switchBedOne = "Dummy Bed 4";
const switchBedTwo = "Dummy Bed 1";
const switchBedThree = "Dummy Bed 7";
const switchPatientOne = "Dummy Patient 6";
const switchPatientTwo = "Dummy Patient 7";
const switchPatientOne = "Dummy Patient Six";
const switchPatientTwo = "Dummy Patient Seven";

before(() => {
loginPage.loginAsDistrictAdmin();
Expand Down
Loading

0 comments on commit 2a8a4a2

Please sign in to comment.