From f535fd3b9018b602f7efc66c53ef55a31210b55c Mon Sep 17 00:00:00 2001 From: Pranshu Aggarwal <70687348+Pranshu1902@users.noreply.github.com> Date: Tue, 5 Sep 2023 19:41:24 +0530 Subject: [PATCH 01/20] Enhance UI of Import External Results page (#6163) * enhance ui * place cancel button to righ * fix width --- .../ExternalResult/ExternalResultUpload.tsx | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Components/ExternalResult/ExternalResultUpload.tsx b/src/Components/ExternalResult/ExternalResultUpload.tsx index 4d517f1a442..5f39cb213a4 100644 --- a/src/Components/ExternalResult/ExternalResultUpload.tsx +++ b/src/Components/ExternalResult/ExternalResultUpload.tsx @@ -8,6 +8,8 @@ import { externalResultUploadCsv } from "../../Redux/actions"; import * as Notification from "../../Utils/Notifications.js"; const PageTitle = lazy(() => import("../Common/PageTitle")); import { useTranslation } from "react-i18next"; +import { Cancel, Submit } from "../Common/components/ButtonV2"; +import useAppHistory from "../../Common/hooks/useAppHistory"; export default function ExternalResultUpload() { const { sample_format_external_result_import } = useConfig(); @@ -20,6 +22,7 @@ export default function ExternalResultUpload() { setCsvData(data); }; const { t } = useTranslation(); + const { goBack } = useAppHistory(); const papaparseOptions = { header: true, @@ -67,11 +70,11 @@ export default function ExternalResultUpload() { backUrl="/external_results" className="mt-4" /> -
-
+
+
-
+
-
- + disabled={loading} + label={t("save")} + data-testid="submit-button" + />
From b0c61dc0044bf80a6a13277f92a6eec59973a644 Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Tue, 5 Sep 2023 14:32:01 +0000 Subject: [PATCH 02/20] Medicine: Adds `type` filter for medibase search (#6186) * add type filter for medibase * Consultation: Verified By Doctor as Dropdown * add missing model changes * Revert "add missing model changes" This reverts commit 149592e98a610ee0661076f05df5bfeaed8b25bf. * Revert "Consultation: Verified By Doctor as Dropdown" This reverts commit 4113172c929c99e96b7dfee74f597cc4fd13fb61. --- src/CAREUI/interactive/Switch.tsx | 39 +++++++++++++++++++ .../MedibaseAutocompleteFormField.tsx | 30 +++++++++++++- src/Redux/actions.tsx | 8 +++- 3 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 src/CAREUI/interactive/Switch.tsx diff --git a/src/CAREUI/interactive/Switch.tsx b/src/CAREUI/interactive/Switch.tsx new file mode 100644 index 00000000000..3e18795b034 --- /dev/null +++ b/src/CAREUI/interactive/Switch.tsx @@ -0,0 +1,39 @@ +import { classNames } from "../../Utils/utils"; + +interface Props { + tabs: Record; + selected: T; + onChange: (tab: T) => void; + size?: "sm" | "md" | "lg"; +} + +export default function Switch({ + size = "sm", + ...props +}: Props) { + return ( +
    + {Object.keys(props.tabs).map((tab) => { + return ( +
  • props.onChange(tab as T)} + > + {props.tabs[tab as T]} +
  • + ); + })} +
+ ); +} diff --git a/src/Components/Medicine/MedibaseAutocompleteFormField.tsx b/src/Components/Medicine/MedibaseAutocompleteFormField.tsx index 473bb3a2598..337546691f9 100644 --- a/src/Components/Medicine/MedibaseAutocompleteFormField.tsx +++ b/src/Components/Medicine/MedibaseAutocompleteFormField.tsx @@ -1,3 +1,5 @@ +import { useEffect, useState } from "react"; +import Switch from "../../CAREUI/interactive/Switch"; import { useAsyncOptions } from "../../Common/hooks/useAsyncOptions"; import { listMedibaseMedicines } from "../../Redux/actions"; import { Autocomplete } from "../Form/FormFields/Autocomplete"; @@ -15,8 +17,32 @@ export default function MedibaseAutocompleteFormField( const { isLoading, options, fetchOptions } = useAsyncOptions("id"); + const [query, setQuery] = useState(""); + const [type, setType] = useState(); + + useEffect(() => { + fetchOptions(listMedibaseMedicines(query, type)); + }, [query, type]); + return ( - + { + setType(type === "all" ? undefined : type); + }} + /> + ), + }} + > ) } - onQuery={(query) => fetchOptions(listMedibaseMedicines(query))} + onQuery={setQuery} isLoading={isLoading} /> diff --git a/src/Redux/actions.tsx b/src/Redux/actions.tsx index 0ea1270f741..e3212685d2f 100644 --- a/src/Redux/actions.tsx +++ b/src/Redux/actions.tsx @@ -1,5 +1,6 @@ import { HCXClaimModel, HCXPolicyModel } from "../Components/HCX/models"; import { + MedibaseMedicine, MedicineAdministrationRecord, Prescription, } from "../Components/Medicine/models"; @@ -803,8 +804,11 @@ export const listICD11Diagnosis = (params: object, key: string) => { return fireRequest("listICD11Diagnosis", [], params, null, key); }; // Medibase -export const listMedibaseMedicines = (query: string) => { - return fireRequest("listMedibaseMedicines", [], { query }); +export const listMedibaseMedicines = ( + query: string, + type?: MedibaseMedicine["type"] +) => { + return fireRequest("listMedibaseMedicines", [], { query, type }); }; // Resource From 14f6ff1e239c3bc8f17a945dc36eb1bb0a29b774 Mon Sep 17 00:00:00 2001 From: Pranshu Aggarwal <70687348+Pranshu1902@users.noreply.github.com> Date: Tue, 5 Sep 2023 20:06:17 +0530 Subject: [PATCH 03/20] remove extra space (#6215) --- src/Components/Facility/TriageForm.tsx | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Components/Facility/TriageForm.tsx b/src/Components/Facility/TriageForm.tsx index a627fda1bbe..3c8e6b1497b 100644 --- a/src/Components/Facility/TriageForm.tsx +++ b/src/Components/Facility/TriageForm.tsx @@ -283,20 +283,20 @@ export const TriageForm = (props: triageFormProps) => { handleSubmit(); }} > -
- -
+
+ +
{ />
-
+
goBack()} />
From 1631e7953c4f64400b7e357b11c772af3836a17b Mon Sep 17 00:00:00 2001 From: Pranshu Aggarwal <70687348+Pranshu1902@users.noreply.github.com> Date: Tue, 5 Sep 2023 20:07:13 +0530 Subject: [PATCH 04/20] remove extra loader and add success notification (#6210) --- src/Components/Users/SkillsSlideOver.tsx | 47 ++++++++++++------------ 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/src/Components/Users/SkillsSlideOver.tsx b/src/Components/Users/SkillsSlideOver.tsx index cf43b738181..343ea9062cc 100644 --- a/src/Components/Users/SkillsSlideOver.tsx +++ b/src/Components/Users/SkillsSlideOver.tsx @@ -55,6 +55,10 @@ export default ({ show, setShow, username }: IProps) => { Notification.Error({ msg: "Error while adding skill", }); + } else { + Notification.Success({ + msg: "Skill added successfully", + }); } setSelectedSkill(null); setIsLoading(false); @@ -110,21 +114,19 @@ export default ({ show, setShow, username }: IProps) => { >
-
- - {isLoading ? ( - - ) : ( + {!isLoading && ( +
+ addSkill(username, selectedSkill)} @@ -132,14 +134,13 @@ export default ({ show, setShow, username }: IProps) => { > {t("add")} - )} - {!authorizeForAddSkill && ( - - {t("contact_your_admin_to_add_skills")} - - )} -
- {/* While loading skills, we display an additional circular progress to show we are fetching the information*/} + {!authorizeForAddSkill && ( + + {t("contact_your_admin_to_add_skills")} + + )} +
+ )} {isLoading ? (
From 9d9bb5e5a182934507b4f2a0f5d22f2d01658464 Mon Sep 17 00:00:00 2001 From: Mustafa Azad <97380192+mustafaazad03@users.noreply.github.com> Date: Tue, 5 Sep 2023 20:17:41 +0530 Subject: [PATCH 05/20] Bug Fixed : Default filters on patients page loads (#6189) * URL Bug fixed * filters issue fixed * default filters apply on patient page : Bug Fixed * Update src/Components/Patient/ManagePatients.tsx Co-authored-by: Rithvik Nishad * Update src/Components/Patient/ManagePatients.tsx Co-authored-by: Rithvik Nishad --------- Co-authored-by: Rithvik Nishad --- src/Components/Patient/ManagePatients.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Components/Patient/ManagePatients.tsx b/src/Components/Patient/ManagePatients.tsx index 677e3725289..b29c112c5a1 100644 --- a/src/Components/Patient/ManagePatients.tsx +++ b/src/Components/Patient/ManagePatients.tsx @@ -121,7 +121,7 @@ export const PatientManager = () => { if (phone_number === "+91" || phone_number === "") { setPhoneNumberError(""); - updateQuery({ phone_number: "" }); + qParams.phone_number && updateQuery({ phone_number: null }); return; } @@ -138,7 +138,8 @@ export const PatientManager = () => { if (emergency_phone_number === "+91" || emergency_phone_number === "") { setEmergencyPhoneNumberError(""); - updateQuery({ emergency_phone_number: "" }); + qParams.emergency_phone_number && + updateQuery({ emergency_phone_number: null }); return; } From bbb07b773f9e6bcddfd1589b20069f0fb3ef32e3 Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Tue, 5 Sep 2023 15:12:47 +0000 Subject: [PATCH 06/20] Support for direnv and use `CARE_API` from env in vite config (#6201) * optionally use `careapi` from env * update cypress ci * bring back quotes * fix cypress env properly * support for `direnv` --------- Co-authored-by: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> --- .envrc | 1 + .github/workflows/cypress.yaml | 4 +--- vite.config.ts | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 00000000000..fc7d890f90a --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +test -f .env.local && dotenv .env.local \ No newline at end of file diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index e98f5b01e7d..4f23fbe4937 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -35,9 +35,6 @@ jobs: - name: Check care is up ♻ run: curl -o /dev/null -s -w "%{http_code}\n" http://localhost:9000 - - name: Change api proxy url 📝 - run: 'sed --in-place "s^target: .*,^target: \"http://localhost:9000\",^g" vite.config.ts' - - name: Install dependencies 📦 run: npm install @@ -55,6 +52,7 @@ jobs: browser: chrome record: true env: + CARE_API: http://localhost:9000 CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NODE_OPTIONS: --max_old_space_size=4096 diff --git a/vite.config.ts b/vite.config.ts index 1c88d8e0022..7aafe6e1d5c 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -84,7 +84,7 @@ export default defineConfig({ port: 4000, proxy: { "/api": { - target: "https://careapi.ohc.network", + target: process.env.CARE_API ?? "https://careapi.ohc.network", changeOrigin: true, }, }, @@ -93,7 +93,7 @@ export default defineConfig({ port: 4000, proxy: { "/api": { - target: "https://careapi.ohc.network", + target: process.env.CARE_API ?? "https://careapi.ohc.network", changeOrigin: true, }, }, From 539beecc51200417059258faf1c7c5b8e2efb213 Mon Sep 17 00:00:00 2001 From: Suprabath <34211797+suprabathk@users.noreply.github.com> Date: Wed, 6 Sep 2023 08:38:58 +0530 Subject: [PATCH 07/20] Added nav link for bed status in consultation form (#6170) --- src/Components/Facility/ConsultationForm.tsx | 22 +++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index ed7fd7b57b6..c71c70b162c 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -198,7 +198,8 @@ const consultationFormReducer = (state = initialState, action: FormAction) => { type ConsultationFormSection = | "Consultation Details" | "Diagnosis" - | "Treatment Plan"; + | "Treatment Plan" + | "Bed Status"; export const ConsultationForm = (props: any) => { const { goBack } = useAppHistory(); @@ -223,6 +224,7 @@ export const ConsultationForm = (props: any) => { const [consultationDetailsVisible, consultationDetailsRef] = useVisibility(); const [diagnosisVisible, diagnosisRef] = useVisibility(-300); const [treatmentPlanVisible, treatmentPlanRef] = useVisibility(-300); + const [bedStatusVisible, bedStatusRef] = useVisibility(-300); const [disabledFields, setDisabledFields] = useState([]); const sections = { @@ -241,6 +243,11 @@ export const ConsultationForm = (props: any) => { visible: treatmentPlanVisible, ref: treatmentPlanRef, }, + "Bed Status": { + iconClass: "care-l-bed", + visible: bedStatusVisible, + ref: bedStatusRef, + }, }; useEffect(() => { @@ -248,9 +255,15 @@ export const ConsultationForm = (props: any) => { if (consultationDetailsVisible) return "Consultation Details"; if (diagnosisVisible) return "Diagnosis"; if (treatmentPlanVisible) return "Treatment Plan"; + if (bedStatusVisible) return "Bed Status"; return prev; }); - }, [consultationDetailsVisible, diagnosisVisible, treatmentPlanVisible]); + }, [ + consultationDetailsVisible, + diagnosisVisible, + treatmentPlanVisible, + bedStatusVisible, + ]); useEffect(() => { async function fetchPatientName() { @@ -817,6 +830,9 @@ export const ConsultationForm = (props: any) => { if (state.form.consultation_status === 1) { return null; } + if (!isUpdate && sectionTitle === "Bed Status") { + return null; + } const isCurrent = currentSection === sectionTitle; const section = sections[sectionTitle as ConsultationFormSection]; return ( @@ -1306,7 +1322,7 @@ export const ConsultationForm = (props: any) => { {isUpdate && ( <>
-

Update Bed

+ {sectionTitle("Bed Status")} Date: Wed, 6 Sep 2023 03:10:03 +0000 Subject: [PATCH 08/20] Medicine Administrations: Adds `administered_date` input (#6206) * Add input: `administered_date` to Administer Dialog * add administered_date for bulk administer too * fix cypress --- cypress/e2e/patient_spec/patient_crud.cy.ts | 2 +- .../Form/FormFields/CheckBoxFormField.tsx | 1 + .../Medicine/AdministerMedicine.tsx | 61 ++++++++++--- .../Medicine/MedicineAdministration.tsx | 88 +++++++++++++++---- .../PrescriptionAdministrationsTable.tsx | 2 +- src/Components/Medicine/models.ts | 2 +- 6 files changed, 125 insertions(+), 31 deletions(-) diff --git a/cypress/e2e/patient_spec/patient_crud.cy.ts b/cypress/e2e/patient_spec/patient_crud.cy.ts index ff8ffaefcfc..b9e03851897 100644 --- a/cypress/e2e/patient_spec/patient_crud.cy.ts +++ b/cypress/e2e/patient_spec/patient_crud.cy.ts @@ -28,7 +28,7 @@ describe("Patient Creation with consultation", () => { cy.get("#add-patient-details").should("be.visible"); cy.get("#add-patient-details").click(); cy.get("input[name='facilities']") - .type("cypress facility") + .type("dummy facility") .then(() => { cy.get("[role='option']").first().click(); }); diff --git a/src/Components/Form/FormFields/CheckBoxFormField.tsx b/src/Components/Form/FormFields/CheckBoxFormField.tsx index 90c4513f4b7..f3382d522de 100644 --- a/src/Components/Form/FormFields/CheckBoxFormField.tsx +++ b/src/Components/Form/FormFields/CheckBoxFormField.tsx @@ -14,6 +14,7 @@ export default function CheckBoxFormField(props: FormFieldBaseProps) { name={field.name} checked={field.value} onChange={(e) => field.handleChange(e.target.checked)} + disabled={field.disabled} /> (); const [isLoading, setIsLoading] = useState(false); const [notes, setNotes] = useState(""); + const [isCustomTime, setIsCustomTime] = useState(false); + const [customTime, setCustomTime] = useState( + dayjs().format("YYYY-MM-DDTHH:mm") + ); return ( props.onClose(false)} - // variant="primary" onConfirm={async () => { setIsLoading(true); - const res = await dispatch(props.actions.administer({ notes })); + const res = await dispatch( + props.actions.administer({ + notes, + administered_date: isCustomTime ? customTime : undefined, + }) + ); if (res.status === 201) { Success({ msg: t("medicines_administered") }); } @@ -61,15 +72,43 @@ export default function AdministerMedicine({ prescription, ...props }: Props) { readonly actions={props.actions} /> - setNotes(value)} - errorClassName="hidden" - disabled={isLoading} - /> + +
+ setNotes(value)} + errorClassName="hidden" + disabled={isLoading} + /> +
+ { + setIsCustomTime(value); + if (!value) { + setCustomTime(dayjs().format("YYYY-MM-DDTHH:mm")); + } + }} + errorClassName="hidden" + /> + setCustomTime(value)} + disabled={!isCustomTime} + min={dayjs(prescription.created_date).format("YYYY-MM-DDTHH:mm")} + max={dayjs().format("YYYY-MM-DDTHH:mm")} + /> +
+
); diff --git a/src/Components/Medicine/MedicineAdministration.tsx b/src/Components/Medicine/MedicineAdministration.tsx index 16926b32f7b..5d8347ba5a5 100644 --- a/src/Components/Medicine/MedicineAdministration.tsx +++ b/src/Components/Medicine/MedicineAdministration.tsx @@ -10,6 +10,8 @@ import { useDispatch } from "react-redux"; import { Error, Success } from "../../Utils/Notifications"; import { formatDateTime } from "../../Utils/utils"; import { useTranslation } from "react-i18next"; +import dayjs from "../../Utils/dayjs"; +import TextFormField from "../Form/FormFields/TextFormField"; interface Props { prescriptions: Prescription[]; @@ -24,6 +26,8 @@ export default function MedicineAdministration(props: Props) { const [notes, setNotes] = useState( [] ); + const [isCustomTime, setIsCustomTime] = useState([]); + const [customTime, setCustomTime] = useState([]); const prescriptions = useMemo( () => @@ -36,13 +40,21 @@ export default function MedicineAdministration(props: Props) { useEffect(() => { setShouldAdminister(Array(prescriptions.length).fill(false)); setNotes(Array(prescriptions.length).fill("")); + setIsCustomTime(Array(prescriptions.length).fill(false)); + setCustomTime( + Array(prescriptions.length).fill(dayjs().format("YYYY-MM-DDTHH:mm")) + ); }, [props.prescriptions]); const handleSubmit = () => { const records: MedicineAdministrationRecord[] = []; prescriptions.forEach((prescription, i) => { if (shouldAdminister[i]) { - records.push({ prescription, notes: notes[i] }); + records.push({ + prescription, + notes: notes[i], + administered_date: isCustomTime[i] ? customTime[i] : undefined, + }); } }); @@ -73,7 +85,7 @@ export default function MedicineAdministration(props: Props) { actions={props.action(obj?.id ?? "")} selected={shouldAdminister[index]} > -
+
- - setNotes((notes) => { - const newNotes = [...notes]; - newNotes[index] = event.value; - return newNotes; - }) - } - errorClassName="hidden" - /> +
+ + setNotes((notes) => { + const newNotes = [...notes]; + newNotes[index] = event.value; + return newNotes; + }) + } + errorClassName="hidden" + /> +
+ { + setIsCustomTime((arr) => { + const newArr = [...arr]; + newArr[index] = value; + return newArr; + }); + if (!value) { + setCustomTime((arr) => { + const newArr = [...arr]; + newArr[index] = dayjs().format("YYYY-MM-DDTHH:mm"); + return newArr; + }); + } + }} + errorClassName="hidden" + /> + { + setCustomTime((arr) => { + const newArr = [...arr]; + newArr[index] = value; + return newArr; + }); + }} + disabled={!shouldAdminister[index] || !isCustomTime[index]} + min={dayjs(obj.created_date).format("YYYY-MM-DDTHH:mm")} + max={dayjs().format("YYYY-MM-DDTHH:mm")} + /> +
+
))} diff --git a/src/Components/Medicine/PrescriptionAdministrationsTable.tsx b/src/Components/Medicine/PrescriptionAdministrationsTable.tsx index c60d531baa3..81282126d7c 100644 --- a/src/Components/Medicine/PrescriptionAdministrationsTable.tsx +++ b/src/Components/Medicine/PrescriptionAdministrationsTable.tsx @@ -85,7 +85,7 @@ export default function PrescriptionAdministrationsTable({ {state?.prescriptions && ( diff --git a/src/Components/Medicine/models.ts b/src/Components/Medicine/models.ts index cb48e9cc174..62aea46b6d2 100644 --- a/src/Components/Medicine/models.ts +++ b/src/Components/Medicine/models.ts @@ -53,8 +53,8 @@ export type MedicineAdministrationRecord = { readonly id?: string; readonly prescription?: Prescription; notes: string; + administered_date?: string; readonly administered_by?: PerformedByModel; - readonly administered_date?: string; readonly created_date?: string; readonly modified_date?: string; }; From dcc7b70e1c77c11184e6606db058f30c95ca1ac9 Mon Sep 17 00:00:00 2001 From: Ashesh <3626859+Ashesh3@users.noreply.github.com> Date: Wed, 6 Sep 2023 13:35:44 +0530 Subject: [PATCH 09/20] Fix casing of plausible goal properties (#6229) --- src/Components/Facility/ConsultationDetails.tsx | 2 +- src/Components/Patient/PatientHome.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Components/Facility/ConsultationDetails.tsx b/src/Components/Facility/ConsultationDetails.tsx index 257d3712544..6aa7b683ab5 100644 --- a/src/Components/Facility/ConsultationDetails.tsx +++ b/src/Components/Facility/ConsultationDetails.tsx @@ -226,7 +226,7 @@ export const ConsultationDetails = (props: any) => { triggerGoal("Patient Consultation Viewed", { facilityId: facilityId, consultationId: consultationId, - userID: authUser.id, + userId: authUser.id, }); }, []); diff --git a/src/Components/Patient/PatientHome.tsx b/src/Components/Patient/PatientHome.tsx index e8a666459a8..2565bce64ba 100644 --- a/src/Components/Patient/PatientHome.tsx +++ b/src/Components/Patient/PatientHome.tsx @@ -222,7 +222,7 @@ export const PatientHome = (props: any) => { fetchpatient(status); triggerGoal("Patient Profile Viewed", { facilityId: facilityId, - userID: authUser.id, + userId: authUser.id, }); }, [dispatch, fetchpatient] From 8a6e5266554524537b346f2407639fc09377ef5a Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Wed, 6 Sep 2023 13:57:18 +0000 Subject: [PATCH 10/20] Diagnosis: Adds field Principal Diagnosis (#6218) * adds field principle diagnosis * show in consultation details * fix typo * fix cypress * try adding wait * fix tests --- cypress/e2e/patient_spec/patient_crud.cy.ts | 11 ++- .../Facility/ConsultationDetails.tsx | 16 +++++ src/Components/Facility/ConsultationForm.tsx | 68 +++++++++++++++++++ src/Components/Facility/models.tsx | 1 + 4 files changed, 95 insertions(+), 1 deletion(-) diff --git a/cypress/e2e/patient_spec/patient_crud.cy.ts b/cypress/e2e/patient_spec/patient_crud.cy.ts index b9e03851897..46afbb13d03 100644 --- a/cypress/e2e/patient_spec/patient_crud.cy.ts +++ b/cypress/e2e/patient_spec/patient_crud.cy.ts @@ -186,15 +186,24 @@ describe("Patient Creation with consultation", () => { cy.get("#weight").click().type("70"); cy.get("#height").click().type("170"); cy.get("#patient_no").type("IP007"); + + cy.intercept("GET", "**/icd/**").as("getIcdResults"); cy.get( "#icd11_diagnoses_object input[placeholder='Select'][role='combobox']" ) .click() .type("1A"); - cy.wait(1000); cy.get("#icd11_diagnoses_object [role='option']") .contains("1A03 Intestinal infections due to Escherichia coli") .click(); + cy.get("label[for='icd11_diagnoses_object']").click(); + cy.wait("@getIcdResults").its("response.statusCode").should("eq", 200); + + cy.get("#icd11_principal_diagnosis [role='combobox']").click().type("1A"); + cy.get("#icd11_principal_diagnosis [role='option']") + .contains("1A03 Intestinal infections due to Escherichia coli") + .click(); + cy.get("#consultation_notes").click().type("generalnote"); cy.get("#verified_by").click().type("generalnote"); cy.get("#submit").click(); diff --git a/src/Components/Facility/ConsultationDetails.tsx b/src/Components/Facility/ConsultationDetails.tsx index 6aa7b683ab5..30cbd1afdb7 100644 --- a/src/Components/Facility/ConsultationDetails.tsx +++ b/src/Components/Facility/ConsultationDetails.tsx @@ -430,6 +430,22 @@ export const ConsultationDetails = (props: any) => {
)*/} + {consultationData.icd11_principal_diagnosis && ( + + d.id === consultationData.icd11_principal_diagnosis + )!, + ]} + /> + )} + import("../Common/Loading")); const PageTitle = lazy(() => import("../Common/PageTitle")); @@ -80,6 +81,7 @@ type FormDetails = { referred_to_external?: string; icd11_diagnoses_object: ICD11DiagnosisModel[]; icd11_provisional_diagnoses_object: ICD11DiagnosisModel[]; + icd11_principal_diagnosis?: ICD11DiagnosisModel["id"]; verified_by: string; is_kasp: BooleanStrings; kasp_enabled_date: null; @@ -124,6 +126,7 @@ const initForm: FormDetails = { referred_to_external: "", icd11_diagnoses_object: [], icd11_provisional_diagnoses_object: [], + icd11_principal_diagnosis: undefined, verified_by: "", is_kasp: "false", kasp_enabled_date: null, @@ -551,6 +554,42 @@ export const ConsultationForm = (props: any) => { return; } + case "icd11_principal_diagnosis": { + if (!state.form[field]) { + errors[field] = "Please select Principal Diagnosis"; + invalidForm = true; + break; + } + + if ( + state.form[field] && + state.form["icd11_diagnoses_object"].length && + !state.form["icd11_diagnoses_object"] + .map((d) => d.id) + .includes(state.form[field]!) + ) { + errors[field] = + "Please select Principal Diagnosis from Final Diagnosis"; + invalidForm = true; + break; + } + + if ( + state.form[field] && + state.form["icd11_provisional_diagnoses_object"].length && + !state.form["icd11_provisional_diagnoses_object"] + .map((d) => d.id) + .includes(state.form[field]!) + ) { + errors[field] = + "Please select Principal Diagnosis from Provisional Diagnosis"; + invalidForm = true; + break; + } + + return; + } + default: return; } @@ -630,6 +669,7 @@ export const ConsultationForm = (props: any) => { state.form.icd11_provisional_diagnoses_object.map( (o: ICD11DiagnosisModel) => o.id ), + icd11_principal_diagnosis: state.form.icd11_principal_diagnosis, verified_by: state.form.verified_by, investigation: state.form.InvestigationAdvice, procedure: state.form.procedures, @@ -718,6 +758,18 @@ export const ConsultationForm = (props: any) => { verified_by: "Declared Dead", }, }); + } else if ( + event.name === "icd11_diagnoses_object" || + event.name === "icd11_provisional_diagnoses_object" + ) { + dispatch({ + type: "set_form", + form: { + ...state.form, + [event.name]: event.value, + icd11_principal_diagnosis: undefined, + }, + }); } else { dispatch({ type: "set_form", @@ -1152,6 +1204,22 @@ export const ConsultationForm = (props: any) => { label="Final Diagnosis" />
+ +
+ option.label} + optionValue={(option) => option.id} + required + /> +
diff --git a/src/Components/Facility/models.tsx b/src/Components/Facility/models.tsx index 5c24c80687a..9666f20cfb8 100644 --- a/src/Components/Facility/models.tsx +++ b/src/Components/Facility/models.tsx @@ -112,6 +112,7 @@ export interface ConsultationModel { diagnosis?: string; icd11_diagnoses_object?: ICD11DiagnosisModel[]; icd11_provisional_diagnoses_object?: ICD11DiagnosisModel[]; + icd11_principal_diagnosis?: ICD11DiagnosisModel["id"]; verified_by?: string; suggestion_text?: string; symptoms?: Array; From b94851c0e40d0810d30d4c677a5f0d060e9cbe9a Mon Sep 17 00:00:00 2001 From: Ashesh <3626859+Ashesh3@users.noreply.github.com> Date: Wed, 6 Sep 2023 19:27:48 +0530 Subject: [PATCH 11/20] open pdf file preview in new tab (#6226) --- src/Components/Patient/FileUpload.tsx | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/Components/Patient/FileUpload.tsx b/src/Components/Patient/FileUpload.tsx index 3fb0fde6229..fe0881e6994 100644 --- a/src/Components/Patient/FileUpload.tsx +++ b/src/Components/Patient/FileUpload.tsx @@ -481,15 +481,20 @@ export const FileUpload = (props: FileUploadProps) => { }; const responseData = await dispatch(retrieveUpload(data, id)); const file_extension = getExtension(responseData.data.read_signed_url); - setFileState({ - ...file_state, - open: true, - name: responseData.data.name, - extension: file_extension, - isImage: ExtImage.includes(file_extension), - }); - downloadFileUrl(responseData.data.read_signed_url); - setFileUrl(responseData.data.read_signed_url); + if (file_extension === "pdf") { + window.open(responseData.data.read_signed_url, "_blank"); + setFileState({ ...file_state, open: false }); + } else { + setFileState({ + ...file_state, + open: true, + name: responseData.data.name, + extension: file_extension, + isImage: ExtImage.includes(file_extension), + }); + downloadFileUrl(responseData.data.read_signed_url); + setFileUrl(responseData.data.read_signed_url); + } }; const validateEditFileName = (name: any) => { @@ -1457,7 +1462,7 @@ export const FileUpload = (props: FileUploadProps) => {
)} -
+
Date: Wed, 6 Sep 2023 19:28:41 +0530 Subject: [PATCH 12/20] Changed weekly to average weekly for working hours (#6228) * Added padding to count block on patients page * fixed date format in asset manage page * Merged configure facility and configure health facility in one page * removed commented code * changed weekly to average weekly for working hours --- src/Components/Users/ManageUsers.tsx | 13 ++++++++----- src/Components/Users/UserProfile.tsx | 9 ++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Components/Users/ManageUsers.tsx b/src/Components/Users/ManageUsers.tsx index 99cb11e7e6f..d2e0ca415e3 100644 --- a/src/Components/Users/ManageUsers.tsx +++ b/src/Components/Users/ManageUsers.tsx @@ -387,7 +387,10 @@ export default function ManageUsers() { )}
- + {user.weekly_working_hours ? ( {user.weekly_working_hours} hours @@ -438,7 +441,7 @@ export default function ManageUsers() { }} > -

Set weekly working hours

+

Set Average weekly working hours

)} @@ -492,7 +495,7 @@ export default function ManageUsers() { open={expandWorkingHours} setOpen={setExpandWorkingHours} slideFrom="right" - title="Weekly working hours" + title="Average weekly working hours" dialogClass="md:w-[400px]" onCloseClick={() => { setWeeklyHours(0); @@ -500,7 +503,7 @@ export default function ManageUsers() { >
- Set weekly working hours for {selectedUser} + Set Average weekly working hours for {selectedUser}
168 - ? "Weekly working hours should be between 0 and 168" + ? "Average weekly working hours should be between 0 and 168" : "" } required diff --git a/src/Components/Users/UserProfile.tsx b/src/Components/Users/UserProfile.tsx index 37178a2e0cc..3fb4bccc7c7 100644 --- a/src/Components/Users/UserProfile.tsx +++ b/src/Components/Users/UserProfile.tsx @@ -264,7 +264,7 @@ export default function UserProfile() { !/^\d+$/.test(states.form[field] ?? "") ) { errors[field] = - "Weekly working hours must be a number between 0 and 168"; + "Average weekly working hours must be a number between 0 and 168"; invalidForm = true; } return; @@ -416,7 +416,7 @@ export default function UserProfile() { }; return (
-
+
@@ -559,7 +559,7 @@ export default function UserProfile() {
- Weekly working hours + Average weekly working hours
{details.weekly_working_hours ?? "-"} @@ -568,7 +568,6 @@ export default function UserProfile() {
)} - {showEdit && (
@@ -661,7 +660,7 @@ export default function UserProfile() { Date: Thu, 7 Sep 2023 15:18:28 +0530 Subject: [PATCH 13/20] Fix fullscreen button for IOS (#6225) * Fix fullscreen button for IOS * Fix fullscreen --- src/Common/hooks/useFullscreen.ts | 18 ++++++++++++++++-- src/Common/hooks/useMessageListener.ts | 6 +++--- .../Facility/ConsultationDetails.tsx | 8 ++++---- src/Components/Facility/Consultations/Feed.tsx | 9 ++++++++- src/Components/Facility/DischargeModal.tsx | 2 +- 5 files changed, 32 insertions(+), 11 deletions(-) diff --git a/src/Common/hooks/useFullscreen.ts b/src/Common/hooks/useFullscreen.ts index e409af1174c..f00dbfb0c5b 100644 --- a/src/Common/hooks/useFullscreen.ts +++ b/src/Common/hooks/useFullscreen.ts @@ -18,11 +18,25 @@ export default function useFullscreen(): [ document.removeEventListener("fullscreenchange", onFullscreenChange); }, []); + function openFullscreen(elem: HTMLElement) { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + if (elem.webkitEnterFullscreen) elem.webkitEnterFullscreen(); // Safari + else elem.requestFullscreen(); + } + + function exitFullscreen(elem: HTMLElement) { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + if (elem.webkitExitFullscreen) elem.webkitExitFullscreen(); // Safari + else document.exitFullscreen(); + } + const setFullscreen = (value: boolean, element?: HTMLElement) => { const fullscreenElement = element ?? document.documentElement; - if (value) fullscreenElement.requestFullscreen(); - else document.exitFullscreen(); + if (value) openFullscreen(fullscreenElement); + else exitFullscreen(fullscreenElement); }; return [isFullscreen, setFullscreen]; diff --git a/src/Common/hooks/useMessageListener.ts b/src/Common/hooks/useMessageListener.ts index eb5673da7fc..9dba3a18e58 100644 --- a/src/Common/hooks/useMessageListener.ts +++ b/src/Common/hooks/useMessageListener.ts @@ -5,12 +5,12 @@ type onMessage = (data: any) => void; export const useMessageListener = (onMessage: onMessage) => { useEffect(() => { const handleMessage = (e: MessageEvent) => { - onMessage(e.data); + onMessage?.(e.data); }; - navigator.serviceWorker.addEventListener("message", handleMessage); + navigator.serviceWorker?.addEventListener?.("message", handleMessage); return () => { - navigator.serviceWorker.removeEventListener("message", handleMessage); + navigator.serviceWorker?.removeEventListener?.("message", handleMessage); }; }); }; diff --git a/src/Components/Facility/ConsultationDetails.tsx b/src/Components/Facility/ConsultationDetails.tsx index 30cbd1afdb7..194d6629fc8 100644 --- a/src/Components/Facility/ConsultationDetails.tsx +++ b/src/Components/Facility/ConsultationDetails.tsx @@ -120,10 +120,10 @@ export const ConsultationDetails = (props: any) => { ]); const { middleware_address } = facilityRes.data as FacilityModel; - const assetBeds = assetBedRes.data.results as AssetBedModel[]; + const assetBeds = assetBedRes?.data?.results as AssetBedModel[]; - const monitorBedData = assetBeds.find( - (i) => i.asset_object.asset_class === AssetClass.HL7MONITOR + const monitorBedData = assetBeds?.find( + (i) => i.asset_object?.asset_class === AssetClass.HL7MONITOR ); setMonitorBedData(monitorBedData); const assetDataForMonitor = monitorBedData?.asset_object; @@ -146,7 +146,7 @@ export const ConsultationDetails = (props: any) => { bed_object: consultationData?.current_bed?.bed_object, } as AssetBedModel; } else { - ventilatorBedData = assetBeds.find( + ventilatorBedData = assetBeds?.find( (i) => i.asset_object.asset_class === AssetClass.VENTILATOR ); } diff --git a/src/Components/Facility/Consultations/Feed.tsx b/src/Components/Facility/Consultations/Feed.tsx index caca55102ca..07fd6f31739 100644 --- a/src/Components/Facility/Consultations/Feed.tsx +++ b/src/Components/Facility/Consultations/Feed.tsx @@ -98,7 +98,7 @@ export const Feed: React.FC = ({ consultationId, facilityId }) => { async (status: statusType) => { setIsLoading(true); const res = await dispatch(getConsultation(consultationId)); - if (!status.aborted && res.data) { + if (!status.aborted && res?.data) { const consultation = res.data as ConsultationModel; const consultationBedId = consultation.current_bed?.bed_object?.id; if (consultationBedId) { @@ -302,6 +302,12 @@ export const Feed: React.FC = ({ consultationId, facilityId }) => { }); }, fullScreen: () => { + if (isIOS) { + const element = document.querySelector("video"); + if (!element) return; + setFullscreen(true, element as HTMLElement); + return; + } if (!liveFeedPlayerRef.current) return; setFullscreen( !isFullscreen, @@ -500,6 +506,7 @@ export const Feed: React.FC = ({ consultationId, facilityId }) => {
{["fullScreen", "reset", "updatePreset", "zoomIn", "zoomOut"].map( (button, index) => { + if (isIOS && button === "reset") return null; const option = cameraPTZ.find( (option) => option.action === button ); diff --git a/src/Components/Facility/DischargeModal.tsx b/src/Components/Facility/DischargeModal.tsx index 5e13b038bab..8376a0ad299 100644 --- a/src/Components/Facility/DischargeModal.tsx +++ b/src/Components/Facility/DischargeModal.tsx @@ -87,7 +87,7 @@ const DischargeModal = ({ }) ); - if (res.data?.results?.length) { + if (res?.data?.results?.length > 0) { setLatestClaim(res.data.results[0]); if (isCreateClaimLoading) Notification.Success({ msg: "Fetched Claim Approval Results" }); From 3f1a0cbe09d697a9b8cb42e9f69408dabf9a032d Mon Sep 17 00:00:00 2001 From: Shivam Jha <86483059+ShivamJhaa@users.noreply.github.com> Date: Thu, 7 Sep 2023 17:43:45 +0530 Subject: [PATCH 14/20] Added test for importing and configuring an asset and migrated patient_crud.ts to POM approach (#5870) * Added test for importing and configuring an asset * Revert few changes * nits * Migrated to POM approach * Migrated patient_crud to POM approach * reverted some chnages * FIx * Merge conflicts * Fixed test * add responsiveness to virtual nursing assistant card (#6130) * allow use stock as well (#6115) * fixed responsive issue of 'Update Log' button in patient consultation page (#6113) * fix multiple bed bug (#6111) * Fixed typo in Date format in Asset management (#6105) * Added padding to count block on patients page * fixed date format in asset manage page * show only items with no min value (#6103) * check for id in response (#6100) * Added Responsiveness to File upload (#6096) * add responsiveness * refactor * remove overlap (#6094) * fixed failing test * Fix * Fixed comments * fix comments * Fixed all comments --------- Co-authored-by: Pranshu Aggarwal <70687348+Pranshu1902@users.noreply.github.com> Co-authored-by: Gokulram A Co-authored-by: Kshitij Verma <101321276+kshitijv256@users.noreply.github.com> Co-authored-by: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> --- cypress/e2e/assets_spec/assets_manage.cy.ts | 68 ++++- cypress/e2e/patient_spec/patient_crud.cy.ts | 287 ++++++------------ cypress/fixtures/sampleAsset.xlsx | Bin 0 -> 45398 bytes cypress/pageobject/Asset/AssetCreation.ts | 97 +++++- .../pageobject/Patient/PatientConsultation.ts | 108 +++++++ cypress/pageobject/Patient/PatientCreation.ts | 127 ++++++++ cypress/pageobject/Patient/PatientUpdate.ts | 97 ++++++ cypress/pageobject/constants.ts | 4 + src/Components/Assets/AssetImportModal.tsx | 3 +- src/Components/Assets/AssetManage.tsx | 1 + src/Components/Assets/AssetsList.tsx | 6 +- src/Components/Patient/PatientHome.tsx | 15 +- 12 files changed, 612 insertions(+), 201 deletions(-) create mode 100644 cypress/fixtures/sampleAsset.xlsx create mode 100644 cypress/pageobject/Patient/PatientConsultation.ts create mode 100644 cypress/pageobject/Patient/PatientCreation.ts create mode 100644 cypress/pageobject/Patient/PatientUpdate.ts create mode 100644 cypress/pageobject/constants.ts diff --git a/cypress/e2e/assets_spec/assets_manage.cy.ts b/cypress/e2e/assets_spec/assets_manage.cy.ts index d04a7733c0d..af3efb917dd 100644 --- a/cypress/e2e/assets_spec/assets_manage.cy.ts +++ b/cypress/e2e/assets_spec/assets_manage.cy.ts @@ -1,4 +1,5 @@ /// +import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress"; import { AssetPage } from "../../pageobject/Asset/AssetCreation"; import { v4 as uuidv4 } from "uuid"; import LoginPage from "../../pageobject/Login/LoginPage"; @@ -84,7 +85,9 @@ describe("Asset", () => { "Test note for asset creation!" ); + assetPage.interceptAssetCreation(); assetPage.clickCreateAsset(); + assetPage.verifyAssetCreation(); assetPage.verifySuccessNotification("Asset created successfully"); assetSearchPage.typeSearchKeyword("New Test Asset 2"); @@ -104,7 +107,8 @@ describe("Asset", () => { "Manufacturer's Name Edited", "Customer Support's Name Edited", "Vendor's Name Edited", - "Test note for asset creation edited!" + "Test note for asset creation edited!", + "25122021" ); assetPage.clickUpdateAsset(); @@ -112,11 +116,71 @@ describe("Asset", () => { assetPage.verifySuccessNotification("Asset updated successfully"); }); + it("Configure an asset", () => { + assetPage.openCreatedAsset(); + assetPage.spyAssetConfigureApi(); + assetPage.configureAsset( + "Host name", + "192.168.1.64", + "remote_user", + "2jCkrCRSeahzKEU", + "d5694af2-21e2-4a39-9bad-2fb98d9818bd" + ); + assetPage.clickConfigureAsset(); + assetPage.verifyAssetConfiguration(200); + }); + + it("Add an vital monitor asset and configure it", () => { + assetPage.createAsset(); + assetPage.selectFacility("Dummy Facility 1"); + assetPage.selectLocation("Camera Loc"); + assetPage.selectAssetType("Internal"); + assetPage.selectAssetClass("HL7 Vitals Monitor"); + + const qr_id_1 = uuidv4(); + + assetPage.enterAssetDetails( + "New Test Asset Vital", + "Test Description", + "Working", + qr_id_1, + "Manufacturer's Name", + "2025-12-25", + "Customer Support's Name", + phone_number, + "email@support.com", + "Vendor's Name", + serialNumber, + "25122021", + "Test note for asset creation!" + ); + assetPage.interceptAssetCreation(); + assetPage.clickCreateAsset(); + assetPage.verifyAssetCreation(); + + assetSearchPage.typeSearchKeyword("New Test Asset Vital"); + assetSearchPage.pressEnter(); + + assetPage.openCreatedAsset(); + assetPage.configureVitalAsset("Host name", "192.168.1.64"); + assetPage.clickConfigureVital(); + }); + it("Delete an Asset", () => { assetPage.openCreatedAsset(); + assetPage.interceptDeleteAssetApi(); assetPage.deleteAsset(); + assetPage.verifyDeleteStatus(); + }); + + it("Import new asset", () => { + assetPage.selectImportOption(); + assetPage.selectImportFacility("Dummy Facility 1"); + assetPage.importAssetFile(); + assetPage.selectImportLocation("Camera Locations"); + assetPage.clickImportAsset(); - assetPage.verifySuccessNotification("Asset deleted successfully"); + assetPage.verifySuccessNotification("Assets imported successfully"); }); afterEach(() => { diff --git a/cypress/e2e/patient_spec/patient_crud.cy.ts b/cypress/e2e/patient_spec/patient_crud.cy.ts index 46afbb13d03..af639783a80 100644 --- a/cypress/e2e/patient_spec/patient_crud.cy.ts +++ b/cypress/e2e/patient_spec/patient_crud.cy.ts @@ -1,12 +1,13 @@ import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress"; - -const username = "devdistrictadmin"; -const password = "Coronasafe@123"; -const phone_number = "9" + Math.floor(100000000 + Math.random() * 900000000); -const emergency_phone_number = - "9" + Math.floor(100000000 + Math.random() * 900000000); +import LoginPage from "../../pageobject/Login/LoginPage"; +import { PatientPage } from "../../pageobject/Patient/PatientCreation"; +import { UpdatePatientPage } from "../../pageobject/Patient/PatientUpdate"; +import { PatientConsultationPage } from "../../pageobject/Patient/PatientConsultation"; +import { + emergency_phone_number, + phone_number, +} from "../../pageobject/constants"; const yearOfBirth = "2023"; -let patient_url = ""; const calculateAge = () => { const currentYear = new Date().getFullYear(); @@ -14,8 +15,13 @@ const calculateAge = () => { }; describe("Patient Creation with consultation", () => { + const loginPage = new LoginPage(); + const patientPage = new PatientPage(); + const updatePatientPage = new UpdatePatientPage(); + const patientConsultationPage = new PatientConsultationPage(); + before(() => { - cy.loginByApi(username, password); + loginPage.loginAsDisctrictAdmin(); cy.saveLocalStorage(); }); @@ -25,208 +31,105 @@ describe("Patient Creation with consultation", () => { }); it("Create a new patient with no consultation", () => { - cy.get("#add-patient-details").should("be.visible"); - cy.get("#add-patient-details").click(); - cy.get("input[name='facilities']") - .type("dummy facility") - .then(() => { - cy.get("[role='option']").first().click(); - }); - cy.get("button").should("contain", "Select"); - cy.get("button").get("#submit").click(); - cy.get("#phone_number-div").type(phone_number); - cy.get("#emergency_phone_number-div").type(emergency_phone_number); - cy.get("#date_of_birth").should("be.visible").click(); - cy.get("#date-input").click().type("01082023"); - cy.get("[data-testid=name] input").type("Test E2E User"); - cy.get("[data-testid=Gender] button") - .click() - .then(() => { - cy.get("[role='option']").contains("Male").click(); - }); - cy.get("[data-testid=current-address] textarea").type( - "Test Patient Address" + patientPage.createPatient(); + patientPage.selectFacility("dummy facility"); + patientPage.enterPatientDetails( + phone_number, + emergency_phone_number, + "Test E2E User", + "Male", + "Test Patient Address", + "682001", + "1: PAZHAMTHOTTAM", + "O+", + "01012001" ); - cy.get("[data-testid=permanent-address] input").check(); - cy.get("#pincode").type("682001"); - cy.get("[data-testid=localbody] button") - .click() - .then(() => { - cy.get("[role='option']").first().click(); - }); - cy.get("[data-testid=ward-respective-lsgi] button") - .click() - .then(() => { - cy.get("[role='option']").contains("1: PAZHAMTHOTTAM").click(); - }); - cy.get("[name=medical_history_check_1]").check(); - cy.get("[data-testid=blood-group] button") - .click() - .then(() => { - cy.get("[role='option']").contains("O+").click(); - }); - cy.get("button[data-testid='submit-button']").click(); + patientPage.clickCreatePatient(); - cy.get("h2").should("contain", "Create Consultation"); - cy.url().should("include", "/patient"); - cy.url().then((url) => { - cy.log(url); - patient_url = url.split("/").slice(0, -1).join("/"); - cy.log(patient_url); - }); + patientPage.verifyPatientIsCreated(); + patientPage.saveCreatedPatientUrl(); }); it("Patient Detail verification post registration", () => { - cy.log(patient_url); - cy.awaitUrl(patient_url); - cy.url().should("include", "/facility/"); - cy.get("[data-testid=patient-dashboard]").should("contain", calculateAge()); - cy.get("[data-testid=patient-dashboard]").should( - "contain", - "Test E2E User" - ); - cy.get("[data-testid=patient-dashboard]").should("contain", phone_number); - cy.get("[data-testid=patient-dashboard]").should( - "contain", - emergency_phone_number + patientPage.interceptFacilities(); + patientPage.visitCreatedPatient(); + patientPage.verifyStatusCode(); + const age = calculateAge(); + patientPage.verifyPatientDetails( + age, + "Test E2E User", + phone_number, + emergency_phone_number, + yearOfBirth, + "O+" ); - cy.get("[data-testid=patient-dashboard]").should("contain", yearOfBirth); - cy.get("[data-testid=patient-dashboard]").should("contain", "O+"); }); it("Edit the patient details", () => { - cy.intercept("GET", "**/facility/*/patient/**").as("getFacilities"); - cy.awaitUrl(patient_url + "/update"); - cy.wait("@getFacilities").its("response.statusCode").should("eq", 200); - cy.wait(10000); - cy.get("#address").scrollIntoView(); - cy.get("#address").should("be.visible"); - cy.get("#address").type("Test Patient Address Edited"); - cy.get("[data-testid=name] input").clear(); - cy.get("[data-testid=name] input").type("Test E2E User Edited"); - cy.get("#phone_number-div").clear(); - cy.get("#phone_number-div").type("+91").type(phone_number); - cy.get("#emergency_phone_number-div").clear(); - cy.get("#emergency_phone_number-div") - .type("+91") - .type(emergency_phone_number); - cy.get("#present_health").type("Severe Cough"); - cy.get("#ongoing_medication").type("Paracetamol"); - cy.get("#allergies").type("Dust"); - cy.get("[name=medical_history_check_1]").uncheck(); - cy.get("[name=medical_history_check_2]").check(); - cy.get("#medical_history_2").type("2 months ago"); - cy.get("[name=medical_history_check_3]").check(); - cy.get("#medical_history_3").type("1 month ago"); - cy.get("button").get("[data-testid=add-insurance-button]").click(); - cy.get("#subscriber_id").type("SUB123"); - cy.get("#policy_id").type("P123"); - cy.get("#insurer_id").type("GICOFINDIA"); - cy.get("#insurer_name").type("GICOFINDIA"); - cy.get("[data-testid=blood-group] button") - .click() - .then(() => { - cy.get("[role='option']").contains("O+").click(); - }); - cy.get("button[data-testid='submit-button']").click(); - cy.url().should("include", "/patient"); - cy.url().then((url) => { - cy.log(url); - patient_url = url.split("/").slice(0, -1).join("/"); - cy.log(patient_url); - }); - }); - - it("Patient Detail verification post edit", () => { - cy.log(patient_url); - cy.awaitUrl(patient_url); - cy.url().should("include", "/facility/"); - cy.get("[data-testid=patient-dashboard]").should( - "contain", - "Test E2E User Edited" - ); - cy.get("[data-testid=patient-dashboard]").should("contain", phone_number); - const patientDetails_values: string[] = [ + patientPage.interceptFacilities(); + patientPage.visitUpdatePatientUrl(); + patientPage.verifyStatusCode(); + updatePatientPage.enterPatientDetails( + "Test E2E User Edited", + "O+", + phone_number, + emergency_phone_number, + "Test Patient Address Edited", "Severe Cough", "Paracetamol", "Dust", - "Diabetes", - "2 months ago", - "Heart Disease", - "1 month ago", - ]; + ["2 months ago", "1 month ago"], + "SUB123", + "P123", + "GICOFINDIA", + "GICOFINDIA" + ); + updatePatientPage.clickUpdatePatient(); - patientDetails_values.forEach((value) => { - cy.get("[data-testid=patient-details]").should("contain", value); - }); + updatePatientPage.verifyPatientUpdated(); + updatePatientPage.saveUpdatedPatientUrl(); }); - it("Create a New consultation to existing patient", () => { - cy.intercept("GET", "**/api/v1/patient/**").as("getFacilities"); - cy.visit(patient_url + "/consultation"); - cy.wait("@getFacilities").its("response.statusCode").should("eq", 200); - cy.get("#history_of_present_illness").scrollIntoView; - cy.get("#history_of_present_illness").should("be.visible"); - cy.get("#history_of_present_illness").click().type("histroy"); - cy.get("#consultation_status") - .click() - .then(() => { - cy.get("[role='option']").contains("Out-patient (walk in)").click(); - }); - cy.get("#symptoms") - .click() - .then(() => { - cy.get("[role='option']").contains("ASYMPTOMATIC").click(); - }); - cy.get("#symptoms").click(); - - cy.get("#examination_details") - .click() - .type("Examination details and Clinical conditions"); - cy.get("#weight").click().type("70"); - cy.get("#height").click().type("170"); - cy.get("#patient_no").type("IP007"); - - cy.intercept("GET", "**/icd/**").as("getIcdResults"); - cy.get( - "#icd11_diagnoses_object input[placeholder='Select'][role='combobox']" - ) - .click() - .type("1A"); - cy.get("#icd11_diagnoses_object [role='option']") - .contains("1A03 Intestinal infections due to Escherichia coli") - .click(); - cy.get("label[for='icd11_diagnoses_object']").click(); - cy.wait("@getIcdResults").its("response.statusCode").should("eq", 200); + it("Patient Detail verification post edit", () => { + patientPage.interceptFacilities(); + updatePatientPage.visitUpdatedPatient(); + patientPage.verifyStatusCode(); - cy.get("#icd11_principal_diagnosis [role='combobox']").click().type("1A"); - cy.get("#icd11_principal_diagnosis [role='option']") - .contains("1A03 Intestinal infections due to Escherichia coli") - .click(); + updatePatientPage.verifyPatientDetails( + "Test E2E User Edited", + phone_number, + "Severe Cough", + "Paracetamol", + "Dust" + ); + }); - cy.get("#consultation_notes").click().type("generalnote"); - cy.get("#verified_by").click().type("generalnote"); - cy.get("#submit").click(); + it("Create a New consultation to existing patient", () => { + patientPage.interceptFacilities(); + updatePatientPage.visitConsultationPage(); + patientPage.verifyStatusCode(); + patientConsultationPage.fillIllnessHistory("history"); + patientConsultationPage.selectConsultationStatus("Out-patient (walk in)"); + patientConsultationPage.selectSymptoms("ASYMPTOMATIC"); + + patientConsultationPage.enterConsultationDetails( + "Examination details and Clinical conditions", + "70", + "170", + "IP007", + "generalnote", + "generalnote" + ); + patientConsultationPage.submitConsultation(); // Below code for the prescription module only present while creating a new consultation - cy.contains("button", "Add Prescription Medication") - .should("be.visible") - .click(); - cy.intercept("GET", "**/api/v1/medibase/**").as("getFacilities"); - cy.get( - "div#medicine_object input[placeholder='Select'][role='combobox']" - ).click(); - cy.wait("@getFacilities").its("response.statusCode").should("eq", 200); - cy.get("div#medicine_object input[placeholder='Select'][role='combobox']") - .click() - .type("dolo{enter}"); - cy.get("#dosage").type("3", { force: true }); - cy.get("#frequency") - .click() - .then(() => { - cy.get("div#frequency [role='option']").contains("Twice daily").click(); - }); - cy.get("button#submit").should("be.visible").click(); - cy.get("[data-testid='return-to-patient-dashboard']").click(); + patientConsultationPage.clickAddPrescription(); + patientConsultationPage.interceptMediaBase(); + patientConsultationPage.selectMedicinebox(); + patientConsultationPage.waitForMediabaseStatusCode(); + patientConsultationPage.prescribeMedicine(); + patientConsultationPage.enterDosage("3"); + patientConsultationPage.selectDosageFrequency("Twice daily"); + patientConsultationPage.submitPrescriptionAndReturn(); }); afterEach(() => { diff --git a/cypress/fixtures/sampleAsset.xlsx b/cypress/fixtures/sampleAsset.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..f8e234ce4477934a0426a088783ba4988500f7aa GIT binary patch literal 45398 zcmeHw30TbA8-EvBvV=;M43QR;NKrIMDeViW4uqW&`q=Osh-A$8fEXy-iorC5a3knQ+iPnE+0uwzn5H+N>OEfK0OeSD# zy|wGI6%>;1Eva0S8kpqMx<4BgzN&*+W%GbKEFCO#934)5*BW!NnV^`f-8Z!|7of=j z1)NV>A+5d@o78@`9YHvelY`@oAO{D}kHzSPr6paFcHKv`9q_WeREY~c2@~3}JnuG{ z7usWGkk_Mx+@nN{%r!61P!kda*p|#SQ@~??l@-uiY_s-FnBFE_YR9o%7E`b31R88oaq~ zvs|^3K!;NB6uYyIMU zy}Z%{^0x3QK`|6Kzkrj+V!zKXz5}a+-&0>OPw@ z%$0kj*;sw-EHWXz{?P|xktSm-E~~yX;b7m<%LwBa+==l?p!`C=<(jY5+c)N2f4Fj& z@73*i>(&;6YKFYNIRtD9PCzZ;A{2)~jmjZ+W5k!F~HGF2AjuuHMHi z){BliUcT9}OBqKwJzCjwTLtR#3($Y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8 zD`(pJ&uEji7i&J8xx>M6iEB2;@^5u%e<3l|rHf!W04T@#F6dz-y$9bJ53~bNpYD6r z{%DpS9#jC-Ir%QYI_3xEO}Q%HYcuPP(d2@$^q#YZGIZno-ss*RtNpm}K#)CYdFU?l vU5@GFNyS0;obLmelmK1szDrmZ|IPScw{jhIPWohB3})&pFeTg*XvO~z%H;CA literal 0 HcmV?d00001 diff --git a/cypress/pageobject/Asset/AssetCreation.ts b/cypress/pageobject/Asset/AssetCreation.ts index d24c93d0197..fdaf802d4b7 100644 --- a/cypress/pageobject/Asset/AssetCreation.ts +++ b/cypress/pageobject/Asset/AssetCreation.ts @@ -1,4 +1,5 @@ // assetPage.ts +import { cy, expect } from "local-cypress"; export class AssetPage { createAsset() { @@ -74,6 +75,14 @@ export class AssetPage { cy.get("[data-testid=asset-notes-input] textarea").type(notes); } + interceptAssetCreation() { + cy.intercept("POST", "**/api/v1/asset/").as("createAsset"); + } + + verifyAssetCreation() { + cy.wait("@createAsset").its("response.statusCode").should("eq", 201); + } + clickCreateAsset() { cy.get("#submit").contains("Create Asset").click(); } @@ -87,7 +96,9 @@ export class AssetPage { } openCreatedAsset() { + cy.intercept("GET", "**/api/v1/asset/**").as("getAsset"); cy.get("[data-testid=created-asset-list]").first().click(); + cy.wait("@getAsset").its("response.statusCode").should("eq", 200); } editAssetDetails( @@ -97,7 +108,8 @@ export class AssetPage { manufacturer: string, supportName: string, vendorName: string, - notes: string + notes: string, + lastServicedOn: string ) { cy.get("[data-testid=asset-update-button]").click(); cy.get("[data-testid=asset-name-input] input").clear().type(name); @@ -114,18 +126,71 @@ export class AssetPage { cy.get("[data-testid=asset-vendor-name-input] input") .clear() .type(vendorName); + cy.get( + "[data-testid=asset-last-serviced-on-input] input[type='text']" + ).click(); + cy.get("#date-input").click().type(lastServicedOn); cy.get("[data-testid=asset-notes-input] textarea").clear().type(notes); } + configureAsset( + hostName: string, + localIp: string, + userName: string, + password: string, + streamUuid: string + ) { + cy.get("[data-testid=asset-configure-button]").click(); + cy.get("[name=middleware_hostname]").type(hostName); + cy.get("[name=camera_address]").type(localIp); + cy.get("[name=username]").type(userName); + cy.get("[name=password]").type(password); + cy.get("[name=stream_uuid]").type(streamUuid); + } + + configureVitalAsset(hostName: string, localIp: string) { + cy.get("[data-testid=asset-configure-button]").click(); + cy.get("#middlewareHostname").type(hostName); + cy.get("#localipAddress").type(localIp); + } + + spyAssetConfigureApi() { + cy.intercept(/\/api\/v1\/asset/).as("asset"); + } + + verifyAssetConfiguration(statusCode: number) { + cy.wait("@asset").then((interception) => { + expect(interception.response.statusCode).to.equal(statusCode); + }); + } + + clickConfigureAsset() { + cy.get("#submit").contains("Set Configuration").click(); + } + + clickConfigureVital() { + cy.intercept("PATCH", "**/api/v1/asset/**").as("postConfiguration"); + cy.get("#submit").contains("Save Configuration").click(); + cy.wait("@postConfiguration").its("response.statusCode").should("eq", 200); + } + clickUpdateAsset() { cy.get("#submit").contains("Update").click(); } + interceptDeleteAssetApi() { + cy.intercept("DELETE", "**/api/v1/asset/**").as("deleteAsset"); + } + deleteAsset() { cy.get("[data-testid=asset-delete-button]").click(); cy.get("#submit").contains("Confirm").click(); } + verifyDeleteStatus() { + cy.wait("@deleteAsset").its("response.statusCode").should("eq", 204); + } + verifyEmptyAssetNameError() { cy.get("[data-testid=asset-name-input] span").should( "contain", @@ -160,4 +225,34 @@ export class AssetPage { "Please enter valid phone number" ); } + + selectImportFacility(facilityName: string) { + cy.get("input[name='facilities']") + .type(facilityName) + .then(() => { + cy.get("[role='option']").contains(facilityName).click(); + }); + } + + selectImportOption() { + cy.get("[data-testid=import-asset-button]").click(); + cy.get(".import-assets-button").click(); + } + + importAssetFile() { + cy.get("[data-testid=import-asset-file]") + .selectFile("cypress/fixtures/sampleAsset.xlsx", { force: true }) + .wait(100); + } + + selectImportLocation(locationName: string) { + cy.get("[data-testid=select-import-location]").click(); + cy.get("li[role=option]").contains(locationName).click(); + } + + clickImportAsset() { + cy.intercept("POST", "**/api/v1/asset/").as("importAsset"); + cy.get("#submit").contains("Import").click(); + cy.wait("@importAsset").its("response.statusCode").should("eq", 201); + } } diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts new file mode 100644 index 00000000000..315ef455aaa --- /dev/null +++ b/cypress/pageobject/Patient/PatientConsultation.ts @@ -0,0 +1,108 @@ +export class PatientConsultationPage { + selectConsultationStatus(status: string) { + cy.get("#consultation_status") + .click() + .then(() => { + cy.get("[role='option']").contains(status).click(); + }); + } + + selectSymptoms(symptoms: string) { + cy.get("#symptoms") + .click() + .then(() => { + cy.get("[role='option']").contains(symptoms).click(); + }); + } + + fillIllnessHistory(history: string) { + cy.get("#history_of_present_illness").scrollIntoView; + cy.get("#history_of_present_illness").should("be.visible"); + cy.get("#history_of_present_illness").click().type(history); + } + + enterConsultationDetails( + examinationDetails: string, + weight: string, + height: string, + ipNumber: string, + consulationNotes: string, + verificationBy: string + ) { + cy.get("#symptoms").click(); + cy.get("#examination_details").click().type(examinationDetails); + cy.get("#weight").click().type(height); + cy.get("#height").click().type(weight); + cy.get("#patient_no").type(ipNumber); + cy.intercept("GET", "**/icd/**").as("getIcdResults"); + cy.get( + "#icd11_diagnoses_object input[placeholder='Select'][role='combobox']" + ) + .click() + .type("1A"); + cy.get("#icd11_diagnoses_object [role='option']") + .contains("1A03 Intestinal infections due to Escherichia coli") + .click(); + cy.get("label[for='icd11_diagnoses_object']").click(); + cy.wait("@getIcdResults").its("response.statusCode").should("eq", 200); + + cy.get("#icd11_principal_diagnosis [role='combobox']").click().type("1A"); + cy.get("#icd11_principal_diagnosis [role='option']") + .contains("1A03 Intestinal infections due to Escherichia coli") + .click(); + + cy.get("#consultation_notes").click().type(consulationNotes); + cy.get("#verified_by").click().type(verificationBy); + } + + submitConsultation() { + cy.get("#submit").click(); + } + + clickAddPrescription() { + cy.contains("button", "Add Prescription Medication") + .should("be.visible") + .click(); + } + + interceptMediaBase() { + cy.intercept("GET", "**/api/v1/medibase/**").as("getMediaBase"); + } + + prescribeMedicine() { + cy.get("div#medicine_object input[placeholder='Select'][role='combobox']") + .click() + .type("dolo{enter}"); + } + + selectMedicinebox() { + cy.get( + "div#medicine_object input[placeholder='Select'][role='combobox']" + ).click(); + } + + waitForMediabaseStatusCode() { + cy.wait("@getMediaBase").its("response.statusCode").should("eq", 200); + } + + enterDosage(doseAmount: string) { + cy.get("#dosage").type(doseAmount, { force: true }); + } + + selectDosageFrequency(frequency: string) { + cy.get("#frequency") + .click() + .then(() => { + cy.get("div#frequency [role='option']").contains(frequency).click(); + }); + } + + submitPrescriptionAndReturn() { + cy.intercept("POST", "**/api/v1/consultation/*/prescriptions/").as( + "submitPrescription" + ); + cy.get("button#submit").should("be.visible").click(); + cy.get("[data-testid='return-to-patient-dashboard']").click(); + cy.wait("@submitPrescription").its("response.statusCode").should("eq", 201); + } +} diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts new file mode 100644 index 00000000000..9b8df4a287e --- /dev/null +++ b/cypress/pageobject/Patient/PatientCreation.ts @@ -0,0 +1,127 @@ +// PatientPage.ts + +let patient_url = ""; + +export class PatientPage { + createPatient() { + cy.intercept("GET", "**/api/v1/facility/**").as("getFacilities"); + cy.get("#add-patient-details").should("be.visible"); + cy.get("#add-patient-details").click(); + cy.wait("@getFacilities").its("response.statusCode").should("eq", 200); + } + + selectFacility(facilityName: string) { + cy.get("input[name='facilities']") + .type(facilityName) + .then(() => { + cy.get("[role='option']").first().click(); + }); + cy.get("button").should("contain", "Select"); + cy.get("button").get("#submit").click(); + } + + interceptCreatePatientAPI() { + cy.intercept("GET", "**/facility/*/patient/**").as("createPatient"); + } + + verifyCreatedPatientResponse() { + cy.wait("@createPatient").its("response.statusCode").should("eq", 200); + } + + enterPatientDetails( + phoneNumber: string, + emergencyPhoneNumber: string, + patientName: string, + gender: string, + address: string, + pincode: string, + wardName: string, + bloodGroup: string, + dateOfBirth: string + ) { + cy.get("#phone_number-div").type(phoneNumber); + cy.get("#emergency_phone_number-div").type(emergencyPhoneNumber); + cy.get("#date_of_birth").should("be.visible").click(); + cy.get("#date-input").click().type(dateOfBirth); + cy.get("[data-testid=name] input").type(patientName); + cy.get("[data-testid=Gender] button") + .click() + .then(() => { + cy.get("[role='option']").contains(gender).click(); + }); + cy.get("[data-testid=current-address] textarea").type(address); + cy.get("[data-testid=permanent-address] input").check(); + cy.get("#pincode").type(pincode); + cy.get("[data-testid=localbody] button") + .click() + .then(() => { + cy.get("[role='option']").first().click(); + }); + cy.get("[data-testid=ward-respective-lsgi] button") + .click() + .then(() => { + cy.get("[role='option']").contains(wardName).click(); + }); + cy.get("[name=medical_history_check_1]").check(); + cy.get("[data-testid=blood-group] button") + .click() + .then(() => { + cy.get("[role='option']").contains(bloodGroup).click(); + }); + } + + clickCreatePatient() { + cy.intercept("POST", "**/api/v1/patient/").as("createPatient"); + cy.get("button[data-testid='submit-button']").click(); + cy.wait("@createPatient").its("response.statusCode").should("eq", 201); + } + + verifyPatientIsCreated() { + cy.get("h2").should("contain", "Create Consultation"); + cy.url().should("include", "/patient"); + } + + saveCreatedPatientUrl() { + cy.url().then((url) => { + cy.log(url); + patient_url = url.split("/").slice(0, -1).join("/"); + cy.log(patient_url); + }); + } + + visitCreatedPatient() { + cy.awaitUrl(patient_url); + } + + verifyPatientDetails( + age: number, + patientName: string, + phoneNumber: string, + emergencyPhoneNumber: string, + yearOfBirth: string, + bloodGroup: string + ) { + cy.url().should("include", "/facility/"); + cy.get("[data-testid=patient-dashboard]").should("contain", age); + cy.get("[data-testid=patient-dashboard]").should("contain", patientName); + cy.get("[data-testid=patient-dashboard]").should("contain", phoneNumber); + cy.get("[data-testid=patient-dashboard]").should( + "contain", + emergencyPhoneNumber + ); + cy.get("[data-testid=patient-dashboard]").should("contain", yearOfBirth); + cy.get("[data-testid=patient-dashboard]").should("contain", bloodGroup); + } + + visitUpdatePatientUrl() { + cy.awaitUrl(patient_url + "/update"); + } + + interceptFacilities() { + cy.intercept("GET", "**/facility/*/patient/**").as("getFacilities"); + } + + verifyStatusCode() { + cy.wait("@getFacilities").its("response.statusCode").should("eq", 200); + } +} diff --git a/cypress/pageobject/Patient/PatientUpdate.ts b/cypress/pageobject/Patient/PatientUpdate.ts new file mode 100644 index 00000000000..b26ef678679 --- /dev/null +++ b/cypress/pageobject/Patient/PatientUpdate.ts @@ -0,0 +1,97 @@ +let patient_url = ""; + +export class UpdatePatientPage { + enterPatientDetails( + patientName: string, + bloodGroup: string, + phoneNumber: string, + emergencyPhoneNumber: string, + address: string, + currentHealthCondition: string, + ongoingMedication: string, + allergies: string, + medicalHistory: string[], + subscriberId: string, + policyId: string, + insuranceId: string, + insuranceName: string + ) { + cy.wait(10000); + cy.get("#address").scrollIntoView(); + cy.get("#address").should("be.visible"); + cy.get("#address").type(address); + cy.get("[data-testid=name] input").clear(); + cy.get("[data-testid=name] input").type(patientName); + cy.get("#phone_number-div").clear(); + cy.get("#phone_number-div").type("+91").type(phoneNumber); + cy.get("#emergency_phone_number-div").clear(); + cy.get("#emergency_phone_number-div") + .type("+91") + .type(emergencyPhoneNumber); + cy.get("#present_health").type(currentHealthCondition); + cy.get("#ongoing_medication").type(ongoingMedication); + cy.get("#allergies").type(allergies); + cy.get("[name=medical_history_check_1]").uncheck(); + cy.get("[name=medical_history_check_2]").check(); + cy.get("#medical_history_2").type(medicalHistory[0]); + cy.get("[name=medical_history_check_3]").check(); + cy.get("#medical_history_3").type(medicalHistory[1]); + cy.get("button").get("[data-testid=add-insurance-button]").click(); + cy.get("#subscriber_id").type(subscriberId); + cy.get("#policy_id").type(policyId); + cy.get("#insurer_id").type(insuranceId); + cy.get("#insurer_name").type(insuranceName); + cy.get("[data-testid=blood-group] button") + .click() + .then(() => { + cy.get("[role='option']").contains(bloodGroup).click(); + }); + } + + clickUpdatePatient() { + cy.intercept("PUT", "**/api/v1/patient/**").as("updatePatient"); + cy.get("button").get("[data-testid=submit-button]").click(); + cy.wait("@updatePatient").its("response.statusCode").should("eq", 200); + } + + verifyPatientUpdated() { + cy.url().should("include", "/patient"); + } + + saveUpdatedPatientUrl() { + cy.url().then((url) => { + cy.log(url); + patient_url = url.split("/").slice(0, -1).join("/"); + cy.log(patient_url); + }); + } + + visitUpdatedPatient() { + cy.awaitUrl(patient_url); + } + + verifyPatientDetails( + patientName: string, + phoneNumber: string, + presentHealth: string, + ongoingMedication: string, + allergies: string + ) { + cy.url().should("include", "/facility/"); + cy.get("[data-testid=patient-dashboard]").should("contain", patientName); + cy.get("[data-testid=patient-dashboard]").should("contain", phoneNumber); + cy.get("[data-testid=patient-present-health]").should( + "contain", + presentHealth + ); + cy.get("[data-testid=patient-ongoing-medication]").should( + "contain", + ongoingMedication + ); + cy.get("[data-testid=patient-allergies]").should("contain", allergies); + } + + visitConsultationPage() { + cy.visit(patient_url + "/consultation"); + } +} diff --git a/cypress/pageobject/constants.ts b/cypress/pageobject/constants.ts new file mode 100644 index 00000000000..72e0d31c662 --- /dev/null +++ b/cypress/pageobject/constants.ts @@ -0,0 +1,4 @@ +export const phone_number = + "9" + Math.floor(100000000 + Math.random() * 900000000); +export const emergency_phone_number = + "9" + Math.floor(100000000 + Math.random() * 900000000); diff --git a/src/Components/Assets/AssetImportModal.tsx b/src/Components/Assets/AssetImportModal.tsx index b5b0110096a..548df2901ec 100644 --- a/src/Components/Assets/AssetImportModal.tsx +++ b/src/Components/Assets/AssetImportModal.tsx @@ -220,7 +220,7 @@ const AssetImportModal = ({ open, onClose, facility }: Props) => { -

+
{
- {config.enable_abdm ? ( - - ) : ( - <> - )} + + ); }; diff --git a/src/Redux/actions.tsx b/src/Redux/actions.tsx index e3212685d2f..6e0d91fc59d 100644 --- a/src/Redux/actions.tsx +++ b/src/Redux/actions.tsx @@ -979,6 +979,15 @@ export const healthFacilityActions = { facility_id: id, }); }, + + registerService: (id: string) => { + return fireRequest( + "registerHealthFacilityAsService", + [], + {}, + { facility_id: id } + ); + }, }; export const listAssetAvailability = (params: object) => diff --git a/src/Redux/api.tsx b/src/Redux/api.tsx index 3efff35689e..393b9372ca5 100644 --- a/src/Redux/api.tsx +++ b/src/Redux/api.tsx @@ -931,6 +931,11 @@ const routes: Routes = { method: "PATCH", }, + registerHealthFacilityAsService: { + path: "/api/v1/abdm/health_facility/{facility_id}/register_service/", + method: "POST", + }, + // Asset Availability endpoints listAssetAvailability: { From 8bcf91dce41cb8c20d7b2b674550dcb73a0ca746 Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Fri, 8 Sep 2023 06:22:14 +0000 Subject: [PATCH 18/20] cypress: fix inventory management (#6245) * fix cypress :/ * Update cypress/pageobject/Facility/FacilityCreation.ts * fix double click --------- Co-authored-by: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> --- cypress/pageobject/Facility/FacilityCreation.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts index 3eac29f14c5..aa46d4f1105 100644 --- a/cypress/pageobject/Facility/FacilityCreation.ts +++ b/cypress/pageobject/Facility/FacilityCreation.ts @@ -119,6 +119,7 @@ class FacilityPage { } clickInventoryManagementOption() { + cy.get("#inventory-management", { timeout: 10000 }).should("be.visible"); cy.get("#inventory-management").click(); } @@ -162,8 +163,6 @@ class FacilityPage { cy.intercept("GET", "**/api/v1/facility/**").as("getFacilities"); cy.get("[id='facility-details']").first().click(); cy.wait("@getFacilities").its("response.statusCode").should("eq", 200); - cy.get("#manage-facility-dropdown button").should("be.visible"); - cy.get("[id=manage-facility-dropdown]").scrollIntoView().click(); } clickManageInventory() { From 9b45c5e9a496c54111e07232f1015c68ebb6205b Mon Sep 17 00:00:00 2001 From: Ashesh <3626859+Ashesh3@users.noreply.github.com> Date: Fri, 8 Sep 2023 19:24:23 +0530 Subject: [PATCH 19/20] Fix verified_by and Principal Diagnosis validation (#6247) * Fix verified_by and Principal Diagnosis validation * Apply suggestions from code review Co-authored-by: Rithvik Nishad --- src/Components/Facility/ConsultationForm.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index fbea6dd8a5a..97f35f292f8 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -538,7 +538,7 @@ export const ConsultationForm = (props: any) => { } case "verified_by": { - if (!state.form[field].replace(/\s/g, "").length) { + if (!state.form[field]) { errors[field] = "Please fill verified by"; invalidForm = true; break; @@ -570,6 +570,7 @@ export const ConsultationForm = (props: any) => { if ( state.form[field] && state.form["icd11_diagnoses_object"].length && + !state.form["icd11_provisional_diagnoses_object"] && !state.form["icd11_diagnoses_object"] .map((d) => d.id) .includes(state.form[field]!) @@ -583,6 +584,7 @@ export const ConsultationForm = (props: any) => { if ( state.form[field] && state.form["icd11_provisional_diagnoses_object"].length && + !state.form["icd11_diagnoses_object"] && !state.form["icd11_provisional_diagnoses_object"] .map((d) => d.id) .includes(state.form[field]!) From fb4e7bed464b858e5a127b9701c5caa1660a8447 Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Fri, 8 Sep 2023 15:28:47 +0000 Subject: [PATCH 20/20] Consultation Form: skip validation for `verified_by` if `suggestion` is Declare Death and fix discharge not working on create consultation (#6248) * fix verified by validation * fix decalre dead --- src/Components/Facility/ConsultationForm.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index 97f35f292f8..49028a62953 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -538,7 +538,7 @@ export const ConsultationForm = (props: any) => { } case "verified_by": { - if (!state.form[field]) { + if (state.form.suggestion !== "DD" && !state.form[field]) { errors[field] = "Please fill verified by"; invalidForm = true; break; @@ -618,6 +618,7 @@ export const ConsultationForm = (props: any) => { }; const declareThePatientDead = async ( + id: string, cause_of_death: string, death_datetime: string, death_confirmed_doctor: string @@ -629,6 +630,7 @@ export const ConsultationForm = (props: any) => { discharge_notes: cause_of_death, death_datetime: death_datetime, death_confirmed_doctor: death_confirmed_doctor, + discharge_date: dayjs().toISOString(), }, { id } ) @@ -714,6 +716,7 @@ export const ConsultationForm = (props: any) => { if (data.suggestion === "DD") { await declareThePatientDead( + res.data.id, state.form.cause_of_death, state.form.death_datetime, state.form.death_confirmed_doctor