Skip to content

Commit

Permalink
HCX Plug (#8420)
Browse files Browse the repository at this point in the history
  • Loading branch information
khavinshankar authored Sep 23, 2024
1 parent 53ed162 commit fc64a14
Show file tree
Hide file tree
Showing 44 changed files with 1,425 additions and 1,022 deletions.
1 change: 1 addition & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ export default defineConfig({
},
env: {
API_URL: process.env.REACT_CARE_API_URL ?? "http://localhost:9000",
ENABLE_HCX: process.env.REACT_ENABLE_HCX ?? false,
},
});
1 change: 1 addition & 0 deletions cypress/e2e/assets_spec/AssetHomepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ describe("Asset Tab", () => {

it("Export asset", () => {
assetPage.selectassetimportbutton();
cy.wait(2000);
assetPage.selectjsonexportbutton();
assetPage.selectassetimportbutton();
assetPage.selectcsvexportbutton();
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/patient_spec/PatientPrescription.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ describe("Patient Medicine Administration", () => {
cy.closeNotification();
// Administer the medicine in edit form
patientPrescription.clickAdministerButton();
cy.wait(2000);
patientPrescription.enterAdministerDosage(medicineBaseDosage);
patientPrescription.enterAdministerNotes(medicineAdministerNote);
cy.submitButton("Administer Medicine");
Expand Down
55 changes: 35 additions & 20 deletions cypress/e2e/patient_spec/PatientRegistration.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import PatientInsurance from "../../pageobject/Patient/PatientInsurance";
import PatientMedicalHistory from "../../pageobject/Patient/PatientMedicalHistory";

const yearOfBirth = "2001";
const isHCXEnabled = Cypress.env("ENABLE_HCX");

const calculateAge = () => {
const currentYear = new Date().getFullYear();
Expand Down Expand Up @@ -180,16 +181,21 @@ describe("Patient Creation with consultation", () => {
"policy_id",
patientOneFirstPolicyId,
);
patientInsurance.typePatientInsuranceDetail(
patientOneFirstInsuranceId,
"insurer_id",
patientOneFirstInsurerId,
);
patientInsurance.typePatientInsuranceDetail(
patientOneFirstInsuranceId,
"insurer_name",
patientOneFirstInsurerName,
);
if (isHCXEnabled) {
patientInsurance.selectInsurer("test");
} else {
patientInsurance.typePatientInsuranceDetail(
patientOneFirstInsuranceId,
"insurer_id",
patientOneFirstInsurerId,
);
patientInsurance.typePatientInsuranceDetail(
patientOneFirstInsuranceId,
"insurer_name",
patientOneFirstInsurerName,
);
}

patientInsurance.clickAddInsruanceDetails();
patientInsurance.typePatientInsuranceDetail(
patientOneSecondInsuranceId,
Expand All @@ -201,16 +207,21 @@ describe("Patient Creation with consultation", () => {
"policy_id",
patientOneSecondPolicyId,
);
patientInsurance.typePatientInsuranceDetail(
patientOneSecondInsuranceId,
"insurer_id",
patientOneSecondInsurerId,
);
patientInsurance.typePatientInsuranceDetail(
patientOneSecondInsuranceId,
"insurer_name",
patientOneSecondInsurerName,
);
if (isHCXEnabled) {
patientInsurance.selectInsurer("Care");
} else {
patientInsurance.typePatientInsuranceDetail(
patientOneSecondInsuranceId,
"insurer_id",
patientOneSecondInsurerId,
);
patientInsurance.typePatientInsuranceDetail(
patientOneSecondInsuranceId,
"insurer_name",
patientOneSecondInsurerName,
);
}

patientPage.clickUpdatePatient();
cy.wait(3000);
patientPage.verifyPatientUpdated();
Expand Down Expand Up @@ -239,20 +250,24 @@ describe("Patient Creation with consultation", () => {
patientOneFirstPolicyId,
patientOneFirstInsurerId,
patientOneFirstInsurerName,
isHCXEnabled,
);

patientInsurance.clickPatientInsuranceViewDetail();
cy.wait(3000);
patientInsurance.verifyPatientPolicyDetails(
patientOneFirstSubscriberId,
patientOneFirstPolicyId,
patientOneFirstInsurerId,
patientOneFirstInsurerName,
isHCXEnabled,
);
patientInsurance.verifyPatientPolicyDetails(
patientOneSecondSubscriberId,
patientOneSecondPolicyId,
patientOneSecondInsurerId,
patientOneSecondInsurerName,
isHCXEnabled,
);
});

Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/users_spec/UsersCreation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ describe("User Creation", () => {
it("create new user form throwing mandatory field error", () => {
userCreationPage.clickElementById("addUserButton");
userCreationPage.clickElementById("submit");
cy.wait(2000);
userCreationPage.verifyErrorMessages(EXPECTED_ERROR_MESSAGES);
});

Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/users_spec/UsersManage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ describe("Manage User", () => {
manageUserPage.clickLinkFacility();
manageUserPage.clickUnlinkFacilityButton();
manageUserPage.clickSubmit();
manageUserPage.assertnotLinkedFacility;
manageUserPage.linkedfacilitylistnotvisible();
manageUserPage.clickCloseSlideOver();
// Go to particular facility doctor connect and all user-id are reflected based on there access
Expand Down
42 changes: 39 additions & 3 deletions cypress/pageobject/Patient/PatientInsurance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,34 @@ class PatientInsurance {
});
}

selectInsurer(insurer: string) {
cy.intercept("GET", "**/api/v1/hcx/payors/**", {
statusCode: 200,
body: [
{
name: "test payor 2",
code: "testpayor2.swasthmock@swasth-hcx-staging",
},
{
name: "Care Payor",
code: "khavinshankar.gmail@swasth-hcx-staging",
},
{
name: "Alliance",
code: "hcxdemo.yopmail@swasth-hcx-staging",
},
],
}).as("getInsurer");
cy.get("[name='insurer']")
.last()
.click()
.type(insurer)
.then(() => {
cy.wait("@getInsurer");
cy.get("[role='option']").contains(insurer).click();
});
}

clickPatientInsuranceViewDetail() {
cy.get("#insurance-view-details").scrollIntoView();
cy.get("#insurance-view-details").click();
Expand All @@ -18,13 +46,21 @@ class PatientInsurance {
cy.get("[data-testid=add-insurance-button]").click();
}

verifyPatientPolicyDetails(subscriberId, policyId, insurerId, insurerName) {
verifyPatientPolicyDetails(
subscriberId,
policyId,
insurerId,
insurerName,
isHcxEnabled,
) {
cy.get("[data-testid=patient-details]").then(($dashboard) => {
cy.url().should("include", "/facility/");
expect($dashboard).to.contain(subscriberId);
expect($dashboard).to.contain(policyId);
expect($dashboard).to.contain(insurerId);
expect($dashboard).to.contain(insurerName);
if (!isHcxEnabled) {
expect($dashboard).to.contain(insurerId);
expect($dashboard).to.contain(insurerName);
}
});
}
}
Expand Down
10 changes: 8 additions & 2 deletions cypress/pageobject/Users/ManageUserPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,14 @@ export class ManageUserPage {
}

assertDoctorConnectVisibility(realName) {
cy.get("#doctor-connect-home-doctor").should("contain.text", realName);
cy.get("#doctor-connect-remote-doctor").should("contain.text", realName);
cy.get('*[id="doctor-connect-home-doctor"]').should(
"contain.text",
realName,
);
cy.get('*[id="doctor-connect-remote-doctor"]').should(
"contain.text",
realName,
);
}

assertVideoConnectLink(docName: string, link: string) {
Expand Down
28 changes: 0 additions & 28 deletions public/config.json

This file was deleted.

Empty file removed public/env.json
Empty file.
3 changes: 1 addition & 2 deletions src/CAREUI/icons/CareIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import iconData from "./UniconPaths.json";
import { transformIcons } from "./icon";
import { useEffect } from "react";

import iconData from "./UniconPaths.json";

export type IconName = keyof typeof iconData;

export interface CareIconProps {
Expand Down
114 changes: 0 additions & 114 deletions src/Common/hooks/useAsyncOptions.ts

This file was deleted.

Loading

0 comments on commit fc64a14

Please sign in to comment.