diff --git a/cypress/e2e/assets_spec/assets_creation.cy.ts b/cypress/e2e/assets_spec/assets_creation.cy.ts index cd3489a14d8..8602ab8eb5b 100644 --- a/cypress/e2e/assets_spec/assets_creation.cy.ts +++ b/cypress/e2e/assets_spec/assets_creation.cy.ts @@ -57,7 +57,7 @@ describe("Asset", () => { "Vendor's Name", serialNumber, "25122021", - "Test note for asset creation!" + "Test note for asset creation!", ); assetPage.clickCreateAddMore(); @@ -80,7 +80,7 @@ describe("Asset", () => { "Vendor's Name", serialNumber, "25122021", - "Test note for asset creation!" + "Test note for asset creation!", ); assetPage.interceptAssetCreation(); @@ -106,7 +106,7 @@ describe("Asset", () => { "Customer Support's Name Edited", "Vendor's Name Edited", "Test note for asset creation edited!", - "25122021" + "25122021", ); assetPage.clickUpdateAsset(); @@ -128,7 +128,7 @@ describe("Asset", () => { "192.168.1.64", "remote_user", "2jCkrCRSeahzKEU", - "d5694af2-21e2-4a39-9bad-2fb98d9818bd" + "d5694af2-21e2-4a39-9bad-2fb98d9818bd", ); assetPage.clickConfigureAsset(); assetPage.verifyAssetConfiguration(200); @@ -155,7 +155,7 @@ describe("Asset", () => { "Vendor's Name", serialNumber, "25122021", - "Test note for asset creation!" + "Test note for asset creation!", ); assetPage.interceptAssetCreation(); assetPage.clickCreateAsset(); diff --git a/cypress/e2e/facility_spec/facility_creation.cy.ts b/cypress/e2e/facility_spec/facility_creation.cy.ts index ed6cc439272..83f666995ff 100644 --- a/cypress/e2e/facility_spec/facility_creation.cy.ts +++ b/cypress/e2e/facility_spec/facility_creation.cy.ts @@ -94,7 +94,7 @@ describe("Facility Creation", () => { initialTriageValue, initialTriageValue, initialTriageValue, - initialTriageValue + initialTriageValue, ); manageUserPage.clickSubmit(); // edit the entry and verify reflection @@ -106,7 +106,7 @@ describe("Facility Creation", () => { modifiedTriageValue, modifiedTriageValue, modifiedTriageValue, - modifiedTriageValue + modifiedTriageValue, ); manageUserPage.clickSubmit(); facilityPage.scrollToFacilityTriage(); @@ -318,7 +318,7 @@ describe("Facility Creation", () => { facilityPage.fillMiddleWareAddress("dev_middleware.coronasafe.live"); facilityPage.clickupdateMiddleWare(); facilityPage.verifySuccessNotification( - "Facility middleware updated successfully" + "Facility middleware updated successfully", ); }); diff --git a/cypress/e2e/facility_spec/facility_manage.cy.ts b/cypress/e2e/facility_spec/facility_manage.cy.ts index 766bf3d9247..8250236906c 100644 --- a/cypress/e2e/facility_spec/facility_manage.cy.ts +++ b/cypress/e2e/facility_spec/facility_manage.cy.ts @@ -53,13 +53,13 @@ describe("Facility Manage Functions", () => { // verify mandatory field error message facilityManage.clickButtonWithText(facilityMiddlewareUpdateButton); facilityManage.checkErrorMessageVisibility( - "Middleware Address is required" + "Middleware Address is required", ); // add middleware and verify the notification facilityManage.typeMiddlewareAddress(facilityMiddleware); facilityManage.clickButtonWithText(facilityMiddlewareUpdateButton); facilityManage.verifySuccessMessageVisibilityAndContent( - facilityMiddlewareSuccessfullNotification + facilityMiddlewareSuccessfullNotification, ); // update the existing middleware facilityPage.clickManageFacilityDropdown(); @@ -68,7 +68,7 @@ describe("Facility Manage Functions", () => { facilityManage.typeMiddlewareAddress(facilityUpdatedMiddleware); facilityManage.clickButtonWithText(facilityMiddlewareUpdateButton); facilityManage.verifySuccessMessageVisibilityAndContent( - facilityMiddlewareSuccessfullNotification + facilityMiddlewareSuccessfullNotification, ); // verify the updated middleware facilityPage.clickManageFacilityDropdown(); @@ -83,13 +83,13 @@ describe("Facility Manage Functions", () => { facilityManage.clearHfrId(); facilityManage.clickButtonWithText(facilityHfridUpdateButton); facilityManage.checkErrorMessageVisibility( - "Health Facility Id is required" + "Health Facility Id is required", ); // add facility health ID and verify notification facilityManage.typeHfrId(facilityHfrId); facilityManage.clickButtonWithText(facilityHfridUpdateButton); facilityManage.verifySuccessMessageVisibilityAndContent( - facilityHfridToastNotificationText + facilityHfridToastNotificationText, ); // update the existing middleware facilityPage.clickManageFacilityDropdown(); @@ -97,7 +97,7 @@ describe("Facility Manage Functions", () => { facilityManage.typeHfrId(facilityUpdatedHfrId); facilityManage.clickButtonWithText(facilityHfridUpdateButton); facilityManage.verifySuccessMessageVisibilityAndContent( - facilityHfridToastNotificationText + facilityHfridToastNotificationText, ); // verify its reflection facilityPage.clickManageFacilityDropdown(); @@ -112,7 +112,7 @@ describe("Facility Manage Functions", () => { facilityPage.fillDoctorCount(doctorCapacity); facilityPage.saveAndExitDoctorForm(); facilityManage.verifySuccessMessageVisibilityAndContent( - "Doctor count added successfully" + "Doctor count added successfully", ); facilityManage.verifyTotalDoctorCapacity(doctorCapacity); // edit a existing doctor @@ -120,14 +120,14 @@ describe("Facility Manage Functions", () => { facilityPage.fillDoctorCount(doctorModifiedCapacity); facilityPage.clickdoctorcapacityaddmore(); facilityManage.verifySuccessMessageVisibilityAndContent( - "Doctor count updated successfully" + "Doctor count updated successfully", ); facilityManage.verifyTotalDoctorCapacity(doctorModifiedCapacity); // delete a bed facilityManage.clickDeleteFacilityDoctorCapacity(); facilityManage.clickButtonWithText("Delete"); facilityManage.verifySuccessMessageVisibilityAndContent( - "Doctor specialization type deleted successfully" + "Doctor specialization type deleted successfully", ); }); @@ -139,7 +139,7 @@ describe("Facility Manage Functions", () => { facilityPage.fillCurrentlyOccupied(currentOccupied); facilityPage.saveAndExitBedCapacityForm(); facilityManage.verifySuccessMessageVisibilityAndContent( - "Bed capacity added successfully" + "Bed capacity added successfully", ); cy.closeNotification(); facilityManage.verifyFacilityBedCapacity(totalCapacity); @@ -150,7 +150,7 @@ describe("Facility Manage Functions", () => { facilityPage.fillCurrentlyOccupied(currentUpdatedOccupied); facilityPage.clickbedcapcityaddmore(); facilityManage.verifySuccessMessageVisibilityAndContent( - "Bed capacity updated successfully" + "Bed capacity updated successfully", ); cy.closeNotification(); facilityManage.verifyFacilityBedCapacity(totalUpdatedCapacity); @@ -159,7 +159,7 @@ describe("Facility Manage Functions", () => { facilityManage.clickDeleteFacilityBedCapacity(); facilityManage.clickButtonWithText("Delete"); facilityManage.verifySuccessMessageVisibilityAndContent( - "Bed type deleted successfully" + "Bed type deleted successfully", ); }); diff --git a/cypress/e2e/facility_spec/inventory.cy.ts b/cypress/e2e/facility_spec/inventory.cy.ts index 4c0a8cb5371..b365fb3b02d 100644 --- a/cypress/e2e/facility_spec/inventory.cy.ts +++ b/cypress/e2e/facility_spec/inventory.cy.ts @@ -73,7 +73,7 @@ describe("Inventory Management Section", () => { facilityPage.fillInventoryMinimumDetails(inventoryName, "1"); facilityPage.clickSetButton(); facilityPage.verifySuccessNotification( - "Minimum quantiy updated successfully" + "Minimum quantiy updated successfully", ); } }); diff --git a/cypress/e2e/patient_spec/patient_consultation.cy.ts b/cypress/e2e/patient_spec/patient_consultation.cy.ts index cb20dce0d88..8caea111ca1 100644 --- a/cypress/e2e/patient_spec/patient_consultation.cy.ts +++ b/cypress/e2e/patient_spec/patient_consultation.cy.ts @@ -57,12 +57,12 @@ describe("Patient Consultation in multiple combination", () => { patientPage.clickCreatePatient(); patientPage.verifyPatientIsCreated(); patientConsultationPage.selectConsultationStatus( - "Outpatient/Emergency Room" + "Outpatient/Emergency Room", ); cy.searchAndSelectOption("#symptoms", "ASYMPTOMATIC"); patientConsultationPage.typePatientIllnessHistory(patientIllnessHistory); patientConsultationPage.typePatientExaminationHistory( - patientExaminationHistory + patientExaminationHistory, ); patientConsultationPage.typePatientWeight(patientWeight); patientConsultationPage.typePatientHeight(patientHeight); @@ -70,19 +70,19 @@ describe("Patient Consultation in multiple combination", () => { // icd 11 - 4 diagnosis with one principal patientConsultationPage.selectPatientDiagnosis( diagnosis1, - "add-icd11-diagnosis-as-unconfirmed" + "add-icd11-diagnosis-as-unconfirmed", ); patientConsultationPage.selectPatientDiagnosis( diagnosis2, - "add-icd11-diagnosis-as-provisional" + "add-icd11-diagnosis-as-provisional", ); patientConsultationPage.selectPatientDiagnosis( diagnosis3, - "add-icd11-diagnosis-as-differential" + "add-icd11-diagnosis-as-differential", ); patientConsultationPage.selectPatientDiagnosis( diagnosis4, - "add-icd11-diagnosis-as-confirmed" + "add-icd11-diagnosis-as-confirmed", ); patientConsultationPage.selectPatientPrincipalDiagnosis(diagnosis4); patientTreatmentPlan.clickAddProcedure(); @@ -111,55 +111,55 @@ describe("Patient Consultation in multiple combination", () => { // Verify the data's across the dashboard patientConsultationPage.verifyTextInConsultation( "#patient-consultationbadges", - patientIpNumber + patientIpNumber, ); patientConsultationPage.verifyTextInConsultation( "#diagnoses-view", - diagnosis1 + diagnosis1, ); patientConsultationPage.verifyTextInConsultation( "#diagnoses-view", - diagnosis2 + diagnosis2, ); patientConsultationPage.verifyTextInConsultation( "#diagnoses-view", - diagnosis3 + diagnosis3, ); patientConsultationPage.verifyTextInConsultation( "#diagnoses-view", - diagnosis4 + diagnosis4, ); patientConsultationPage.verifyTextInConsultation( "#history-presentillness", - patientIllnessHistory + patientIllnessHistory, ); patientConsultationPage.verifyTextInConsultation( "#examination-details", - patientExaminationHistory + patientExaminationHistory, ); patientConsultationPage.verifyTextInConsultation( "#treatment-summary", - patientTreatment + patientTreatment, ); patientConsultationPage.verifyTextInConsultation( "#general-instructions", - generalInstruction + generalInstruction, ); patientConsultationPage.verifyTextInConsultation( "#consultation-notes", - specialInstruction + specialInstruction, ); patientConsultationPage.verifyTextInConsultation( "#consultation-procedure", - procedureName + procedureName, ); patientConsultationPage.verifyTextInConsultation( "#patient-weight", - patientWeight + patientWeight, ); patientConsultationPage.verifyTextInConsultation( "#patient-height", - patientHeight + patientHeight, ); }); @@ -172,7 +172,7 @@ describe("Patient Consultation in multiple combination", () => { patientPage.verifyPatientIsCreated(); // OP Patient patientConsultationPage.selectConsultationStatus( - "Outpatient/Emergency Room" + "Outpatient/Emergency Room", ); // Asymptomatic cy.searchAndSelectOption("#symptoms", "ASYMPTOMATIC"); @@ -182,38 +182,38 @@ describe("Patient Consultation in multiple combination", () => { patientConsultationPage.typeCauseOfDeath("Cause of Death"); patientConsultationPage.typePatientConsultationDate( "#death_datetime", - "2024-02-22T12:45" + "2024-02-22T12:45", ); patientConsultationPage.typeDeathConfirmedBy(doctorName); patientConsultationPage.typePatientConsultationDate( "#encounter_date", - "2024-02-22T12:30" + "2024-02-22T12:30", ); cy.submitButton("Create Consultation"); cy.verifyNotification( - "Create Diagnoses - Atleast one diagnosis is required" + "Create Diagnoses - Atleast one diagnosis is required", ); cy.closeNotification(); patientConsultationPage.selectPatientDiagnosis( diagnosis4, - "add-icd11-diagnosis-as-confirmed" + "add-icd11-diagnosis-as-confirmed", ); cy.submitButton("Create Consultation"); cy.verifyNotification("Consultation created successfully"); // verify the data and death report patientConsultationPage.verifyTextInConsultation( "#consultation-buttons", - "EXPIRED" + "EXPIRED", ); patientConsultationPage.clickPatientDetails(); patientDeathReport.clickDeathReport(); patientDeathReport.verifyDeathReportAutofill( "#name", - "Patient With Predefined Data" + "Patient With Predefined Data", ); patientDeathReport.verifyDeathReportAutofill( "#cause_of_death", - "Cause of Death" + "Cause of Death", ); cy.submitButton("Preview"); cy.preventPrint(); @@ -230,7 +230,7 @@ describe("Patient Consultation in multiple combination", () => { patientPage.verifyPatientIsCreated(); // Internal Transfer within facility patientConsultationPage.selectConsultationStatus( - "Internal Transfer within the facility" + "Internal Transfer within the facility", ); patientConsultationPage.selectPatientWard("Dummy Location 1"); // Asymptomatic @@ -241,11 +241,11 @@ describe("Patient Consultation in multiple combination", () => { // one ICD-11 diagnosis patientConsultationPage.selectPatientDiagnosis( diagnosis4, - "add-icd11-diagnosis-as-confirmed" + "add-icd11-diagnosis-as-confirmed", ); patientConsultationPage.typePatientConsultationDate( "#icu_admission_date", - "2024-02-23T12:30" + "2024-02-23T12:30", ); // add investigation patientInvestigation.clickAddInvestigation(); @@ -266,17 +266,17 @@ describe("Patient Consultation in multiple combination", () => { // verify the data reflection - patientConsultationPage.verifyTextInConsultation( "#patient-infobadges", - "Specialist Required" + "Specialist Required", ); patientConsultationPage.verifyTextInConsultation( "#patient-infobadges", - "Domiciliary Care" + "Domiciliary Care", ); patientConsultationPage.verifyTextInConsultation("#diagnoses-view", "1A04"); patientInvestigation.clickInvestigationTab(); patientConsultationPage.verifyTextInConsultation( "#investigation-suggestions", - "Vitals" + "Vitals", ); }); @@ -289,7 +289,7 @@ describe("Patient Consultation in multiple combination", () => { patientPage.verifyPatientIsCreated(); // referred from another facility patient patientConsultationPage.selectConsultationStatus( - "Referred from another facility" + "Referred from another facility", ); // verify the free text in referring facility name patientConsultationPage.typeReferringFacility("Life Care Hospital"); @@ -303,14 +303,14 @@ describe("Patient Consultation in multiple combination", () => { // Date of symptoms patientConsultationPage.selectSymptomsDate( "#symptoms_onset_date", - "01012024" + "01012024", ); // OP Consultation patientConsultationPage.selectPatientSuggestion("OP Consultation"); // one ICD-11 and no principal patientConsultationPage.selectPatientDiagnosis( diagnosis4, - "add-icd11-diagnosis-as-confirmed" + "add-icd11-diagnosis-as-confirmed", ); // no investigation patientTreatmentPlan.typePatientGeneralInstruction(generalInstruction); @@ -321,11 +321,11 @@ describe("Patient Consultation in multiple combination", () => { // verify the Discharge Reason, Diagnosis, treatment physican patientConsultationPage.verifyTextInConsultation( "#consultation-buttons", - "OP file closed" + "OP file closed", ); patientConsultationPage.verifyTextInConsultation( "#treating-physician", - doctorName + doctorName, ); patientConsultationPage.verifyTextInConsultation("#diagnoses-view", "1A04"); }); @@ -339,7 +339,7 @@ describe("Patient Consultation in multiple combination", () => { patientPage.verifyPatientIsCreated(); // Route of Facility - Out Patient patientConsultationPage.selectConsultationStatus( - "Outpatient/Emergency Room" + "Outpatient/Emergency Room", ); // Select the Symptoms - Sore throat and fever symptoms patientConsultationPage.typeAndMultiSelectSymptoms("b", [ @@ -351,19 +351,19 @@ describe("Patient Consultation in multiple combination", () => { // Date of symptoms patientConsultationPage.selectSymptomsDate( "#symptoms_onset_date", - "01012024" + "01012024", ); // Decision after consultation - Referred to Facility patientConsultationPage.selectPatientSuggestion( - "Refer to another Hospital" + "Refer to another Hospital", ); patientConsultationPage.selectPatientReferance( - "Dummy Request Approving Center" + "Dummy Request Approving Center", ); // Four ICD-11 and one principal diagnosis patientConsultationPage.selectPatientDiagnosis( diagnosis4, - "add-icd11-diagnosis-as-confirmed" + "add-icd11-diagnosis-as-confirmed", ); patientConsultationPage.selectPatientPrincipalDiagnosis(diagnosis4); // no investigation for the patient @@ -386,7 +386,7 @@ describe("Patient Consultation in multiple combination", () => { patientConsultationPage.typePatientIllnessHistory("editted"); patientConsultationPage.selectPatientDiagnosis( diagnosis5, - "add-icd11-diagnosis-as-unconfirmed" + "add-icd11-diagnosis-as-unconfirmed", ); cy.get("#diagnosis-entry-1").within(() => { cy.get("#condition-verification-status-menu").click(); @@ -397,7 +397,7 @@ describe("Patient Consultation in multiple combination", () => { cy.get("#diagnoses-view").should("not.contain.text", diagnosis5); patientConsultationPage.verifyTextInConsultation( "#history-presentillness", - "editted" + "editted", ); }); diff --git a/cypress/e2e/patient_spec/patient_fileupload.cy.ts b/cypress/e2e/patient_spec/patient_fileupload.cy.ts index 20a884fd149..bbd580b28d9 100644 --- a/cypress/e2e/patient_spec/patient_fileupload.cy.ts +++ b/cypress/e2e/patient_spec/patient_fileupload.cy.ts @@ -109,9 +109,9 @@ function runTests(testDescription, visitPatientFileUploadSection) { runTests( "Patient File upload in patient details page", - patientFileUpload.clickFileUploadIcon + patientFileUpload.clickFileUploadIcon, ); runTests( "Patient File upload in patient consultation page", - patientFileUpload.clickFileTab + patientFileUpload.clickFileTab, ); diff --git a/cypress/e2e/patient_spec/patient_registration.cy.ts b/cypress/e2e/patient_spec/patient_registration.cy.ts index 634b6d5c81f..17c9b0b3679 100644 --- a/cypress/e2e/patient_spec/patient_registration.cy.ts +++ b/cypress/e2e/patient_spec/patient_registration.cy.ts @@ -15,6 +15,20 @@ const calculateAge = () => { return currentYear - parseInt(yearOfBirth); }; +const getRelativeDateString = (deltaDays = 0) => { + const date = new Date(); + if (deltaDays) { + date.setDate(date.getDate() + deltaDays); + } + return date + .toLocaleDateString("en-IN", { + day: "2-digit", + month: "2-digit", + year: "numeric", + }) + .replace("/", ""); +}; + describe("Patient Creation with consultation", () => { const loginPage = new LoginPage(); const patientPage = new PatientPage(); @@ -27,6 +41,8 @@ describe("Patient Creation with consultation", () => { const age = calculateAge(); const patientFacility = "Dummy Facility 40"; const patientDateOfBirth = "01012001"; + const patientMenstruationStartDate = getRelativeDateString(-10); + const patientDateOfDelivery = getRelativeDateString(-20); const patientOneName = "Patient With No Consultation"; const patientOneGender = "Male"; const patientOneUpdatedGender = "Female"; @@ -144,6 +160,9 @@ describe("Patient Creation with consultation", () => { patientPage.selectPatientGender(patientOneUpdatedGender); patientPage.typePatientDateOfBirth(patientDateOfBirth); patientPage.clickPatientAntenatalStatusYes(); + patientPage.typeLastMenstruationStartDate(patientMenstruationStartDate); + patientPage.clickPatientPostPartumStatusYes(); + patientPage.typeDateOfDelivery(patientDateOfDelivery); patientPage.selectPatientBloodGroup(patientOneUpdatedBloodGroup); // Edit the patient consultation , select none medical history and multiple health ID patientMedicalHistory.clickNoneMedicialHistory(); diff --git a/cypress/e2e/users_spec/user_creation.cy.ts b/cypress/e2e/users_spec/user_creation.cy.ts index e40ebbbc71f..572b0cb95c4 100644 --- a/cypress/e2e/users_spec/user_creation.cy.ts +++ b/cypress/e2e/users_spec/user_creation.cy.ts @@ -70,61 +70,61 @@ describe("User Creation", () => { userCreationPage.clickElementById("profilenamelink"); userCreationPage.verifyElementContainsText( "username-profile-details", - "devdistrictadmin" + "devdistrictadmin", ); userCreationPage.clickElementById("edit-cancel-profile-button"); userCreationPage.typeIntoElementByIdPostClear( "firstName", - "District Editted" + "District Editted", ); userCreationPage.typeIntoElementByIdPostClear("lastName", "Cypress"); userCreationPage.selectDropdownOption("gender", "Male"); userCreationPage.typeIntoElementByIdPostClear( "phoneNumber", - "+91" + phone_number + "+91" + phone_number, ); userCreationPage.typeIntoElementByIdPostClear( "altPhoneNumber", - "+91" + emergency_phone_number + "+91" + emergency_phone_number, ); userCreationPage.typeIntoElementByIdPostClear("email", "test@test.com"); userCreationPage.typeIntoElementByIdPostClear("weekly_working_hours", "14"); userCreationPage.typeIntoElementByIdPostClearDob( "date_of_birth", - "01011998" + "01011998", ); userCreationPage.clickElementById("submit"); userCreationPage.verifyElementContainsText( "contactno-profile-details", - "+91" + phone_number + "+91" + phone_number, ); userCreationPage.verifyElementContainsText( "whatsapp-profile-details", - "+91" + emergency_phone_number + "+91" + emergency_phone_number, ); userCreationPage.verifyElementContainsText( "firstname-profile-details", - "District Editted" + "District Editted", ); userCreationPage.verifyElementContainsText( "lastname-profile-details", - "Cypress" + "Cypress", ); userCreationPage.verifyElementContainsText( "date_of_birth-profile-details", - "01/01/1998" + "01/01/1998", ); userCreationPage.verifyElementContainsText( "emailid-profile-details", - "test@test.com" + "test@test.com", ); userCreationPage.verifyElementContainsText( "gender-profile-details", - "Male" + "Male", ); userCreationPage.verifyElementContainsText( "averageworkinghour-profile-details", - "14" + "14", ); }); @@ -154,7 +154,7 @@ describe("User Creation", () => { userCreationPage.typeIntoElementById("doctor_experience_commenced_on", "2"); userCreationPage.typeIntoElementById( "doctor_medical_council_registration", - "123456789" + "123456789", ); userCreationPage.typeIntoElementById("first_name", "cypress test"); userCreationPage.typeIntoElementById("last_name", "staff user"); @@ -171,13 +171,13 @@ describe("User Creation", () => { userCreationPage.verifyElementContainsText("district", "Ernakulam"); userCreationPage.verifyElementContainsText( "home_facility", - "Dummy Shifting Center" + "Dummy Shifting Center", ); userCreationPage.verifyElementContainsText("doctor-qualification", "MBBS"); userCreationPage.verifyElementContainsText("doctor-experience", "2"); userCreationPage.verifyElementContainsText( "medical-council-registration", - "123456789" + "123456789", ); }); diff --git a/cypress/e2e/users_spec/user_homepage.cy.ts b/cypress/e2e/users_spec/user_homepage.cy.ts index 1a0bec587a7..a006fe77569 100644 --- a/cypress/e2e/users_spec/user_homepage.cy.ts +++ b/cypress/e2e/users_spec/user_homepage.cy.ts @@ -39,11 +39,11 @@ describe("User Homepage", () => { userPage.verifyDataTestIdText("Last Name", "Last Name: Doctor"); userPage.verifyDataTestIdText( "Phone Number", - "Phone Number: +919876543219" + "Phone Number: +919876543219", ); userPage.verifyDataTestIdText( "WhatsApp no.", - "WhatsApp no.: +919876543219" + "WhatsApp no.: +919876543219", ); userPage.verifyDataTestIdText("Role", "Role: Doctor"); userPage.verifyDataTestIdText("District", "District: Ernakulam"); diff --git a/cypress/pageobject/Asset/AssetCreation.ts b/cypress/pageobject/Asset/AssetCreation.ts index 421fee0cee2..9232c5966c1 100644 --- a/cypress/pageobject/Asset/AssetCreation.ts +++ b/cypress/pageobject/Asset/AssetCreation.ts @@ -45,7 +45,7 @@ export class AssetPage { vendorName: string, serialNumber: string, lastServicedOn: string, - notes: string + notes: string, ) { cy.get("[data-testid=asset-name-input] input").type(name); cy.get("[data-testid=asset-description-input] textarea").type(description); @@ -61,7 +61,7 @@ export class AssetPage { cy.get("[data-testid=asset-vendor-name-input] input").type(vendorName); cy.get("[data-testid=asset-serial-number-input] input").type(serialNumber); cy.get( - "[data-testid=asset-last-serviced-on-input] input[type='text']" + "[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").type(notes); @@ -101,7 +101,7 @@ export class AssetPage { supportName: string, vendorName: string, notes: string, - lastServicedOn: string + lastServicedOn: string, ) { cy.get("[data-testid=asset-update-button]").click(); cy.get("[data-testid=asset-name-input] input").clear().type(name); @@ -119,7 +119,7 @@ export class AssetPage { .clear() .type(vendorName); cy.get( - "[data-testid=asset-last-serviced-on-input] input[type='text']" + "[data-testid=asset-last-serviced-on-input] input[type='text']", ).click(); cy.get("#date-input").click().clear().type(lastServicedOn); cy.get("[data-testid=asset-notes-input] textarea").clear().type(notes); @@ -130,7 +130,7 @@ export class AssetPage { localIp: string, userName: string, password: string, - streamUuid: string + streamUuid: string, ) { cy.get("[data-testid=asset-configure-button]").click(); cy.get("[name=middleware_hostname]").type(hostName); @@ -186,28 +186,28 @@ export class AssetPage { verifyEmptyAssetNameError() { cy.get("[data-testid=asset-name-input] span").should( "contain", - "Asset name can't be empty" + "Asset name can't be empty", ); } verifyEmptyLocationError() { cy.get("[data-testid=asset-location-input] span").should( "contain", - "Select a location" + "Select a location", ); } verifyEmptyStatusError() { cy.get("[data-testid=asset-working-status-input] span").should( "contain", - "Field is required" + "Field is required", ); } verifyEmptyPhoneError() { cy.get("#customer-support-phone-div span").should( "contain", - "Please enter valid phone number" + "Please enter valid phone number", ); } @@ -320,7 +320,7 @@ export class AssetPage { cy.get("#edit-history-asset-servicedon").should("have.text", "01/09/2023"); cy.get("#edit-history-asset-note").should( "have.text", - "Dummy Notes Editted" + "Dummy Notes Editted", ); cy.get("#view-history-back-button").contains("Back").click(); cy.get("#view-history-back-button").contains("Close").click(); @@ -338,11 +338,11 @@ export class AssetPage { cy.get("#transaction-history").scrollIntoView(); cy.get("#transaction-history table tbody tr:first-child td:eq(0)").should( "contain", - initiallocationName + initiallocationName, ); cy.get("#transaction-history table tbody tr:first-child td:eq(1)").should( "contain", - locationName + locationName, ); } diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts index 733546465a6..8a1b31e3e46 100644 --- a/cypress/pageobject/Facility/FacilityCreation.ts +++ b/cypress/pageobject/Facility/FacilityCreation.ts @@ -225,7 +225,7 @@ class FacilityPage { homeQuarantine, isolation, referred, - confirmedPositive + confirmedPositive, ) { cy.get("#num_patients_visited").clear().click().type(visited); cy.get("#num_patients_home_quarantine") @@ -324,7 +324,7 @@ class FacilityPage { verifyFacilityBadgeContent(expectedText: string) { cy.get("[data-testid='Facility/District Name']").should( "contain", - expectedText + expectedText, ); } @@ -380,7 +380,7 @@ class FacilityPage { clickAddInventory() { cy.intercept("POST", "**/api/v1/facility/*/inventory/").as( - "createInventory" + "createInventory", ); cy.get("button").contains("Add/Update Inventory").click(); cy.wait("@createInventory").its("response.statusCode").should("eq", 201); @@ -396,7 +396,7 @@ class FacilityPage { facility: string, title: string, quantity: string, - description: string + description: string, ) { cy.get("#refering_facility_contact_name").type(name); cy.get("#refering_facility_contact_number").type(phone_number); diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts index 078302f1ee2..39527988165 100644 --- a/cypress/pageobject/Patient/PatientCreation.ts +++ b/cypress/pageobject/Patient/PatientCreation.ts @@ -78,6 +78,16 @@ export class PatientPage { .type(address); } + typeLastMenstruationStartDate(date: string) { + cy.get("#last_menstruation_start_date").click(); + cy.get("#date-input").click().type(date); + } + + typeDateOfDelivery(date: string) { + cy.get("#date_of_delivery").click(); + cy.get("#date-input").click().type(date); + } + clickPermanentAddress() { cy.get("[data-testid=permanent-address] input").check(); } @@ -86,6 +96,10 @@ export class PatientPage { cy.get("#is_antenatal-0").click(); } + clickPatientPostPartumStatusYes() { + cy.get("#is_postpartum-0").click(); + } + clickCancelButton() { cy.get("#cancel").click(); } @@ -150,6 +164,8 @@ export class PatientPage { yearOfBirth, bloodGroup, occupation, + isAntenatal, + isPostPartum, ) { cy.url().should("include", "/facility/"); cy.get("[data-testid=patient-dashboard]").then(($dashboard) => { @@ -161,6 +177,13 @@ export class PatientPage { expect($dashboard).to.contain(yearOfBirth); expect($dashboard).to.contain(bloodGroup); expect($dashboard).to.contain(occupation); + + if (isAntenatal) { + expect($dashboard).to.contain("Antenatal"); + } + if (isPostPartum) { + expect($dashboard).to.contain("Post-partum"); + } }); } diff --git a/cypress/pageobject/Patient/PatientFileupload.ts b/cypress/pageobject/Patient/PatientFileupload.ts index 0250ffcc07d..d1a4c496d66 100644 --- a/cypress/pageobject/Patient/PatientFileupload.ts +++ b/cypress/pageobject/Patient/PatientFileupload.ts @@ -41,7 +41,7 @@ export class PatientFileUpload { uploadFile() { cy.get("#file_upload_patient").selectFile( "cypress/fixtures/sampleAsset.xlsx", - { force: true } + { force: true }, ); } diff --git a/cypress/pageobject/Patient/PatientTransfer.ts b/cypress/pageobject/Patient/PatientTransfer.ts index 726b888a6ee..4c884ee2427 100644 --- a/cypress/pageobject/Patient/PatientTransfer.ts +++ b/cypress/pageobject/Patient/PatientTransfer.ts @@ -38,7 +38,7 @@ class PatientTransfer { .invoke("text") .then((text) => { expect(text.trim()).to.match( - /^Patient Dummy Patient 10 \(Male\) transferred successfully$/i + /^Patient Dummy Patient 10 \(Male\) transferred successfully$/i, ); }); }); @@ -52,7 +52,7 @@ class PatientTransfer { .invoke("text") .then((text) => { expect(text).to.match( - /Patient - Patient transfer cannot be completed because the patient has an active consultation in the same facility/ + /Patient - Patient transfer cannot be completed because the patient has an active consultation in the same facility/, ); }); }); diff --git a/cypress/pageobject/Users/ManageUserPage.ts b/cypress/pageobject/Users/ManageUserPage.ts index b0b466e3f13..c4214f29895 100644 --- a/cypress/pageobject/Users/ManageUserPage.ts +++ b/cypress/pageobject/Users/ManageUserPage.ts @@ -85,7 +85,7 @@ export class ManageUserPage { verifyProfileWorkingHours(expectedHours: string) { cy.get("#averageworkinghour-profile-details").should( "contain", - expectedHours + expectedHours, ); } diff --git a/cypress/pageobject/Users/UserCreation.ts b/cypress/pageobject/Users/UserCreation.ts index c10d853f706..429beff2c22 100644 --- a/cypress/pageobject/Users/UserCreation.ts +++ b/cypress/pageobject/Users/UserCreation.ts @@ -54,7 +54,7 @@ export class UserCreationPage { setInputDate( dateElementId: string, inputElementId: string, - dateValue: string + dateValue: string, ) { this.clickElementById(dateElementId); this.typeIntoElementById(inputElementId, dateValue); diff --git a/cypress/pageobject/Users/UserProfilePage.ts b/cypress/pageobject/Users/UserProfilePage.ts index cb5f6d11f1c..77b624606cc 100644 --- a/cypress/pageobject/Users/UserProfilePage.ts +++ b/cypress/pageobject/Users/UserProfilePage.ts @@ -62,7 +62,7 @@ export default class UserProfilePage { assertdate_of_birth(date_of_birth: string) { cy.get("#date_of_birth-profile-details").should( "contain.text", - date_of_birth + date_of_birth, ); } @@ -85,7 +85,7 @@ export default class UserProfilePage { assertWorkingHours(workinghours: string) { cy.get("#averageworkinghour-profile-details").should( "contain.text", - workinghours + workinghours, ); } } diff --git a/cypress/pageobject/Users/UserSearch.ts b/cypress/pageobject/Users/UserSearch.ts index 6f83718e9b8..7d85563d62c 100644 --- a/cypress/pageobject/Users/UserSearch.ts +++ b/cypress/pageobject/Users/UserSearch.ts @@ -116,7 +116,7 @@ export class UserPage { alreadylinkedusersviews.forEach((expectedContent) => { const index = userViews.findIndex((actualContent) => - actualContent.includes(expectedContent) + actualContent.includes(expectedContent), ); if (index !== -1) { userViews.splice(index, 1); // Remove the matched element diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index e2c85e99d6d..b710e310bfb 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -62,7 +62,7 @@ Cypress.Commands.add("loginByApi", (username, password) => { } else { cy.refreshApiLogin(username, password); } - } + }, ); }); @@ -74,7 +74,7 @@ Cypress.Commands.add( disableLoginVerification ? cy.wait("@currentuser") : cy.wait("@currentuser").its("response.statusCode").should("eq", 200); - } + }, ); Cypress.Commands.add("verifyNotification", (text) => { @@ -124,7 +124,7 @@ Cypress.Commands.add( .then(() => { cy.get("[role='option']").contains(referance).click(); }); - } + }, ); Cypress.Commands.add( @@ -139,7 +139,7 @@ Cypress.Commands.add( }); cy.get(selector).click(); }); - } + }, ); Cypress.Commands.add( "typeAndMultiSelectOption", @@ -154,7 +154,7 @@ Cypress.Commands.add( }); cy.get(selector).click(); }); - } + }, ); Cypress.Commands.add( @@ -165,7 +165,7 @@ Cypress.Commands.add( .then(() => { cy.get("[role='option']").contains(reference).click(); }); - } + }, ); Cypress.Commands.add("clickAndTypeDate", (selector: string, date: string) => { @@ -179,7 +179,7 @@ Cypress.Commands.add( (element: string, reference: string) => { cy.get(element).scrollIntoView(); cy.get(element).contains(reference).should("be.visible").click(); - } + }, ); Cypress.Commands.add("preventPrint", () => { diff --git a/cypress/support/index.ts b/cypress/support/index.ts index 01f50cc14a5..9ddfd0c819a 100644 --- a/cypress/support/index.ts +++ b/cypress/support/index.ts @@ -10,38 +10,38 @@ declare global { verifyNotification(msg: string): Chainable; awaitUrl( url: string, - disableLoginVerification?: boolean + disableLoginVerification?: boolean, ): Chainable; getAttached(selector: string): Chainable; clearAllFilters(): Chainable; submitButton(buttonText?: string): Chainable; searchAndSelectOption( element: string, - referance: string + referance: string, ): Chainable; clickAndMultiSelectOption( selector: string, - symptoms: string | string[] + symptoms: string | string[], ): Chainable; typeAndMultiSelectOption( selector: string, input: string, - symptoms: string | string[] + symptoms: string | string[], ): Chainable; clickAndTypeDate(date: string, selector: string): Chainable; clickAndSelectOption( element: string, - reference: string + reference: string, ): Chainable; verifyAndClickElement( element: string, - reference: string + reference: string, ): Chainable; preventPrint(): Chainable; closeNotification(): Chainable; verifyContentPresence( selector: string, - texts: string[] + texts: string[], ): Chainable; } } diff --git a/plugins/treeShakeCareIcons.ts b/plugins/treeShakeCareIcons.ts index bf1713a0625..cf548225c25 100644 --- a/plugins/treeShakeCareIcons.ts +++ b/plugins/treeShakeCareIcons.ts @@ -22,15 +22,15 @@ export interface TreeShakeCareIconsOptions { */ export function treeShakeCareIcons( - options: TreeShakeCareIconsOptions = { iconWhitelist: [] } + options: TreeShakeCareIconsOptions = { iconWhitelist: [] }, ): Plugin { const rootDir = path.resolve(__dirname, ".."); // update this if moving this code to a different file const lineIconNameRegex = /"l-[a-z]+(?:-[a-z]+)*"/g; const allUniconPaths = JSON.parse( fs.readFileSync( path.resolve(rootDir, "src/CAREUI/icons/UniconPaths.json"), - "utf8" - ) + "utf8", + ), ); // Extracts icon names from a given file's content. @@ -41,7 +41,7 @@ export function treeShakeCareIcons( const lineIconNameMatches = fileContent.match(lineIconNameRegex) || []; const lineIconNames = lineIconNameMatches.map( - (lineIconName) => lineIconName.slice(1, -1) // remove quotes + (lineIconName) => lineIconName.slice(1, -1), // remove quotes ); return lineIconNames; diff --git a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx index f4150617f1f..2b44e873d1e 100644 --- a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx +++ b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx @@ -19,6 +19,8 @@ import { formatDate, formatDateTime, formatPatientAge, + isAntenatal, + isPostPartum, } from "../../../Utils/utils"; import ReadMore from "../../Common/components/Readmore"; import DailyRoundsList from "../Consultations/DailyRoundsList"; @@ -26,6 +28,7 @@ import EventsList from "./Events/EventsList"; import SwitchTabs from "../../Common/components/SwitchTabs"; import { getVitalsMonitorSocketUrl } from "../../VitalsMonitor/utils"; import { FileUpload } from "../../Patient/FileUpload"; +import CareIcon from "../../../CAREUI/icons/CareIcon"; const PageTitle = lazy(() => import("../../Common/PageTitle")); @@ -321,6 +324,59 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { )} + {((props.patientData.is_antenatal && + isAntenatal(props.patientData.last_menstruation_start_date)) || + isPostPartum(props.patientData.date_of_delivery)) && ( +
+

+ Perinatal Status +

+ +
+ {props.patientData.is_antenatal && + isAntenatal( + props.patientData.last_menstruation_start_date, + ) && ( + + )} + {isPostPartum(props.patientData.date_of_delivery) && ( + + )} +
+ + {props.patientData.last_menstruation_start_date && ( +

+ + Last Menstruation: + + {formatDate( + props.patientData.last_menstruation_start_date, + )} + +

+ )} + + {props.patientData.date_of_delivery && ( +

+ + Date of Delivery: + + {formatDate(props.patientData.date_of_delivery)} + +

+ )} +
+ )} {props.consultationData.symptoms_text && (
diff --git a/src/Components/Patient/ManagePatients.tsx b/src/Components/Patient/ManagePatients.tsx index 894cea89e6e..ff4838c5822 100644 --- a/src/Components/Patient/ManagePatients.tsx +++ b/src/Components/Patient/ManagePatients.tsx @@ -31,7 +31,11 @@ import RecordMeta from "../../CAREUI/display/RecordMeta"; import SearchInput from "../Form/SearchInput"; import SortDropdownMenu from "../Common/SortDropdown"; import SwitchTabs from "../Common/components/SwitchTabs"; -import { formatPatientAge, parsePhoneNumber } from "../../Utils/utils.js"; +import { + formatPatientAge, + isAntenatal, + parsePhoneNumber, +} from "../../Utils/utils.js"; import useFilters from "../../Common/hooks/useFilters"; import { useTranslation } from "react-i18next"; import Page from "../Common/components/Page.js"; @@ -597,6 +601,7 @@ export const PatientManager = () => { )} {patient.gender === 2 && patient.is_antenatal && + isAntenatal(patient.last_menstruation_start_date) && patient.is_active && (
-
+ {/*
Is Antenatal -
+
*/}
Review Missed { ) : ( )} - {patientData.gender === 2 && - patientData.is_antenatal && - patientData.is_active && ( - - )} + {patientData.gender === 2 && ( + <> + {patientData.is_antenatal && + isAntenatal( + patientData.last_menstruation_start_date, + ) && ( + + )} + {isPostPartum(patientData.date_of_delivery) && ( + + )} + + )} {patientData.contact_with_confirmed_carrier && ( { village: data.village ? data.village : "", medical_history: [] as number[], is_antenatal: String(!!data.is_antenatal), + last_menstruation_start_date: data.last_menstruation_start_date, + date_of_delivery: data.date_of_delivery, + is_postpartum: String(!!data.date_of_delivery), allergies: data.allergies ? data.allergies : "", pincode: data.pincode ? data.pincode : "", ongoing_medication: data.ongoing_medication @@ -553,6 +556,16 @@ export const PatientRegister = (props: PatientRegisterProps) => { case "gender": errors[field] = RequiredFieldValidator()(form[field]); return; + case "last_menstruation_start_date": + if (form.is_antenatal === "true") { + errors[field] = RequiredFieldValidator()(form[field]); + } + return; + case "date_of_delivery": + if (form.is_postpartum === "true") { + errors[field] = RequiredFieldValidator()(form[field]); + } + return; case "age": case "date_of_birth": { const field = ageInputType === "age" ? "age" : "date_of_birth"; @@ -801,6 +814,14 @@ export const PatientRegister = (props: PatientRegisterProps) => { gender: Number(formData.gender), nationality: formData.nationality, is_antenatal: formData.is_antenatal, + last_menstruation_start_date: + formData.is_antenatal === "true" + ? dateQueryString(formData.last_menstruation_start_date) + : null, + date_of_delivery: + formData.is_postpartum === "true" + ? dateQueryString(formData.date_of_delivery) + : null, passport_no: formData.nationality !== "India" ? formData.passport_no : undefined, state: formData.nationality === "India" ? formData.state : undefined, @@ -1190,7 +1211,7 @@ export const PatientRegister = (props: PatientRegisterProps) => { )} <>
- + defaults={id ? state.form : initForm} validate={validateForm} onSubmit={handleSubmit} @@ -1485,6 +1506,20 @@ export const PatientRegister = (props: PatientRegisterProps) => { required label="Gender" options={genderTypes} + onChange={(e) => { + field("gender").onChange(e); + if (e.value !== "2") { + field("is_antenatal").onChange({ + name: "is_antenatal", + value: "false", + }); + + field("is_postpartum").onChange({ + name: "is_postpartum", + value: "false", + }); + } + }} optionLabel={(o: any) => o.text} optionValue={(o: any) => o.id} /> @@ -1496,7 +1531,7 @@ export const PatientRegister = (props: PatientRegisterProps) => {
{
} + + { +
+ +
+ } +
+ + option.label} + optionValue={(option) => option.value} + /> + + + +
Home Facility diff --git a/src/Utils/utils.ts b/src/Utils/utils.ts index 977221b6f66..38ffc2e1c66 100644 --- a/src/Utils/utils.ts +++ b/src/Utils/utils.ts @@ -438,3 +438,11 @@ export const properRoundOf = (value: number) => { } return value.toFixed(2); }; + +export const isPostPartum = (data_of_delivery?: string) => { + return dayjs().diff(data_of_delivery, "week") <= 6; +}; + +export const isAntenatal = (menstruation_start_date?: string) => { + return dayjs().diff(menstruation_start_date, "month") <= 9; +};