diff --git a/cypress/e2e/facility_spec/FacilityCreation.cy.ts b/cypress/e2e/facility_spec/FacilityCreation.cy.ts index 5e644238999..5fd988480fc 100644 --- a/cypress/e2e/facility_spec/FacilityCreation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityCreation.cy.ts @@ -317,6 +317,39 @@ describe("Facility Creation", () => { ); }); + it("Should display error when district admin tries to create facility in a different district", () => { + facilityPage.visitCreateFacilityPage(); + facilityPage.fillFacilityName(facilityName); + facilityPage.selectFacilityType(facilityType); + facilityPage.fillPincode("682001"); + facilityPage.selectStateOnPincode("Kerala"); + facilityPage.selectDistrictOnPincode("Kottayam"); + facilityPage.selectLocalBody("Arpookara"); + facilityPage.selectWard("5"); + facilityPage.fillAddress(facilityAddress); + facilityPage.fillPhoneNumber(facilityNumber); + facilityPage.submitForm(); + facilityPage.verifyErrorNotification( + "You do not have permission to perform this action.", + ); + }); + + it("Access Restriction for Non-Admin Users to facility creation page", () => { + const nonAdminLoginMethods = [ + loginPage.loginAsDevDoctor.bind(loginPage), + loginPage.loginAsStaff.bind(loginPage), + ]; + + nonAdminLoginMethods.forEach((loginMethod) => { + loginMethod(); + cy.visit("/facility/create"); + facilityPage.verifyErrorNotification( + "You don't have permission to perform this action. Contact the admin", + ); + cy.clearCookies(); + }); + }); + afterEach(() => { cy.saveLocalStorage(); }); diff --git a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts index 08ea39ee2c9..2c5699ec76c 100644 --- a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts +++ b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts @@ -152,7 +152,7 @@ describe("Facility Homepage Function", () => { facilityNotify.verifyFacilityName(facilityName); facilityNotify.fillNotifyText(notificationMessage); facilityNotify.interceptPostNotificationReq(); - cy.submitButton("Notify"); + cy.clickSubmitButton("Notify"); facilityNotify.verifyPostNotificationReq(); cy.verifyNotification("Facility Notified"); cy.closeNotification(); @@ -160,7 +160,7 @@ describe("Facility Homepage Function", () => { // Verify the frontend error on empty message facilityHome.clickFacilityNotifyButton(); facilityNotify.verifyFacilityName(facilityName); - cy.submitButton("Notify"); + cy.clickSubmitButton("Notify"); facilityNotify.verifyErrorMessage(notificationErrorMsg); // close pop-up and verify facilityHome.verifyAndCloseNotifyModal(); diff --git a/cypress/e2e/facility_spec/FacilityLocation.cy.ts b/cypress/e2e/facility_spec/FacilityLocation.cy.ts index b700f5c75ae..7d0c626a93b 100644 --- a/cypress/e2e/facility_spec/FacilityLocation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityLocation.cy.ts @@ -194,14 +194,14 @@ describe("Location Management Section", () => { facilityLocation.clickAddNewLocationButton(); facilityLocation.enterLocationName("Test Location with Beds"); facilityLocation.selectLocationType("OTHER"); - cy.submitButton("Add Location"); + cy.clickSubmitButton("Add Location"); cy.verifyNotification("Location created successfully"); cy.closeNotification(); facilityLocation.clickManageBedButton(); facilityLocation.clickAddBedButton(); facilityLocation.enterBedName("Bed 1"); facilityLocation.selectBedType("Regular"); - cy.submitButton("Add Bed(s)"); + cy.clickSubmitButton("Add Bed(s)"); cy.verifyNotification("1 Bed created successfully"); cy.closeNotification(); facilityLocation.loadLocationManagementPage("Dummy Shifting Center"); diff --git a/cypress/e2e/hcx_spec/HcxClaims.cy.ts b/cypress/e2e/hcx_spec/HcxClaims.cy.ts index 2c4a6b45df9..869afd6fcbb 100644 --- a/cypress/e2e/hcx_spec/HcxClaims.cy.ts +++ b/cypress/e2e/hcx_spec/HcxClaims.cy.ts @@ -48,7 +48,7 @@ describe("HCX Claims configuration and approval workflow", () => { firstInsuranceIdentifier, patientInsurerName, ); - cy.submitButton("Save Details"); + cy.clickSubmitButton("Save Details"); cy.verifyNotification("Patient updated successfully"); cy.closeNotification(); // Navigate to Consultation View and capture dynamic consultation ID @@ -80,6 +80,8 @@ describe("HCX Claims configuration and approval workflow", () => { // Raise a HCX Pre-auth patientConsultationPage.clickManagePatientButton(); patientConsultationPage.clickClaimsButton(); + cy.verifyAndClickElement("#edit-insurance-policy", "Edit Insurance Policy"); + cy.clickCancelButton(); hcxClaims.selectEligiblePolicy(patientInsurerName); hcxClaims.verifyPolicyEligibility(); cy.verifyNotification("Checking Policy Eligibility"); diff --git a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts index 4c84f7fad8f..bd6e7c0d967 100644 --- a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts +++ b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts @@ -91,11 +91,11 @@ describe("Patient Consultation in multiple combination", () => { patientTreatmentPlan.typePatientGeneralInstruction(generalInstruction); patientTreatmentPlan.typeSpecialInstruction(specialInstruction); patientTreatmentPlan.fillTreatingPhysican(doctorName); - cy.submitButton("Create Consultation"); + cy.clickSubmitButton("Create Consultation"); // the above submit should fail as IP number is missing patientConsultationPage.typePatientNumber(patientIpNumber); patientConsultationPage.selectBed("Dummy Bed 6"); - cy.submitButton("Create Consultation"); + cy.clickSubmitButton("Create Consultation"); cy.verifyNotification("Consultation created successfully"); // Below code for the prescription module only present while creating a new consultation patientPrescription.clickAddPrescription(); @@ -104,7 +104,7 @@ describe("Patient Consultation in multiple combination", () => { patientPrescription.selectMedicine(medicineOne); patientPrescription.enterDosage("3"); patientPrescription.selectDosageFrequency("Twice daily"); - cy.submitButton("Submit"); + cy.clickSubmitButton("Submit"); cy.wait(2000); cy.verifyNotification("Medicine prescribed"); patientPrescription.clickReturnToDashboard(); @@ -189,7 +189,7 @@ describe("Patient Consultation in multiple combination", () => { "#encounter_date", "220220241230", ); - cy.submitButton("Create Consultation"); + cy.clickSubmitButton("Create Consultation"); cy.verifyNotification( "Create Diagnoses - Atleast one diagnosis is required", ); @@ -198,7 +198,7 @@ describe("Patient Consultation in multiple combination", () => { diagnosis4, "add-icd11-diagnosis-as-confirmed", ); - cy.submitButton("Create Consultation"); + cy.clickSubmitButton("Create Consultation"); cy.verifyNotification("Consultation created successfully"); // verify the data and death report patientConsultationPage.verifyTextInConsultation( @@ -215,7 +215,7 @@ describe("Patient Consultation in multiple combination", () => { "#cause_of_death", "Cause of Death", ); - cy.submitButton("Preview"); + cy.clickSubmitButton("Preview"); cy.preventPrint(); patientDeathReport.clickPrintDeathReport(); cy.get("@verifyPrevent").should("be.called"); @@ -261,7 +261,7 @@ describe("Patient Consultation in multiple combination", () => { // add telemedicine patientTreatmentPlan.clickTelemedicineCheckbox(); patientTreatmentPlan.assignTelemedicineDoctor(doctorName); - cy.submitButton("Create Consultation"); + cy.clickSubmitButton("Create Consultation"); cy.verifyNotification("Consultation created successfully"); // verify the data reflection - patientConsultationPage.verifyTextInConsultation( @@ -312,7 +312,7 @@ describe("Patient Consultation in multiple combination", () => { patientTreatmentPlan.typePatientGeneralInstruction(generalInstruction); // no review after and no action patientTreatmentPlan.fillTreatingPhysican(doctorName); - cy.submitButton("Create Consultation"); + cy.clickSubmitButton("Create Consultation"); cy.verifyNotification("Patient discharged successfully"); // verify the Discharge Reason, Diagnosis, treatment physican patientConsultationPage.verifyTextInConsultation( @@ -364,13 +364,13 @@ describe("Patient Consultation in multiple combination", () => { patientTreatmentPlan.typePatientGeneralInstruction(generalInstruction); patientTreatmentPlan.fillTreatingPhysican(doctorName); // no review after and no action - cy.submitButton("Create Consultation"); + cy.clickSubmitButton("Create Consultation"); // Create a shifting request cy.closeNotification(); shiftCreation.typeCurrentFacilityPerson("Current Facility Person"); shiftCreation.typeCurrentFacilityPhone("9999999999"); shiftCreation.typeShiftReason("reason for shift"); - cy.submitButton("Submit"); + cy.clickSubmitButton("Submit"); cy.verifyNotification("Shift request created successfully"); }); @@ -386,7 +386,7 @@ describe("Patient Consultation in multiple combination", () => { cy.get("#condition-verification-status-menu").click(); cy.get("#add-icd11-diagnosis-as-entered-in-error").click(); }); - cy.submitButton("Update Consultation"); + cy.clickSubmitButton("Update Consultation"); cy.verifyNotification("Consultation updated successfully"); cy.get("#diagnoses-view").should("not.contain.text", diagnosis5); patientConsultationPage.verifyTextInConsultation( diff --git a/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts b/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts index e2403fd56bd..6a3d2863818 100644 --- a/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts +++ b/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts @@ -34,8 +34,8 @@ describe("Patient Discharge based on multiple reason", () => { patientPage.visitPatient("Dummy Patient 12"); patientDischarge.clickDischarge(); patientDischarge.selectDischargeReason(patientDischargeReason4); - cy.submitButton("Confirm Discharge"); - cy.submitButton("Acknowledge & Submit"); + cy.clickSubmitButton("Confirm Discharge"); + cy.clickSubmitButton("Acknowledge & Submit"); cy.verifyNotification("Patient Discharged Successfully"); cy.closeNotification(); // Verify the consultation dashboard reflection @@ -52,8 +52,8 @@ describe("Patient Discharge based on multiple reason", () => { patientDischarge.selectDischargeReason(patientDischargeReason3); patientDischarge.typeDischargeNote(patientDeathCause); patientDischarge.typeDoctorName(doctorName); - cy.submitButton("Confirm Discharge"); - cy.submitButton("Acknowledge & Submit"); + cy.clickSubmitButton("Confirm Discharge"); + cy.clickSubmitButton("Acknowledge & Submit"); cy.verifyNotification("Patient Discharged Successfully"); cy.closeNotification(); // Verify the consultation dashboard reflection @@ -77,8 +77,8 @@ describe("Patient Discharge based on multiple reason", () => { // select a non-registered facility and perform the discharge patientDischarge.typeReferringFacility(referringFreetextFacility); cy.wait(2000); - cy.submitButton("Confirm Discharge"); - cy.submitButton("Acknowledge & Submit"); + cy.clickSubmitButton("Confirm Discharge"); + cy.clickSubmitButton("Acknowledge & Submit"); cy.wait(2000); cy.verifyNotification("Patient Discharged Successfully"); cy.closeNotification(); @@ -104,13 +104,13 @@ describe("Patient Discharge based on multiple reason", () => { patientPrescription.selectMedicine(patientMedicine); patientPrescription.enterDosage("4"); patientPrescription.selectDosageFrequency("Twice daily"); - cy.submitButton("Submit"); + cy.clickSubmitButton("Submit"); cy.verifyNotification("Medicine prescribed"); cy.wait(2000); cy.closeNotification(); // submit the discharge pop-up - cy.submitButton("Confirm Discharge"); - cy.submitButton("Acknowledge & Submit"); + cy.clickSubmitButton("Confirm Discharge"); + cy.clickSubmitButton("Acknowledge & Submit"); cy.wait(2000); cy.verifyNotification("Patient Discharged Successfully"); cy.closeNotification(); diff --git a/cypress/e2e/patient_spec/PatientInvestigation.cy.ts b/cypress/e2e/patient_spec/PatientInvestigation.cy.ts index 7426890d5a6..262759bd360 100644 --- a/cypress/e2e/patient_spec/PatientInvestigation.cy.ts +++ b/cypress/e2e/patient_spec/PatientInvestigation.cy.ts @@ -28,7 +28,7 @@ describe("Patient Investigation Creation from Patient consultation page", () => "Haematology", "Urine Test", ]); - cy.submitButton("Save Investigation"); + cy.clickSubmitButton("Save Investigation"); cy.verifyNotification("Please Enter at least one value"); cy.closeNotification(); // Temporary workflow for investigation since we dont have dummy data and moving away from existing module diff --git a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts index b6399ff02ce..05958bdf3f0 100644 --- a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts +++ b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts @@ -55,7 +55,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientPage.visitPatient(domicilaryPatient); patientConsultationPage.clickEditConsultationButton(); patientConsultationPage.selectPatientSuggestion("Domiciliary Care"); - cy.submitButton("Update Consultation"); + cy.clickSubmitButton("Update Consultation"); cy.verifyNotification("Consultation updated successfully"); cy.closeNotification(); patientLogupdate.clickLogupdate(); @@ -74,7 +74,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.selectRhythm(patientRhythmType); patientLogupdate.typeRhythm(patientRhythm); cy.get("#consciousness_level-option-RESPONDS_TO_PAIN").click(); - cy.submitButton("Save"); + cy.clickSubmitButton("Save"); cy.verifyNotification("Tele-medicine Log created successfully"); }); @@ -108,11 +108,11 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientPrescription.selectMedicine("DOLO"); patientPrescription.enterDosage("4"); patientPrescription.selectDosageFrequency("Twice daily"); - cy.submitButton("Submit"); + cy.clickSubmitButton("Submit"); cy.verifyNotification("Medicine prescribed"); cy.closeNotification(); // Submit the doctors log update - cy.submitButton("Save and Continue"); + cy.clickSubmitButton("Save and Continue"); cy.wait(2000); cy.verifyNotification("Progress Note created successfully"); cy.closeNotification(); @@ -120,13 +120,13 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.selectCriticalCareSection("Neurological Monitoring"); cy.get("#consciousness_level-option-RESPONDS_TO_PAIN").click(); cy.get("#left_pupil_light_reaction-option-FIXED").click(); - cy.submitButton("Update Details"); + cy.clickSubmitButton("Update Details"); cy.verifyNotification( "Neurological Monitoring details succesfully updated.", ); cy.closeNotification(); // Final Submission of the form - cy.submitButton("Complete"); + cy.clickSubmitButton("Complete"); cy.verifyNotification("Progress Note Log Update filed successfully"); cy.closeNotification(); // Verify the data reflection @@ -143,7 +143,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.clickUpdateDetail(); patientLogupdate.typeSystolic(patientModifiedSystolic); patientLogupdate.typeDiastolic(patientModifiedDiastolic); - cy.submitButton("Continue"); + cy.clickSubmitButton("Continue"); cy.verifyNotification("Progress Note updated successfully"); }); @@ -156,7 +156,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.clickLogupdate(); patientLogupdate.selectRoundType("Detailed Update"); patientLogupdate.selectPatientCategory(patientCategory); - cy.submitButton("Save and Continue"); + cy.clickSubmitButton("Save and Continue"); cy.verifyNotification("Detailed Update created successfully"); cy.closeNotification(); // Select two Section - First One is Respiratory Support @@ -166,7 +166,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.selectOxygenSupport(); patientLogupdate.typeOxygenFlowRate(patientOxygenFlowRate); patientLogupdate.typeVentilatorSpo2(patientSpo2); - cy.submitButton("Update Details"); + cy.clickSubmitButton("Update Details"); cy.verifyNotification("Respiratory Support details succesfully updated."); cy.closeNotification(); // Second Section will be Blood Sugar @@ -174,10 +174,10 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.typeBloodSugar(patientBloodSugar); patientLogupdate.typeInsulinDosage(patientInsulinDosage); cy.get("#insulin_intake_frequency-option-BD").click(); - cy.submitButton("Update Details"); + cy.clickSubmitButton("Update Details"); cy.verifyNotification("Blood Sugar details succesfully updated."); // Submit the form and verify the details - cy.submitButton("Complete"); + cy.clickSubmitButton("Complete"); cy.verifyNotification("Detailed Log Update filed successfully"); cy.closeNotification(); cy.contains("button", "Log Updates").click(); @@ -203,10 +203,10 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.selectCriticalCareSection("Dialysis"); patientLogupdate.typeFluidBalance(patientFluidBalance); patientLogupdate.typeNetBalance(patientNetBalance); - cy.submitButton("Update Details"); + cy.clickSubmitButton("Update Details"); cy.verifyNotification("Dialysis details succesfully updated."); cy.closeNotification(); - cy.submitButton("Complete"); + cy.clickSubmitButton("Complete"); cy.verifyNotification("Detailed Log Update filed successfully"); cy.closeNotification(); //Reverify the editted and newly added data @@ -251,7 +251,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.selectRhythm(patientRhythmType); patientLogupdate.typeRhythm(patientRhythm); cy.get("#consciousness_level-option-RESPONDS_TO_PAIN").click(); - cy.submitButton("Save"); + cy.clickSubmitButton("Save"); cy.wait(2000); cy.verifyNotification("Brief Update created successfully"); // Verify the card content @@ -263,7 +263,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientPage.visitPatient(domicilaryPatient); patientConsultationPage.clickEditConsultationButton(); patientConsultationPage.selectPatientSuggestion("Domiciliary Care"); - cy.submitButton("Update Consultation"); + cy.clickSubmitButton("Update Consultation"); cy.verifyNotification("Consultation updated successfully"); cy.closeNotification(); patientLogupdate.clickLogupdate(); @@ -281,7 +281,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.selectRhythm(patientRhythmType); patientLogupdate.typeRhythm(patientRhythm); cy.get("#consciousness_level-option-RESPONDS_TO_PAIN").click(); - cy.submitButton("Save"); + cy.clickSubmitButton("Save"); cy.verifyNotification("Brief Update created successfully"); cy.closeNotification(); // edit the card and verify the data. @@ -307,7 +307,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.typeSystolic(patientModifiedSystolic); patientLogupdate.clearIntoElementById("#diastolic"); patientLogupdate.typeDiastolic(patientModifiedDiastolic); - cy.submitButton("Continue"); + cy.clickSubmitButton("Continue"); cy.verifyNotification("Brief Update updated successfully"); cy.contains("button", "Log Updates").click(); patientLogupdate.clickLogUpdateViewDetails( @@ -324,7 +324,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientPage.visitPatient(domicilaryPatient); patientConsultationPage.clickEditConsultationButton(); patientConsultationPage.selectPatientSuggestion("Domiciliary Care"); - cy.submitButton("Update Consultation"); + cy.clickSubmitButton("Update Consultation"); cy.verifyNotification("Consultation updated successfully"); cy.closeNotification(); patientLogupdate.clickLogupdate(); @@ -336,7 +336,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.typeTemperature(patientTemperature); patientLogupdate.typeRespiratory(patientRespiratory); cy.get("#consciousness_level-option-RESPONDS_TO_PAIN").click(); - cy.submitButton("Save"); + cy.clickSubmitButton("Save"); cy.verifyNotification("Brief Update created successfully"); cy.closeNotification(); cy.verifyContentPresence("#consultation-buttons", ["9"]); @@ -346,7 +346,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.typeSystolic(patientSystolic); patientLogupdate.typeDiastolic(patientDiastolic); patientLogupdate.typePulse(patientPulse); - cy.submitButton("Save"); + cy.clickSubmitButton("Save"); cy.verifyNotification("Brief Update created successfully"); cy.closeNotification(); cy.verifyContentPresence("#consultation-buttons", ["-"]); diff --git a/cypress/e2e/patient_spec/PatientPrescription.cy.ts b/cypress/e2e/patient_spec/PatientPrescription.cy.ts index 53e67324199..1011c2f4f4d 100644 --- a/cypress/e2e/patient_spec/PatientPrescription.cy.ts +++ b/cypress/e2e/patient_spec/PatientPrescription.cy.ts @@ -36,7 +36,7 @@ describe("Patient Medicine Administration", () => { patientPrescription.selectMedicine(medicineNameOne); patientPrescription.enterDosage(medicineBaseDosage); patientPrescription.selectDosageFrequency(medicineFrequency); - cy.submitButton("Submit"); + cy.clickSubmitButton("Submit"); cy.verifyNotification("Medicine prescribed"); cy.closeNotification(); // Edit the existing medicine & Verify they are properly moved to discontinue position @@ -44,16 +44,16 @@ describe("Patient Medicine Administration", () => { patientPrescription.visitMedicineTab(); cy.verifyAndClickElement("#0", medicineNameOne); cy.verifyContentPresence("#submit", ["Discontinue"]); // To verify the pop-up is open - cy.submitButton("Edit"); + cy.clickSubmitButton("Edit"); patientPrescription.enterDosage(medicineTargetDosage); - cy.submitButton("Submit"); + cy.clickSubmitButton("Submit"); cy.verifyNotification("Prescription edited successfully"); cy.closeNotification(); // Discontinue a medicine & Verify the notification cy.verifyAndClickElement("#0", medicineNameOne); - cy.submitButton("Discontinue"); + cy.clickSubmitButton("Discontinue"); patientPrescription.enterDiscontinueReason("Medicine is been discontinued"); - cy.submitButton("Confirm Discontinue"); + cy.clickSubmitButton("Confirm Discontinue"); cy.verifyNotification("Prescription discontinued"); cy.closeNotification(); // verify the discontinue medicine view @@ -73,7 +73,7 @@ describe("Patient Medicine Administration", () => { patientPrescription.selectMedicine(medicineNameOne); patientPrescription.enterDosage(medicineBaseDosage); patientPrescription.enterIndicator(medicineIndicator); - cy.submitButton("Submit"); + cy.clickSubmitButton("Submit"); cy.verifyNotification("Medicine prescribed"); cy.closeNotification(); // Add Second Medicine @@ -83,7 +83,7 @@ describe("Patient Medicine Administration", () => { patientPrescription.selectMedicine(medicineNameTwo); patientPrescription.enterDosage(medicineBaseDosage); patientPrescription.enterIndicator(medicineIndicator); - cy.submitButton("Submit"); + cy.clickSubmitButton("Submit"); cy.verifyNotification("Medicine prescribed"); cy.closeNotification(); patientPrescription.clickReturnToDashboard(); @@ -108,7 +108,7 @@ describe("Patient Medicine Administration", () => { patientPrescription.enterDosage(medicineBaseDosage); patientPrescription.enterTargetDosage(medicineTargetDosage); patientPrescription.selectDosageFrequency(medicineFrequency); - cy.submitButton("Submit"); + cy.clickSubmitButton("Submit"); cy.verifyNotification("Medicine prescribed"); cy.closeNotification(); // Administer the medicine in edit form @@ -116,7 +116,7 @@ describe("Patient Medicine Administration", () => { cy.wait(2000); patientPrescription.enterAdministerDosage(medicineBaseDosage); patientPrescription.enterAdministerNotes(medicineAdministerNote); - cy.submitButton("Administer Medicine"); + cy.clickSubmitButton("Administer Medicine"); cy.verifyNotification("Medicine(s) administered"); cy.closeNotification(); // Verify the Reflection on the Medicine @@ -129,9 +129,9 @@ describe("Patient Medicine Administration", () => { // Go to medicine tab and administer it again patientPrescription.visitMedicineTab(); cy.verifyAndClickElement("#0", medicineNameOne); - cy.submitButton("Administer"); + cy.clickSubmitButton("Administer"); patientPrescription.enterAdministerDosage(medicineBaseDosage); - cy.submitButton("Administer Medicine"); + cy.clickSubmitButton("Administer Medicine"); cy.verifyNotification("Medicine(s) administered"); }); @@ -145,7 +145,7 @@ describe("Patient Medicine Administration", () => { patientPrescription.selectMedicine(medicineNameOne); patientPrescription.enterDosage(medicineBaseDosage); patientPrescription.selectDosageFrequency(medicineFrequency); - cy.submitButton("Submit"); + cy.clickSubmitButton("Submit"); cy.verifyNotification("Medicine prescribed"); cy.closeNotification(); // verify the duplicate medicine error message @@ -155,7 +155,7 @@ describe("Patient Medicine Administration", () => { patientPrescription.selectMedicine(medicineNameOne); patientPrescription.enterDosage(medicineBaseDosage); patientPrescription.selectDosageFrequency(medicineFrequency); - cy.submitButton("Submit"); + cy.clickSubmitButton("Submit"); cy.verifyNotification( "Medicine - This medicine is already prescribed to this patient. Please discontinue the existing prescription to prescribe again.", ); diff --git a/cypress/e2e/sample_test_spec/SampleTestRequest.cy.ts b/cypress/e2e/sample_test_spec/SampleTestRequest.cy.ts new file mode 100644 index 00000000000..a0f30ebd6db --- /dev/null +++ b/cypress/e2e/sample_test_spec/SampleTestRequest.cy.ts @@ -0,0 +1,88 @@ +import LoginPage from "pageobject/Login/LoginPage"; +import { PatientConsultationPage } from "pageobject/Patient/PatientConsultation"; +import { PatientPage } from "pageobject/Patient/PatientCreation"; +import { SampleTestPage } from "pageobject/Sample/SampleTestCreate"; + +describe("Sample Test", () => { + const sampleTestPage = new SampleTestPage(); + const patientPage = new PatientPage(); + const loginPage = new LoginPage(); + const patientConsultationPage = new PatientConsultationPage(); + const patientName = "Dummy Patient 11"; + const sampleTestType = "BA/ETA"; + const icmrCategory = "Cat 0"; + const icmrLabel = "Test Icmr Label"; + const doctorName = "Dr John Doe"; + const atypicalDetails = "Patient showing unusual symptoms"; + const diagnosis = "Suspected respiratory infection"; + const etiologyIdentified = "Bacterial infection suspected"; + const differentialDiagnosis = "Possibly a viral infection"; + const fastTrackReason = + "The patient has a high risk of complications and requires immediate testing."; + const sampleTestStatus = "Request Submitted"; + const expectedSampleTestType = "ba/eta"; + const sampleTestResult = "Awaiting"; + + before(() => { + loginPage.loginAsDistrictAdmin(); + cy.saveLocalStorage(); + }); + + beforeEach(() => { + cy.restoreLocalStorage(); + cy.clearLocalStorage(/filters--.+/); + }); + + it("should request a new sample test", () => { + // Ensure patient list API is loaded before proceeding + cy.awaitUrl("/patients"); + patientPage.visitPatient(patientName); + patientConsultationPage.interceptPatientDetailsAPI(); + patientConsultationPage.clickPatientDetails(); + patientConsultationPage.verifyPatientDetailsResponse(); + // Visit SampleRequest Page + sampleTestPage.visitSampleRequestPage(); + // Fill Sample Test Request Form + sampleTestPage.selectSampleType(sampleTestType); + sampleTestPage.selectIcmrCategory(icmrCategory); + sampleTestPage.fillIcmrLabel(icmrLabel); + sampleTestPage.fillFastTrackReason(fastTrackReason); + sampleTestPage.fillDoctorName(doctorName); + sampleTestPage.fillAtypicalPresentation(atypicalDetails); + sampleTestPage.fillDiagnosis(diagnosis); + sampleTestPage.fillEtiology(etiologyIdentified); + sampleTestPage.fillDiffDiagnosis(differentialDiagnosis); + sampleTestPage.checkHasSari(); + sampleTestPage.checkHasAri(); + sampleTestPage.checkIsUnusualCourse(); + sampleTestPage.interceptSampleTestReq(); + // Submit the form and verify notification + cy.clickSubmitButton("Confirm your request to send sample for testing"); + sampleTestPage.verifySampleTestReq(); + cy.verifyNotification("Sample test created successfully"); + // Check the updated request history + sampleTestPage.checkRequestHistory( + sampleTestStatus, + expectedSampleTestType, + fastTrackReason, + sampleTestResult, + ); + // Checking Reflection on Sample Page + cy.awaitUrl("/sample"); + sampleTestPage.interceptGetSampleTestReq(); + sampleTestPage.searchPatientSample(patientName); + sampleTestPage.verifyGetSampleTestReq(); + sampleTestPage.verifyPatientName(patientName); + sampleTestPage.interceptGetSampleTestReq(); + sampleTestPage.clickOnSampleDetailsBtn(); + sampleTestPage.verifyGetSampleTestReq(); + sampleTestPage.verifyPatientTestDetails( + patientName, + fastTrackReason, + doctorName, + diagnosis, + differentialDiagnosis, + etiologyIdentified, + ); + }); +}); diff --git a/cypress/e2e/users_spec/UsersManage.cy.ts b/cypress/e2e/users_spec/UsersManage.cy.ts index 22da938542d..40d436be0a6 100644 --- a/cypress/e2e/users_spec/UsersManage.cy.ts +++ b/cypress/e2e/users_spec/UsersManage.cy.ts @@ -60,6 +60,7 @@ describe("Manage User", () => { advanceFilters.clickAdvancedFiltersButton(); userPage.typeInFirstName(firstNameUserSkill); userPage.typeInLastName(lastNameUserSkill); + userPage.selectHomeFacility(facilitytolinkskill); advanceFilters.applySelectedFilter(); userPage.checkUsernameText(usernameToLinkSkill); manageUserPage.clicklinkedskillbutton(); diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts index 6ce0cc6270e..0fddc3f9799 100644 --- a/cypress/pageobject/Facility/FacilityCreation.ts +++ b/cypress/pageobject/Facility/FacilityCreation.ts @@ -276,7 +276,7 @@ class FacilityPage { } confirmDeleteFacility() { - cy.submitButton("Delete"); + cy.clickSubmitButton("Delete"); } selectLocation(location: string) { @@ -302,6 +302,10 @@ class FacilityPage { cy.verifyNotification(message); } + verifyErrorNotification(message: string) { + cy.verifyNotification(message); + } + visitAlreadyCreatedFacility() { cy.intercept("GET", "**/api/v1/facility/**").as("getFacilities"); cy.get("[id='facility-details']").first().click(); diff --git a/cypress/pageobject/Login/LoginPage.ts b/cypress/pageobject/Login/LoginPage.ts index 07eb4486d17..714004023f7 100644 --- a/cypress/pageobject/Login/LoginPage.ts +++ b/cypress/pageobject/Login/LoginPage.ts @@ -20,13 +20,13 @@ class LoginPage { } else { cy.get("input[id='password']").type("Corona"); } - cy.submitButton("Login"); + cy.clickSubmitButton("Login"); } loginManuallyAsNurse(): void { cy.get("input[id='username']").click().type("dummynurse1"); cy.get("input[id='password']").click().type("Coronasafe@123"); - cy.submitButton("Login"); + cy.clickSubmitButton("Login"); } login(username: string, password: string): void { diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts index 642eaf9e4d6..c8046a39a9e 100644 --- a/cypress/pageobject/Patient/PatientConsultation.ts +++ b/cypress/pageobject/Patient/PatientConsultation.ts @@ -113,6 +113,14 @@ export class PatientConsultationPage { cy.wait(3000); } + interceptPatientDetailsAPI(): void { + cy.intercept("GET", "**/api/v1/patient/**").as("patientDetails"); + } + + verifyPatientDetailsResponse(): void { + cy.wait("@patientDetails").its("response.statusCode").should("eq", 200); + } + clickViewConsultationButton() { cy.verifyAndClickElement( "#view_consultation_and_log_updates", diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts index 8f46dec5560..a38b8ab6a5c 100644 --- a/cypress/pageobject/Patient/PatientCreation.ts +++ b/cypress/pageobject/Patient/PatientCreation.ts @@ -23,7 +23,7 @@ export class PatientPage { selectFacility(facilityName: string) { cy.typeAndSelectOption("input[name='facilities']", facilityName); - cy.submitButton("Select"); + cy.clickSubmitButton("Select"); } interceptCreatePatientAPI() { @@ -57,7 +57,7 @@ export class PatientPage { typePatientAge(age: string) { cy.clickAndSelectOption("#patientAge", "Age"); - cy.submitButton("Confirm"); + cy.clickSubmitButton("Confirm"); cy.get("#age").clear().type(age); } diff --git a/cypress/pageobject/Patient/PatientFileupload.ts b/cypress/pageobject/Patient/PatientFileupload.ts index 0616a19729c..6cde7d78568 100644 --- a/cypress/pageobject/Patient/PatientFileupload.ts +++ b/cypress/pageobject/Patient/PatientFileupload.ts @@ -58,7 +58,7 @@ export class PatientFileUpload { clickSaveArchiveFile() { cy.intercept("PATCH", "**/api/v1/files/**").as("saveArchiveFile"); - cy.submitButton("Proceed"); + cy.clickSubmitButton("Proceed"); cy.wait("@saveArchiveFile").its("response.statusCode").should("eq", 200); } @@ -89,7 +89,7 @@ export class PatientFileUpload { clickSaveFileName() { cy.intercept("PATCH", "**/api/v1/files/**").as("saveFileName"); - cy.submitButton("Proceed"); + cy.clickSubmitButton("Proceed"); cy.wait("@saveFileName").its("response.statusCode").should("eq", 200); } } diff --git a/cypress/pageobject/Sample/SampleTestCreate.ts b/cypress/pageobject/Sample/SampleTestCreate.ts new file mode 100644 index 00000000000..cd2e93e5072 --- /dev/null +++ b/cypress/pageobject/Sample/SampleTestCreate.ts @@ -0,0 +1,114 @@ +export class SampleTestPage { + visitSampleRequestPage(): void { + cy.verifyAndClickElement("#sample-request-btn", "Request Sample Test"); + cy.url().should("include", "/sample-test"); + } + + selectSampleType(option: string): void { + cy.clickAndSelectOption("#sample-type", option); + } + + selectIcmrCategory(option: string): void { + cy.clickAndSelectOption("#icmr-category", option); + } + + fillIcmrLabel(label: string): void { + cy.get("#icmr-label").should("be.visible").type(label); + } + + fillFastTrackReason(value: string): void { + cy.get("#is_fast_track").should("be.visible").check(); + cy.get("#fast_track").should("be.visible").type(value); + } + + fillDoctorName(value: string): void { + cy.get("#doctor_name").should("be.visible").type(value); + } + + fillAtypicalPresentation(value: string): void { + cy.get("#is_atypical_presentation").should("be.visible").check(); + cy.get("#atypical_presentation").should("be.visible").type(value); + } + + fillDiagnosis(value: string): void { + cy.get("#diagnosis").should("be.visible").type(value); + } + + fillEtiology(value: string): void { + cy.get("#etiology_identified").should("be.visible").type(value); + } + + fillDiffDiagnosis(value: string): void { + cy.get("#diff_diagnosis").should("be.visible").type(value); + } + + checkHasSari(): void { + cy.get("#has_sari").should("be.visible").check(); + } + + checkHasAri(): void { + cy.get("#has_ari").should("be.visible").check(); + } + + checkIsUnusualCourse(): void { + cy.get("#is_unusual_course").should("be.visible").check(); + } + + checkRequestHistory( + sampleTestStatus: string, + sampleTestType: string, + fastTrack: string, + sampleTestResult: string, + ): void { + cy.verifyContentPresence("#sample-test-status", [sampleTestStatus]); + cy.verifyContentPresence("#sample-test-type", [sampleTestType]); + cy.verifyContentPresence("#sample-test-fast-track", [fastTrack]); + cy.verifyContentPresence("#sample-test-result", [sampleTestResult]); + } + + searchPatientSample(patientName: string): void { + cy.get("#search_patient_name").should("be.visible").type(patientName); + } + + verifyPatientName(patientName: string): void { + cy.verifyContentPresence("#sample-test-patient-name", [patientName]); + } + + clickOnSampleDetailsBtn(): void { + cy.get("#sample-details-btn").should("be.visible").first().click(); + } + + verifyPatientTestDetails( + patientName: string, + fastTrackReason: string, + doctorName: string, + diagnosis: string, + differentialDiagnosis: string, + etiologyIdentified: string, + ): void { + cy.verifyContentPresence("#patient_name", [patientName]); + cy.verifyContentPresence("#fast_track_reason", [fastTrackReason]); + cy.verifyContentPresence("#doctor_name", [doctorName]); + cy.verifyContentPresence("#diagnosis", [diagnosis]); + cy.verifyContentPresence("#diff_diagnosis", [differentialDiagnosis]); + cy.verifyContentPresence("#etiology_identified", [etiologyIdentified]); + } + + interceptSampleTestReq(): void { + cy.intercept("POST", "**/api/v1/patient/*/test_sample/").as( + "sampleDetails", + ); + } + + verifySampleTestReq(): void { + cy.wait("@sampleDetails").its("response.statusCode").should("eq", 201); + } + + interceptGetSampleTestReq(): void { + cy.intercept("GET", "**/api/v1/test_sample/**").as("getSampleTestReq"); + } + + verifyGetSampleTestReq(): void { + cy.wait("@getSampleTestReq").its("response.statusCode").should("eq", 200); + } +} diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 9af5f97e5d4..d97bb52732f 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -121,11 +121,16 @@ Cypress.Commands.add("clearAllFilters", () => { return cy.get("#clear-all-filters").click(); }); -Cypress.Commands.add("submitButton", (buttonText = "Submit") => { +Cypress.Commands.add("clickSubmitButton", (buttonText = "Submit") => { cy.get("button[type='submit']").contains(buttonText).scrollIntoView(); cy.get("button[type='submit']").contains(buttonText).click(); }); +Cypress.Commands.add("clickCancelButton", (buttonText = "Cancel") => { + cy.get("#cancel").contains(buttonText).scrollIntoView(); + cy.get("#cancel").contains(buttonText).click(); +}); + Cypress.Commands.add( "typeAndSelectOption", (element: string, referance: string) => { diff --git a/cypress/support/index.ts b/cypress/support/index.ts index b2895871872..6429ef5710f 100644 --- a/cypress/support/index.ts +++ b/cypress/support/index.ts @@ -14,7 +14,8 @@ declare global { ): Chainable<Subject>; getAttached(selector: string): Chainable<Subject>; clearAllFilters(): Chainable<Subject>; - submitButton(buttonText?: string): Chainable<Element>; + clickSubmitButton(buttonText?: string): Chainable<Element>; + clickCancelButton(buttonText?: string): Chainable<Element>; typeAndSelectOption( element: string, referance: string, diff --git a/src/CAREUI/interactive/LegendInput.tsx b/src/CAREUI/interactive/LegendInput.tsx index cb415d76ab1..064eb2ceb0f 100644 --- a/src/CAREUI/interactive/LegendInput.tsx +++ b/src/CAREUI/interactive/LegendInput.tsx @@ -130,7 +130,7 @@ export default function LegendInput(props: InputProps) { required={props.required} autoComplete={props.autoComplete} className={classNames( - "cui-input w-full rounded-md border-secondary-300 bg-secondary-50 shadow-sm focus:border-2 focus:border-primary-500 focus:bg-secondary-100 focus:outline-none focus:ring-0", + "cui-input w-full rounded-md border-2 border-secondary-300 border-transparent bg-secondary-50 shadow-sm focus:border-2 focus:border-primary-500 focus:bg-secondary-100 focus:outline-none focus:ring-0", props.size === "small" && "px-3 py-2 text-xs", (!props.size || !["small", "large"].includes(props.size)) && "px-4 py-3", diff --git a/src/components/Auth/Login.tsx b/src/components/Auth/Login.tsx index aab5f8df179..4255161194a 100644 --- a/src/components/Auth/Login.tsx +++ b/src/components/Auth/Login.tsx @@ -350,7 +350,7 @@ const Login = (props: { forgot?: boolean }) => { <button id="login-button" type="submit" - className="inline-flex w-full cursor-pointer items-center justify-center rounded bg-primary-500 px-4 py-2 text-sm font-semibold text-white" + className="inline-flex w-full cursor-pointer items-center justify-center rounded bg-primary-500 px-4 py-2 text-sm font-semibold text-white hover:bg-primary-600" > {t("login")} </button> diff --git a/src/components/Facility/BedCapacity.tsx b/src/components/Facility/BedCapacity.tsx index 0bb405670fd..156dc6adce6 100644 --- a/src/components/Facility/BedCapacity.tsx +++ b/src/components/Facility/BedCapacity.tsx @@ -77,6 +77,8 @@ export const BedCapacity = (props: BedCapacityProps) => { const existingData = capacityQuery.data?.results; // if all options are diabled if (existingData.length === BED_TYPES.length) { + setBedTypes([]); + setIsLoading(false); return; } // disable existing bed types @@ -277,18 +279,20 @@ export const BedCapacity = (props: BedCapacityProps) => { <div className="cui-form-button-group mt-4"> <Cancel onClick={handleClose} /> - {!isLastOptionType && headerText === "Add Bed Capacity" && ( + {headerText === "Add Bed Capacity" && ( <Submit id="bed-capacity-save-and-exit" onClick={(e) => handleSubmit(e, "Save and Exit")} label="Save Bed Capacity" /> )} - <Submit - id="bed-capacity-save" - onClick={(e) => handleSubmit(e)} - label={buttonText} - /> + {!isLastOptionType && ( + <Submit + id="bed-capacity-save" + onClick={(e) => handleSubmit(e)} + label={buttonText} + /> + )} </div> </div> )} diff --git a/src/components/Patient/PatientHome.tsx b/src/components/Patient/PatientHome.tsx index 9d3ab238e5b..a7b08bdea58 100644 --- a/src/components/Patient/PatientHome.tsx +++ b/src/components/Patient/PatientHome.tsx @@ -1295,6 +1295,7 @@ export const PatientHome = (props: any) => { ) } authorizeFor={NonReadOnlyUsers} + id="sample-request-btn" > <span className="flex w-full items-center justify-start gap-2"> <CareIcon icon="l-medkit" className="text-xl" /> diff --git a/src/components/Patient/SampleDetails.tsx b/src/components/Patient/SampleDetails.tsx index c16ef1c0e86..c5282a65c1f 100644 --- a/src/components/Patient/SampleDetails.tsx +++ b/src/components/Patient/SampleDetails.tsx @@ -331,7 +331,7 @@ export const SampleDetails = ({ id }: DetailRoute) => { <span className="font-semibold leading-relaxed"> {t("patient")}:{" "} </span> - {sampleDetails?.patient_name} + <span id="patient_name">{sampleDetails?.patient_name}</span> </div> {sampleDetails?.facility_object && ( <div> @@ -362,7 +362,7 @@ export const SampleDetails = ({ id }: DetailRoute) => { <span className="font-semibold leading-relaxed"> {t("fast_track_testing_reason")}:{" "} </span> - {sampleDetails.fast_track} + <span id="fast_track_reason">{sampleDetails.fast_track}</span> </div> )} {sampleDetails?.doctor_name && ( @@ -370,7 +370,9 @@ export const SampleDetails = ({ id }: DetailRoute) => { <span className="font-semibold leading-relaxed"> {t("doctors_name")}:{" "} </span> - {startCase(camelCase(sampleDetails.doctor_name))} + <span id="doctor_name"> + {startCase(camelCase(sampleDetails.doctor_name))} + </span> </div> )} {sampleDetails?.diagnosis && ( @@ -378,7 +380,7 @@ export const SampleDetails = ({ id }: DetailRoute) => { <span className="font-semibold leading-relaxed"> {t("diagnosis")}:{" "} </span> - {sampleDetails.diagnosis} + <span id="diagnosis">{sampleDetails.diagnosis}</span> </div> )} {sampleDetails?.diff_diagnosis && ( @@ -386,7 +388,7 @@ export const SampleDetails = ({ id }: DetailRoute) => { <span className="font-semibold leading-relaxed"> {t("differential_diagnosis")}:{" "} </span> - {sampleDetails?.diff_diagnosis} + <span id="diff_diagnosis">{sampleDetails?.diff_diagnosis}</span> </div> )} {sampleDetails?.etiology_identified && ( @@ -394,7 +396,9 @@ export const SampleDetails = ({ id }: DetailRoute) => { <span className="font-semibold leading-relaxed"> {t("etiology_identified")}:{" "} </span> - {sampleDetails.etiology_identified} + <span id="etiology_identified"> + {sampleDetails.etiology_identified} + </span> </div> )} <div> diff --git a/src/components/Patient/SampleTest.tsx b/src/components/Patient/SampleTest.tsx index 0714de28492..0933d03761e 100644 --- a/src/components/Patient/SampleTest.tsx +++ b/src/components/Patient/SampleTest.tsx @@ -216,6 +216,7 @@ export const SampleTest = ({ facilityId, patientId }: any) => { options={SAMPLE_TYPE_CHOICES} optionLabel={(option) => option.text} optionValue={(option) => option.id} + id="sample-type" /> {state.form.sample_type === "9" && ( @@ -230,6 +231,7 @@ export const SampleTest = ({ facilityId, patientId }: any) => { options={ICMR_CATEGORY} optionLabel={(option) => option} optionValue={(option) => option} + id="icmr-category" /> <div className="mb-6 flex flex-col gap-1"> <p className="font-medium"> @@ -255,7 +257,11 @@ export const SampleTest = ({ facilityId, patientId }: any) => { </span> </div> - <TextFormField {...field("icmr_label", "ICMR Label")} required /> + <TextFormField + {...field("icmr_label", "ICMR Label")} + required + id="icmr-label" + /> <div className="mb-6 w-full flex-none"> <FieldLabel>Testing Facility</FieldLabel> <FacilitySelect @@ -274,22 +280,29 @@ export const SampleTest = ({ facilityId, patientId }: any) => { /> </div> <CheckBoxFormField + id="is_fast_track" {...field("isFastTrack", "Is fast-track testing required?")} /> {state.form.isFastTrack && ( <TextAreaFormField + id="fast_track" {...field("fast_track", "Reasons for fast-track testing")} required /> )} - <TextFormField {...field("doctor_name", "Doctor's Name")} /> + <TextFormField + id="doctor_name" + {...field("doctor_name", "Doctor's Name")} + /> <CheckBoxFormField + id="is_atypical_presentation" {...field("is_atypical_presentation", "Is atypical presentation?")} /> {state.form.is_atypical_presentation && ( <div> <TextAreaFormField + id="atypical_presentation" {...field( "atypical_presentation", "Atypical presentation details", @@ -298,26 +311,38 @@ export const SampleTest = ({ facilityId, patientId }: any) => { /> </div> )} - <TextAreaFormField {...field("diagnosis", "Diagnosis")} /> <TextAreaFormField + id="diagnosis" + {...field("diagnosis", "Diagnosis")} + /> + <TextAreaFormField + id="etiology_identified" {...field("etiology_identified", "Etiology identified")} /> <TextAreaFormField + id="diff_diagnosis" {...field("diff_diagnosis", "Differential diagnosis")} /> <CheckBoxFormField + id="has_sari" {...field("has_sari", "Has SARI (Severe Acute Respiratory illness)?")} /> <CheckBoxFormField + id="has_ari" {...field("has_ari", "Has ARI (Acute Respiratory illness)?")} /> <CheckBoxFormField + id="is_unusual_course" {...field("is_unusual_course", "Is unusual course?")} /> <div className="mt-4 flex flex-col justify-end gap-2 lg:flex-row"> <Cancel onClick={() => goBack()} /> - <Submit onClick={handleSubmit} label={buttonText} /> + <Submit + onClick={handleSubmit} + label={buttonText} + id="sample-test-submit-btn" + /> </div> </form> </Page> diff --git a/src/components/Patient/SampleTestCard.tsx b/src/components/Patient/SampleTestCard.tsx index fef2c9e4d08..a0303705eb7 100644 --- a/src/components/Patient/SampleTestCard.tsx +++ b/src/components/Patient/SampleTestCard.tsx @@ -79,6 +79,7 @@ export const SampleTestCard = (props: SampleDetailsProps) => { return ( <div + id="sample-test-history" className={`${ itemData.result === "POSITIVE" ? "border-red-500 bg-red-100 hover:border-red-700" @@ -100,7 +101,10 @@ export const SampleTestCard = (props: SampleDetailsProps) => { <div className="text-sm font-semibold leading-5 text-zinc-400"> Status{" "} </div> - <div className="mt-1 overflow-x-scroll whitespace-normal break-words text-sm font-medium leading-5"> + <div + id="sample-test-status" + className="mt-1 overflow-x-scroll whitespace-normal break-words text-sm font-medium leading-5" + > {startCase(camelCase(itemData.status))} </div> </div> @@ -110,7 +114,10 @@ export const SampleTestCard = (props: SampleDetailsProps) => { <div className="text-sm font-semibold leading-5 text-zinc-400"> Sample Type{" "} </div> - <div className="mt-1 overflow-x-scroll whitespace-normal break-words text-sm font-medium capitalize leading-5"> + <div + id="sample-test-type" + className="mt-1 overflow-x-scroll whitespace-normal break-words text-sm font-medium capitalize leading-5" + > {itemData.sample_type?.toLowerCase()} </div> </div> @@ -121,7 +128,10 @@ export const SampleTestCard = (props: SampleDetailsProps) => { <div className="text-sm font-semibold leading-5 text-zinc-400"> Fast-Track{" "} </div> - <div className="mt-1 overflow-x-scroll whitespace-normal break-words text-sm font-medium leading-5"> + <div + id="sample-test-fast-track" + className="mt-1 overflow-x-scroll whitespace-normal break-words text-sm font-medium leading-5" + > {itemData.fast_track} </div> </div> @@ -132,7 +142,10 @@ export const SampleTestCard = (props: SampleDetailsProps) => { <div className="text-sm font-semibold leading-5 text-zinc-400"> Result{" "} </div> - <div className="mt-1 overflow-x-scroll whitespace-normal break-words text-sm font-medium leading-5"> + <div + id="sample-test-result" + className="mt-1 overflow-x-scroll whitespace-normal break-words text-sm font-medium leading-5" + > {startCase(camelCase(itemData.result))} </div> </div> diff --git a/src/components/Patient/SampleViewAdmin.tsx b/src/components/Patient/SampleViewAdmin.tsx index 43d03ad1d12..37d66bfb815 100644 --- a/src/components/Patient/SampleViewAdmin.tsx +++ b/src/components/Patient/SampleViewAdmin.tsx @@ -155,7 +155,10 @@ export default function SampleViewAdmin() { <div className="flex h-full flex-col justify-between px-6 py-4"> <div> <div className="flex flex-col md:flex-row md:justify-between"> - <div className="mb-2 text-xl font-bold capitalize"> + <div + id="sample-test-patient-name" + className="mb-2 text-xl font-bold capitalize" + > {item.patient_name} </div> <div> @@ -274,6 +277,7 @@ export default function SampleViewAdmin() { )} <button + id="sample-details-btn" onClick={() => navigate(`/sample/${item.id}`)} className="mt-2 w-full rounded border border-secondary-400 bg-white px-4 py-2 text-center text-sm font-semibold text-secondary-800 shadow hover:bg-secondary-400" > @@ -350,6 +354,7 @@ export default function SampleViewAdmin() { <div className="flex w-full flex-col gap-3"> <SearchInput name="patient_name" + id="search_patient_name" value={qParams.patient_name} onChange={(e) => updateQuery({ [e.name]: e.value })} placeholder="Search patient"