Skip to content

Commit

Permalink
Merge branch 'develop' into issues/6503/displayCNSon4k
Browse files Browse the repository at this point in the history
  • Loading branch information
i0am0arunava authored Nov 12, 2024
2 parents e969002 + c0ffd4a commit 33f0bac
Show file tree
Hide file tree
Showing 78 changed files with 1,348 additions and 3,998 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ ESLINT_NO_DEV_ERRORS=true
CARE_CDN_URL="https://egov-s3-facility-10bedicu.s3.amazonaws.com https://egov-s3-patient-data-10bedicu.s3.amazonaws.com http://localhost:4566"
REACT_ALLOWED_LOCALES="en,hi,ta,ml,mr,kn"

REACT_ENABLED_APPS=""
REACT_ENABLED_APPS=""
2 changes: 1 addition & 1 deletion .github/workflows/auto-testing-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
}
if (isChangesRequired) {
await github.issues.createComment({
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/cypress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
containers: [1, 2, 3, 4]
env:
REACT_CARE_API_URL: http://localhost:9000
REACT_ENABLED_APPS: "ohcnetwork/care_hcx_fe@main"
REACT_ENABLE_HCX: true
steps:
- name: Checkout 📥
uses: actions/checkout@v3
Expand Down
17 changes: 0 additions & 17 deletions cypress/e2e/auth_spec/ForgotPassword.cy.ts

This file was deleted.

23 changes: 0 additions & 23 deletions cypress/e2e/auth_spec/auth.cy.ts

This file was deleted.

53 changes: 50 additions & 3 deletions cypress/e2e/facility_spec/FacilityHomepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
import { AssetPagination } from "../../pageobject/Asset/AssetPagination";
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";

describe("Facility Homepage Function", () => {
const loginPage = new LoginPage();
const facilityHome = new FacilityHome();
const facilityNotify = new FacilityNotify();
const facilityPage = new FacilityPage();
const manageUserPage = new ManageUserPage();
const userPage = new UserPage();
Expand All @@ -22,6 +24,8 @@ describe("Facility Homepage Function", () => {
const district = "Ernakulam";
const localBody = "Aikaranad";
const facilityType = "Private Hospital";
const notificationErrorMsg = "Message cannot be empty";
const notificationMessage = "Test Notification";

before(() => {
loginPage.loginAsDistrictAdmin();
Expand All @@ -30,6 +34,7 @@ describe("Facility Homepage Function", () => {

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/facility");
});

Expand All @@ -41,9 +46,6 @@ describe("Facility Homepage Function", () => {
facilityHome.clickViewCnsButton();
facilityHome.verifyCnsUrl();
facilityHome.navigateBack();
// view notify button
facilityHome.clickFacilityNotifyButton();
facilityHome.verifyAndCloseNotifyModal();
// view facility button
facilityHome.clickViewFacilityDetails();
facilityPage.getFacilityName().should("be.visible");
Expand Down Expand Up @@ -134,6 +136,51 @@ describe("Facility Homepage Function", () => {
facilityHome.verifyLiveMonitorUrl();
});

it("Verify Notice Board Functionality", () => {
// search facility and verify it's loaded or not
manageUserPage.interceptFacilitySearchReq();
manageUserPage.typeFacilitySearch(facilityName);
manageUserPage.verifyFacilitySearchReq();
// verify facility name and card reflection
facilityNotify.verifyUrlContains("Dummy+Facility+40");
facilityPage.verifyFacilityBadgeContent(facilityName);
manageUserPage.assertFacilityInCard(facilityName);
// send notification to a facility
facilityHome.clickFacilityNotifyButton();
facilityNotify.verifyFacilityName(facilityName);
facilityNotify.fillNotifyText(notificationMessage);
facilityNotify.interceptPostNotificationReq();
cy.submitButton("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");
facilityNotify.verifyErrorMessage(notificationErrorMsg);
// close pop-up and verify
facilityHome.verifyAndCloseNotifyModal();
// signout as district admin and login as a Nurse
loginPage.ensureLoggedIn();
loginPage.clickSignOutBtn();
loginPage.loginManuallyAsNurse();
// Verify Notice Board Reflection
facilityNotify.interceptGetNotificationReq("MESSAGE");
facilityNotify.visitNoticeBoard();
facilityNotify.verifyGetNotificationReq();
facilityNotify.verifyFacilityNoticeBoardMessage(notificationMessage);
facilityNotify.interceptGetNotificationReq();
// Verify Sidebar Notification Reflection
facilityNotify.openNotificationSlide();
facilityNotify.verifyGetNotificationReq();
cy.verifyContentPresence("#notification-slide-msg", [notificationMessage]);
facilityNotify.closeNotificationSlide();
loginPage.ensureLoggedIn();
loginPage.clickSignOutBtn();
});

afterEach(() => {
cy.saveLocalStorage();
});
Expand Down
72 changes: 35 additions & 37 deletions cypress/e2e/facility_spec/FacilityManage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { v4 as uuidv4 } from "uuid";

import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import FacilityManage from "../../pageobject/Facility/FacilityManage";
import LoginPage from "../../pageobject/Login/LoginPage";
Expand All @@ -14,11 +12,10 @@ describe("Facility Manage Functions", () => {
const facilityUpdatedMiddleware = "updated.coronasafe.live";
const facilityMiddlewareSuccessfullNotification =
"Facility middleware updated successfully";
const facilityHfridUpdateButton = "Link Health Facility";
const facilityHfridToastNotificationText =
/Health Facility config updated successfully|Health ID registration failed/;
const facilityHfrId = "IN180000018";
const facilityUpdatedHfrId = uuidv4();
// const facilityHfridUpdateButton = "Link Health Facility";
// const facilityHfridToastNotificationText = /Health Facility config updated successfully|Health ID registration failed/;
// const facilityHfrId = "IN180000018";
// const facilityUpdatedHfrId = uuidv4();
const doctorCapacity = "5";
const doctorModifiedCapacity = "7";
const totalCapacity = "100";
Expand Down Expand Up @@ -79,36 +76,37 @@ describe("Facility Manage Functions", () => {
facilityManage.verifyMiddlewareAddressValue(facilityUpdatedMiddleware);
});

it("Configure Facility Health ID", () => {
facilityPage.clickManageFacilityDropdown();
facilityManage.clickFacilityConfigureButton();
// verify mandatory field error message
facilityManage.clearHfrId();
facilityManage.clickButtonWithText(facilityHfridUpdateButton);
facilityManage.checkErrorMessageVisibility(
"Health Facility Id is required",
);
// add facility health ID and verify notification
facilityManage.typeHfrId(facilityHfrId);
facilityManage.clickButtonWithText(facilityHfridUpdateButton);
facilityManage.verifySuccessMessageVisibilityAndContent(
facilityHfridToastNotificationText,
true,
);
// update the existing middleware
facilityPage.clickManageFacilityDropdown();
facilityManage.clickFacilityConfigureButton();
facilityManage.typeHfrId(facilityUpdatedHfrId);
facilityManage.clickButtonWithText(facilityHfridUpdateButton);
facilityManage.verifySuccessMessageVisibilityAndContent(
facilityHfridToastNotificationText,
true,
);
// verify its reflection
facilityPage.clickManageFacilityDropdown();
facilityManage.clickFacilityConfigureButton();
facilityManage.verifyHfrIdValue(facilityUpdatedHfrId);
});
// TODO: enable this test after configuring testing specs for plugs
// it("Configure Facility Health ID", () => {
// facilityPage.clickManageFacilityDropdown();
// facilityManage.clickFacilityConfigureButton();
// // verify mandatory field error message
// facilityManage.clearHfrId();
// facilityManage.clickButtonWithText(facilityHfridUpdateButton);
// facilityManage.checkErrorMessageVisibility(
// "Health Facility Id is required",
// );
// // add facility health ID and verify notification
// facilityManage.typeHfrId(facilityHfrId);
// facilityManage.clickButtonWithText(facilityHfridUpdateButton);
// facilityManage.verifySuccessMessageVisibilityAndContent(
// facilityHfridToastNotificationText,
// true,
// );
// // update the existing middleware
// facilityPage.clickManageFacilityDropdown();
// facilityManage.clickFacilityConfigureButton();
// facilityManage.typeHfrId(facilityUpdatedHfrId);
// facilityManage.clickButtonWithText(facilityHfridUpdateButton);
// facilityManage.verifySuccessMessageVisibilityAndContent(
// facilityHfridToastNotificationText,
// true,
// );
// // verify its reflection
// facilityPage.clickManageFacilityDropdown();
// facilityManage.clickFacilityConfigureButton();
// facilityManage.verifyHfrIdValue(facilityUpdatedHfrId);
// });

it("Modify doctor capacity in Facility detail page", () => {
// Add a doctor capacity
Expand Down
97 changes: 97 additions & 0 deletions cypress/e2e/hcx_spec/HcxClaims.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import { HcxClaims } from "pageobject/Hcx/HcxClaims";
import { PatientConsultationPage } from "pageobject/Patient/PatientConsultation";
import PatientInsurance from "pageobject/Patient/PatientInsurance";

import LoginPage from "../../pageobject/Login/LoginPage";
import { PatientPage } from "../../pageobject/Patient/PatientCreation";

describe("HCX Claims configuration and approval workflow", () => {
const loginPage = new LoginPage();
const patientPage = new PatientPage();
const patientConsultationPage = new PatientConsultationPage();
const patientInsurance = new PatientInsurance();
const hcxClaims = new HcxClaims();
const hcxPatientName = "Dummy Patient 14";
const firstInsuranceIdentifier = "insurance-details-0";
const patientMemberId = "001";
const patientPolicyId = "100";
const patientInsurerName = "Demo Payor";

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

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/patients");
});

it("Verify the HCX Workflow for a patient with mocked eligibility", () => {
// Modify the insurance for a facility
patientPage.visitPatient(hcxPatientName);
patientConsultationPage.clickPatientDetails();
patientPage.clickPatientUpdateDetails();
patientInsurance.clickAddInsruanceDetails();
patientInsurance.typePatientInsuranceDetail(
firstInsuranceIdentifier,
"subscriber_id",
patientMemberId,
);
patientInsurance.typePatientInsuranceDetail(
firstInsuranceIdentifier,
"policy_id",
patientPolicyId,
);
patientInsurance.selectPatientInsurerName(
firstInsuranceIdentifier,
patientInsurerName,
);
cy.submitButton("Save Details");
cy.verifyNotification("Patient updated successfully");
cy.closeNotification();
// Navigate to Consultation View and capture dynamic consultation ID
let consultationId: string;
patientConsultationPage.clickViewConsultationButton();
cy.url().then((url) => {
const urlRegex =
/facility\/([^/]+)\/patient\/([^/]+)\/consultation\/([^/]+)/;
const match = url.match(urlRegex);
if (match) {
consultationId = match[3];
}
});
// Intercept and mock the eligibility check response using captured consultationId
cy.intercept("POST", "/api/hcx/check_eligibility", (req) => {
req.reply({
statusCode: 200,
body: {
api_call_id: "bfa228f0-cdfa-4426-bebe-26e996079dbb",
correlation_id: "86ae030c-1b33-4e52-a6f1-7a74a48111eb",
timestamp: Date.now(),
consultation: consultationId,
policy: patientPolicyId,
outcome: "Complete",
limit: 1,
},
});
}).as("checkEligibility");
// Raise a HCX Pre-auth
patientConsultationPage.clickManagePatientButton();
patientConsultationPage.clickClaimsButton();
hcxClaims.selectEligiblePolicy(patientInsurerName);
hcxClaims.verifyPolicyEligibility();
cy.verifyNotification("Checking Policy Eligibility");
cy.closeNotification();
// Confirm that the eligibility check displays as successful
cy.wait("@checkEligibility").then((interception) => {
const response = interception.response.body;
expect(response.outcome).to.equal("Complete");
});
});

afterEach(() => {
cy.saveLocalStorage();
});
});
48 changes: 48 additions & 0 deletions cypress/e2e/homepage_spec/UserLogin.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import LoginPage from "pageobject/Login/LoginPage";

const loginPage = new LoginPage();
const userName = "dummy_user_1";
const forgotPasswordHeading = "Forgot password?";

describe("User login workflow with correct and incorrect passwords", () => {
beforeEach(() => {
cy.awaitUrl("/", true);
});

it("Log in as admin with correct password", () => {
loginPage.loginManuallyAsDistrictAdmin();
loginPage.interceptFacilityReq();
loginPage.verifyFacilityReq();
loginPage.ensureLoggedIn();
loginPage.clickSignOutBtn();
loginPage.verifyLoginPageUrl();
});

it("Display an error when logging in as admin with incorrect password", () => {
loginPage.interceptLoginReq();
loginPage.loginManuallyAsDistrictAdmin(false);
loginPage.verifyLoginReq();
cy.verifyNotification("No active account found with the given credentials");
cy.closeNotification();
});
});

describe("Reset user's password using email", () => {
beforeEach(() => {
cy.awaitUrl("/", true);
});

it("Send a password reset link and navigate back to the login page", () => {
loginPage.clickForgotPasswordButton(forgotPasswordHeading);
loginPage.verifyForgotPasswordHeading([forgotPasswordHeading]);
loginPage.fillUserNameInForgotPasswordForm(userName);
loginPage.interceptResetLinkReq();
loginPage.clickSendResetLinkBtn();
loginPage.verifyResetLinkReq();
cy.verifyNotification("Password Reset Email Sent");
cy.closeNotification();
loginPage.clickBackButton();
loginPage.verifyLoginPageUrl();
loginPage.verifyLoginButtonPresence();
});
});
File renamed without changes.
Loading

0 comments on commit 33f0bac

Please sign in to comment.