diff --git a/cypress/e2e/assets_spec/AssetsCreation.cy.ts b/cypress/e2e/assets_spec/AssetsCreation.cy.ts index 775ddc3a609..1bcd984a7a3 100644 --- a/cypress/e2e/assets_spec/AssetsCreation.cy.ts +++ b/cypress/e2e/assets_spec/AssetsCreation.cy.ts @@ -54,7 +54,7 @@ describe("Asset", () => { "email@support.com", "Vendor's Name", serialNumber, - "25/12/2021", + "25122021", "Test note for asset creation!", ); @@ -77,7 +77,7 @@ describe("Asset", () => { "email@support.com", "Vendor's Name", serialNumber, - "25/12/2021", + "25122021", "Test note for asset creation!", ); @@ -104,7 +104,7 @@ describe("Asset", () => { "Customer Support's Name Edited", "Vendor's Name Edited", "Test note for asset creation edited!", - "25/12/2021", + "25122021", ); assetPage.clickUpdateAsset(); @@ -152,7 +152,7 @@ describe("Asset", () => { "email@support.com", "Vendor's Name", serialNumber, - "25/12/2021", + "25122021", "Test note for asset creation!", ); assetPage.interceptAssetCreation(); diff --git a/cypress/e2e/assets_spec/AssetsManage.cy.ts b/cypress/e2e/assets_spec/AssetsManage.cy.ts index a5a7ddf243c..983a82be07b 100644 --- a/cypress/e2e/assets_spec/AssetsManage.cy.ts +++ b/cypress/e2e/assets_spec/AssetsManage.cy.ts @@ -67,7 +67,7 @@ describe("Asset", () => { assetPage.clickupdatedetailbutton(); assetPage.scrollintonotes(); assetPage.enterAssetNotes("Dummy Notes"); - assetPage.enterAssetservicedate("01/09/2023"); + assetPage.enterAssetservicedate("01092023"); assetPage.clickassetupdatebutton(); assetPage.scrollintoservicehistory(); assetPage.clickedithistorybutton(); diff --git a/cypress/e2e/facility_spec/FacilityCreation.cy.ts b/cypress/e2e/facility_spec/FacilityCreation.cy.ts index a65eca5c69e..918e926d107 100644 --- a/cypress/e2e/facility_spec/FacilityCreation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityCreation.cy.ts @@ -32,7 +32,7 @@ describe("Facility Creation", () => { const facilityAddress = "cypress address"; const facilityUpdateAddress = "cypress updated address"; const facilityNumber = "9898469865"; - const triageDate = "02/12/2023"; + const triageDate = "02122023"; const initialTriageValue = "60"; const modifiedTriageValue = "50"; const facilityErrorMessage = [ diff --git a/cypress/e2e/facility_spec/FacilityLocation.cy.ts b/cypress/e2e/facility_spec/FacilityLocation.cy.ts index ab015e175d6..113a5e3eaab 100644 --- a/cypress/e2e/facility_spec/FacilityLocation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityLocation.cy.ts @@ -247,7 +247,7 @@ describe("Location Management Section", () => { "email@support.com", "Vendor's Name", serialNumber, - "25/12/2021", + "25122021", "Test note for asset creation!", ); assetPage.clickassetupdatebutton(); diff --git a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts index d3cc4a52029..9911090eba0 100644 --- a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts +++ b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts @@ -86,7 +86,7 @@ describe("Patient Consultation in multiple combination", () => { patientConsultationPage.selectPatientPrincipalDiagnosis(diagnosis4); patientTreatmentPlan.clickAddProcedure(); patientTreatmentPlan.typeProcedureName(procedureName); - patientTreatmentPlan.typeProcedureTime("22/02/2024 12:30 pm"); + patientTreatmentPlan.typeProcedureTime("220220241230"); patientTreatmentPlan.typeTreatmentPlan(patientTreatment); patientTreatmentPlan.typePatientGeneralInstruction(generalInstruction); patientTreatmentPlan.typeSpecialInstruction(specialInstruction); @@ -182,12 +182,12 @@ describe("Patient Consultation in multiple combination", () => { patientConsultationPage.typeCauseOfDeath("Cause of Death"); patientConsultationPage.typePatientConsultationDate( "#death_datetime", - "22/02/2024 12:30 pm", + "220220241230", ); patientConsultationPage.typeDeathConfirmedBy(doctorName); patientConsultationPage.typePatientConsultationDate( "#encounter_date", - "22/02/2024 12:30 pm", + "220220241230", ); cy.submitButton("Create Consultation"); cy.verifyNotification( @@ -245,7 +245,7 @@ describe("Patient Consultation in multiple combination", () => { ); patientConsultationPage.typePatientConsultationDate( "#icu_admission_date", - "23/02/2024 12:30 pm", + "230220241230", ); // add investigation patientInvestigation.clickAddInvestigation(); @@ -293,7 +293,7 @@ describe("Patient Consultation in multiple combination", () => { ); // verify the free text in referring facility name patientConsultationPage.typeReferringFacility("Life Care Hospital"); - patientConsultationPage.selectSymptomsDate("01/01/2024"); + patientConsultationPage.selectSymptomsDate("01012024"); patientConsultationPage.typeAndMultiSelectSymptoms("s", [ "Sore throat", "Sputum", @@ -338,7 +338,7 @@ describe("Patient Consultation in multiple combination", () => { "Outpatient/Emergency Room", ); // Select the Symptoms - Breathlessness and Bleeding symptoms - patientConsultationPage.selectSymptomsDate("01/01/2024"); + patientConsultationPage.selectSymptomsDate("01012024"); patientConsultationPage.typeAndMultiSelectSymptoms("b", [ "Breathlessness", "Bleeding", diff --git a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts index c49fb5bf08d..7faaeed5a9f 100644 --- a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts +++ b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts @@ -238,7 +238,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.typePhysicalExamination(physicalExamination); patientLogupdate.selectPatientCategory(patientCategory); patientLogupdate.typeOtherDetails(otherExamination); - patientLogupdate.selectSymptomsDate("01/01/2024"); + patientLogupdate.selectSymptomsDate("01012024"); patientLogupdate.typeAndMultiSelectSymptoms("fe", ["Fever"]); patientLogupdate.clickAddSymptom(); patientLogupdate.typeSystolic(patientSystolic); @@ -268,7 +268,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.clickLogupdate(); patientLogupdate.typePhysicalExamination(physicalExamination); patientLogupdate.typeOtherDetails(otherExamination); - patientLogupdate.selectSymptomsDate("01/01/2024"); + patientLogupdate.selectSymptomsDate("01012024"); patientLogupdate.typeAndMultiSelectSymptoms("fe", ["Fever"]); patientLogupdate.selectPatientCategory(patientCategory); patientLogupdate.typeSystolic(patientSystolic); diff --git a/cypress/e2e/patient_spec/PatientRegistration.cy.ts b/cypress/e2e/patient_spec/PatientRegistration.cy.ts index 7a459603b2e..26adc7c882b 100644 --- a/cypress/e2e/patient_spec/PatientRegistration.cy.ts +++ b/cypress/e2e/patient_spec/PatientRegistration.cy.ts @@ -19,11 +19,13 @@ const getRelativeDateString = (deltaDays = 0) => { if (deltaDays) { date.setDate(date.getDate() + deltaDays); } - return date.toLocaleDateString("en-IN", { - day: "2-digit", - month: "2-digit", - year: "numeric", - }); + return date + .toLocaleDateString("en-IN", { + day: "2-digit", + month: "2-digit", + year: "numeric", + }) + .replace("/", ""); }; describe("Patient Creation with consultation", () => { diff --git a/cypress/e2e/users_spec/UsersCreation.cy.ts b/cypress/e2e/users_spec/UsersCreation.cy.ts index 72ce426e805..0c0286e795e 100644 --- a/cypress/e2e/users_spec/UsersCreation.cy.ts +++ b/cypress/e2e/users_spec/UsersCreation.cy.ts @@ -90,7 +90,7 @@ describe("User Creation", () => { userCreationPage.typeIntoElementByIdPostClear("weekly_working_hours", "14"); userCreationPage.typeIntoElementByIdPostClearDob( "date_of_birth", - "01/01/1998", + "01011998", ); userCreationPage.clickElementById("submit"); userCreationPage.verifyElementContainsText( @@ -146,7 +146,7 @@ describe("User Creation", () => { userCreationPage.typeIntoElementById("password", "Test@123"); userCreationPage.selectHomeFacility("Dummy Shifting Center"); userCreationPage.typeIntoElementById("phone_number", phone_number); - userCreationPage.setInputDate("date_of_birth", "date-input", "25/08/1999"); + userCreationPage.setInputDate("date_of_birth", "25081999"); userCreationPage.selectDropdownOption("user_type", "Doctor"); userCreationPage.typeIntoElementById("c_password", "Test@123"); userCreationPage.typeIntoElementById("qualification", "MBBS"); diff --git a/cypress/e2e/users_spec/user_profile.cy.ts b/cypress/e2e/users_spec/user_profile.cy.ts deleted file mode 100644 index 787853c5a79..00000000000 --- a/cypress/e2e/users_spec/user_profile.cy.ts +++ /dev/null @@ -1,82 +0,0 @@ -import LoginPage from "../../pageobject/Login/LoginPage"; -import UserProfilePage from "../../pageobject/Users/UserProfilePage"; -import ManageUserPage from "../../pageobject/Users/ManageUserPage"; - -describe("Manage User Profile", () => { - const loginPage = new LoginPage(); - const userProfilePage = new UserProfilePage(); - const manageUserPage = new ManageUserPage(); - - const date_of_birth = "01/01/1999"; - const gender = "Male"; - const email = "test@example.com"; - const phone = "+918899887788"; - const workinghours = "8"; - const doctorQualification = "MBBS"; - const doctorYoE = "10"; - const medicalCouncilRegistration = "1234567890"; - - const facilitySearch = "Dummy Facility 40"; - - before(() => { - loginPage.loginAsDevDoctor(); - cy.saveLocalStorage(); - }); - - beforeEach(() => { - cy.restoreLocalStorage(); - cy.clearLocalStorage(/filters--.+/); - cy.awaitUrl("/user/profile"); - }); - - it("Set Dob, Gender, Email, Phone and Working Hours for a user and verify its reflection in user profile", () => { - userProfilePage.clickEditProfileButton(); - - userProfilePage.typedate_of_birth(date_of_birth); - userProfilePage.selectGender(gender); - userProfilePage.typeEmail(email); - userProfilePage.typePhone(phone); - userProfilePage.typeWhatsApp(phone); - userProfilePage.typeWorkingHours(workinghours); - userProfilePage.typeDoctorQualification(doctorQualification); - userProfilePage.typeDoctorYoE(doctorYoE); - userProfilePage.typeMedicalCouncilRegistration(medicalCouncilRegistration); - - userProfilePage.clickUpdateButton(); - - cy.verifyNotification("Details updated successfully"); - - userProfilePage.assertdate_of_birth("01/01/1999"); - userProfilePage.assertGender(gender); - userProfilePage.assertEmail(email); - userProfilePage.assertPhone(phone); - userProfilePage.assertWhatsApp(phone); - userProfilePage.assertWorkingHours(workinghours); - }); - - it("Adding video connect link for a user and verify its reflection in user profile and doctor connect", () => { - // verify the user doesn't have any video connect link - userProfilePage.assertVideoConnectLink("-"); - // Link a new video connect link and ensure it is under video connect link - userProfilePage.clickEditProfileButton(); - userProfilePage.typeVideoConnectLink("https://www.example.com"); - userProfilePage.clickUpdateButton(); - userProfilePage.assertVideoConnectLink("https://www.example.com"); - // Edit the video connect link and ensure it is updated - userProfilePage.clickEditProfileButton(); - userProfilePage.typeVideoConnectLink("https://www.test.com"); - userProfilePage.clickUpdateButton(); - userProfilePage.assertVideoConnectLink("https://www.test.com"); - // Go to particular facility doctor connect and verify the video connect link is present - manageUserPage.navigateToFacility(); - manageUserPage.typeFacilitySearch(facilitySearch); - manageUserPage.assertFacilityInCard(facilitySearch); - manageUserPage.clickFacilityPatients(); - manageUserPage.clickDoctorConnectButton(); - manageUserPage.assertVideoConnectLink("Dev Doctor", "https://www.test.com"); - }); - - afterEach(() => { - cy.saveLocalStorage(); - }); -}); diff --git a/cypress/pageobject/Asset/AssetCreation.ts b/cypress/pageobject/Asset/AssetCreation.ts index 2484bb5affe..11c2c912114 100644 --- a/cypress/pageobject/Asset/AssetCreation.ts +++ b/cypress/pageobject/Asset/AssetCreation.ts @@ -62,7 +62,9 @@ export class AssetPage { cy.get( "[data-testid=asset-last-serviced-on-input] input[type='text']", ).click(); - cy.get("#date-input").click().type(lastServicedOn); + cy.get('[data-test-id="date-input"]:visible [data-time-input="0"]') + .click(0, 0) + .type(lastServicedOn); cy.get("body").click(0, 0); cy.get("[data-testid=asset-notes-input] textarea").type(notes); } @@ -121,7 +123,12 @@ export class AssetPage { cy.get( "[data-testid=asset-last-serviced-on-input] input[type='text']", ).click(); - cy.get("#date-input").click().clear().type(lastServicedOn); + cy.get( + '[data-test-id="date-input"]:visible [data-test-id="clear-date-input"]', + ).click(); + cy.get('[data-test-id="date-input"]:visible [data-time-input="0"]') + .click() + .type(lastServicedOn); cy.get("body").click(0, 0); cy.get("[data-testid=asset-notes-input] textarea").clear().type(notes); } @@ -278,7 +285,9 @@ export class AssetPage { enterAssetservicedate(text: string) { cy.get("input[name='last_serviced_on']").click(); - cy.get("#date-input").click().type(text); + cy.get('[data-test-id="date-input"]:visible [data-time-input="0"]') + .click() + .type(text); cy.get("body").click(0, 0); } diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts index 0552a130adc..3001beb4a3b 100644 --- a/cypress/pageobject/Facility/FacilityCreation.ts +++ b/cypress/pageobject/Facility/FacilityCreation.ts @@ -246,7 +246,9 @@ class FacilityPage { fillEntryDate(date) { cy.get("#entry_date").click(); - cy.get("#date-input").click().type(date); + cy.get('[data-test-id="date-input"]:visible [data-time-input="0"]') + .click() + .type(date); cy.get("body").click(0, 0); } diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts index 470febaa852..86c66d846be 100644 --- a/cypress/pageobject/Patient/PatientConsultation.ts +++ b/cypress/pageobject/Patient/PatientConsultation.ts @@ -61,7 +61,12 @@ export class PatientConsultationPage { typePatientConsultationDate(selector: string, date: string) { cy.get(selector).click(); - cy.get("#date-input").clear().type(date); + cy.get( + '[data-test-id="date-input"]:visible [data-test-id="clear-date-input"]', + ).click(); + cy.get('[data-test-id="date-input"]:visible [data-time-input="0"]') + .click() + .type(date); cy.get("body").click(0, 0); } diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts index f0cb415df95..4b101849e70 100644 --- a/cypress/pageobject/Patient/PatientCreation.ts +++ b/cypress/pageobject/Patient/PatientCreation.ts @@ -54,7 +54,9 @@ export class PatientPage { cy.clickAndSelectOption("#patientAge", "DOB"); cy.get("#date_of_birth").scrollIntoView(); cy.get("#date_of_birth").should("be.visible").click(); - cy.get("#date-input").click().type(dateOfBirth); + cy.get('[data-test-id="date-input"]:visible [data-time-input="0"]') + .click() + .type(dateOfBirth); cy.get("body").click(0, 0); } @@ -82,13 +84,17 @@ export class PatientPage { typeLastMenstruationStartDate(date: string) { cy.get("#last_menstruation_start_date").click(); - cy.get("#date-input").click().type(date); + cy.get('[data-test-id="date-input"]:visible [data-time-input="0"]') + .click() + .type(date); cy.get("body").click(0, 0); } typeDateOfDelivery(date: string) { cy.get("#date_of_delivery").click(); - cy.get("#date-input").click().type(date); + cy.get('[data-test-id="date-input"]:visible [data-time-input="0"]') + .click() + .type(date); cy.get("body").click(0, 0); } diff --git a/cypress/pageobject/Patient/PatientPredefined.ts b/cypress/pageobject/Patient/PatientPredefined.ts index f865281c202..f0a005ec97b 100644 --- a/cypress/pageobject/Patient/PatientPredefined.ts +++ b/cypress/pageobject/Patient/PatientPredefined.ts @@ -17,7 +17,7 @@ class PatientPredefined { const emergency_phone_number = generateEmergencyPhoneNumber(); patientPage.typePatientPhoneNumber(phone_number); patientPage.typePatientEmergencyNumber(emergency_phone_number); - patientPage.typePatientDateOfBirth("01/01/2001"); + patientPage.typePatientDateOfBirth("01012001"); patientPage.typePatientName("Patient With Predefined Data"); patientPage.selectPatientGender("Male"); patientPage.typePatientAddress("Test Patient Address"); diff --git a/cypress/pageobject/Patient/PatientTreatmentPlan.ts b/cypress/pageobject/Patient/PatientTreatmentPlan.ts index a78cc3d4a0c..d78f82ba229 100644 --- a/cypress/pageobject/Patient/PatientTreatmentPlan.ts +++ b/cypress/pageobject/Patient/PatientTreatmentPlan.ts @@ -34,7 +34,12 @@ class PatientTreatmentPlan { typeProcedureTime(time: string) { cy.get("#procedure-time").click(); - cy.get("#date-input").clear().type(time); + cy.get( + '[data-test-id="date-input"]:visible [data-test-id="clear-date-input"]', + ).click(); + cy.get('[data-test-id="date-input"]:visible [data-time-input="0"]') + .click() + .type(time); cy.get("body").click(0, 0); } diff --git a/cypress/pageobject/Users/UserCreation.ts b/cypress/pageobject/Users/UserCreation.ts index 7503ea3fb07..5442ec9d943 100644 --- a/cypress/pageobject/Users/UserCreation.ts +++ b/cypress/pageobject/Users/UserCreation.ts @@ -19,7 +19,12 @@ export class UserCreationPage { } typeIntoElementByIdPostClearDob(elementId: string, value: string) { cy.get("#" + elementId).click(); - cy.get("#date-input").clear().type(value); + cy.get( + '[data-test-id="date-input"]:visible [data-test-id="clear-date-input"]', + ).click(); + cy.get('[data-test-id="date-input"]:visible [data-time-input="0"]') + .click() + .type(value); } clearIntoElementById(elementId: string) { cy.get("#" + elementId) @@ -54,13 +59,9 @@ export class UserCreationPage { this.selectOptionContainingText(name); } - setInputDate( - dateElementId: string, - inputElementId: string, - dateValue: string, - ) { + setInputDate(dateElementId: string, dateValue: string) { this.clickElementById(dateElementId); - this.typeIntoElementById(inputElementId, dateValue); + cy.get(`[data-test-id="date-input"]:visible`).click().type(dateValue); } selectDropdownOption(dropdownId: string, optionText: string) { diff --git a/cypress/pageobject/Users/UserProfilePage.ts b/cypress/pageobject/Users/UserProfilePage.ts index 20fd1911c49..4b9196ed5f5 100644 --- a/cypress/pageobject/Users/UserProfilePage.ts +++ b/cypress/pageobject/Users/UserProfilePage.ts @@ -18,7 +18,12 @@ export default class UserProfilePage { typedate_of_birth(date_of_birth: string) { //check cy.get("#date_of_birth").click(); - cy.get("#date-input").clear().type(date_of_birth); + cy.get( + '[data-test-id="date-input"]:visible [data-test-id="clear-date-input"]', + ).click(); + cy.get('[data-test-id="date-input"]:visible [data-time-input="0"]').type( + date_of_birth, + ); } selectGender(gender: string) { diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index d6ec9e067f9..9cd25bf9b12 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -173,10 +173,15 @@ Cypress.Commands.add("selectRadioOption", (name: string, value: string) => { cy.get(`input[type='radio'][name='${name}'][value=${value}]`).click(); }); -Cypress.Commands.add("clickAndTypeDate", (selector: string, date: string) => { +Cypress.Commands.add("clickAndTypeDate", (selector, date) => { cy.get(selector).scrollIntoView(); cy.get(selector).click(); - cy.get("#date-input").click().type(date); + cy.get( + `[data-test-id="date-input"]:visible [data-test-id="clear-date-input"]`, + ).click(); + cy.get(`[data-test-id="date-input"]:visible [data-time-input="0"]`) + .click() + .type(date); cy.get("body").click(0, 0); }); diff --git a/src/Components/Common/DateInputV2.tsx b/src/Components/Common/DateInputV2.tsx index cc678768ebe..92ad574b4c9 100644 --- a/src/Components/Common/DateInputV2.tsx +++ b/src/Components/Common/DateInputV2.tsx @@ -28,7 +28,7 @@ interface Props { min?: Date; max?: Date; outOfLimitsErrorMessage?: string; - onChange: (date: Date) => void; + onChange: (date: Date | undefined) => void; position?: DatePickerPosition; disabled?: boolean; placeholder?: string; diff --git a/src/Components/Common/DateTextInput.tsx b/src/Components/Common/DateTextInput.tsx index 882eb410834..94384b9da36 100644 --- a/src/Components/Common/DateTextInput.tsx +++ b/src/Components/Common/DateTextInput.tsx @@ -1,3 +1,4 @@ +import CareIcon from "@/CAREUI/icons/CareIcon"; import { classNames } from "@/Utils/utils"; import dayjs from "dayjs"; import { Fragment, KeyboardEvent, useEffect, useState } from "react"; @@ -16,7 +17,7 @@ import { Fragment, KeyboardEvent, useEffect, useState } from "react"; export default function DateTextInput(props: { allowTime: boolean; value?: Date; - onChange: (date: Date) => unknown; + onChange: (date: Date | undefined) => unknown; error?: string; }) { const { value, onChange, allowTime, error } = props; @@ -56,7 +57,9 @@ export default function DateTextInput(props: { const index = Object.keys(editingText).findIndex((et) => et === key); const value = Math.min(maxMap[index], parseInt(rawValue)); const finalValue = - rawValue !== "" ? ("000" + value).slice(key === "year" ? -4 : -2) : ""; + rawValue.trim() !== "" + ? ("000" + value).slice(key === "year" ? -4 : -2) + : ""; return finalValue; }; @@ -115,12 +118,16 @@ export default function DateTextInput(props: {