Index: suite_leahi/tst_create_treatment/test.py =================================================================== diff -u -re262d0097836365a0adebc78a211d10b851bf23f -r2b2de3e46f857fbd47186f4b7f38f6955d2e61fc --- suite_leahi/tst_create_treatment/test.py (.../test.py) (revision e262d0097836365a0adebc78a211d10b851bf23f) +++ suite_leahi/tst_create_treatment/test.py (.../test.py) (revision 2b2de3e46f857fbd47186f4b7f38f6955d2e61fc) @@ -71,21 +71,40 @@ } -PATIENT_ID_COMBINATION = { - "qwerty" : "qwerty", - "sampleid" : "sampleid", - "abcdefghijklmnop" : "abcdefghijklmnop", - "patientid" : "patientid", - "username" : "username", - "sA@MpLE#123" : "sAMpLE123", - "A@BH&321" : "ABH321", - "5432@qwerty" : "5432qwerty", - "abcd-SAMPLe" : "abcd-SAMPLe" +CREATE_TREATMENT_PARAMETER_SLIDER = { + "Blood Flow Rate" : [500.0], + "Dialysate Flow Rate" : [600.0], + "Duration" : [480.0], + "Heparin Bolus Volume" : [2.0], + "Heparin Dispensing Rate" : [1.0], + "Heparin Stop Time" : [480.0], + "Saline Bolus Volume" : [300], + "Dialysate Temperature" : [38.0], + "BP Measurement Interval" : [60], + } + +CREATE_TREATMENT_SLIDER_VALUES = { + "Blood Flow Rate" : [60, 10, 500], + "Dialysate Flow Rate" : [50, 10, 600], + "duration" : [60, 15, 28], + "heparin_dispensing_rate" : [0.2, 0.1, 93], + "heparin_bolus_volume" : [0.2, 0.1, 41], + "heparin_stop_time" : [0, 10, 15.75], + "saline_bolus" : [100, 100, 425], + "dialysate_temperature" : [35, 0.5, 187.5], + "arterial_pressure_limit_high" : [20, 10, 11.931], + "blood_pressure_measurement_interval" : [5, 5, 60], +} + +PATIENT_ID_COMBINATION = { + "qwertyuio-2345678901" : "qwertyuio-2345678901", + } + COLOR_CODES = "#ffa500" -DIALYZER_TYPE = [ "Diacap Pro 13H","Diacap Pro 16H", "Diacap Pro 19H", "Optiflux F160NRe", "Optiflux F180NRe", "Optiflux F200NRe","Optiflux F250NRe"] +DIALYZER_TYPE = ["Diacap Pro 13H","Diacap Pro 16H", "Diacap Pro 19H", "Optiflux F160NRe", "Optiflux F180NRe", "Optiflux F200NRe","Optiflux F250NRe"] KEYBOARD_SWITCH = ["ABC", "&123"] ACID_CONCENTRATE = ["0.0 K, 0.00 Ca, 1 Mg", "3.0 K, 2.5 Ca, 1 Mg","2.0 K, 2.5 Ca, 1 Mg","1.0 K, 2.5 Ca, 1 Mg"] CREATE_TREATMENT_PARAMETERS = ["Blood Flow Rate", "Dialysate Flow Rate", @@ -258,7 +277,6 @@ """ test.startSection("Method to set create custom treatment slider based on positive slider buffer") - test.compare(waitForObject(names.o_PreTreatmentCreate_Prescription_Text).text, PRESCRIPTION_TITLE, "Title text should be -> "+str(PRESCRIPTION_TITLE)) # set custom values for parameters test.startSection("Verification of blood flow values") test.compare(waitForObject(names.o_PreTreatmentCreate_bloodFlowRate_LabelUnitContainer).text, BLOOD_FLOW_RATE, "Parameter should be -> "+str(BLOOD_FLOW_RATE)) @@ -281,7 +299,6 @@ test.startSection("Verification of heparin bolus volume values") test.compare(waitForObject(names.o_PreTreatmentCreate_heparinBolusVolume_LabelUnitContainer).text, HEPARIN_BOLUS_VOLUME, "Parameter should be -> "+str(HEPARIN_BOLUS_VOLUME)) mouseClick(waitForObject(names.o_PreTreatmentCreate_heparinBolusVolumeControl_ValueAdjuster)) - test.compare(OFF_TEXT, waitForObject(names.o_PreTreatmentCreate_OFF_Text).text, "OFF text should be enabled") for heparin_bolus_volume in CREATE_TREATMENT_PARAMETER_RANGE[HEPARIN_BOLUS_VOLUME]: set_value_based_on_target(names.o_PreTreatmentCreate_heparinBolusVolumeControl_ValueAdjuster, heparin_bolus_volume) test.endSection() @@ -296,6 +313,22 @@ test.endSection() test.startSection("Verification of heparin stop time values") + #1. Change Duration -> Verify Heparin Stop Time "active" property is set to off + set_value_based_on_target(names.o_PreTreatmentCreate_durationControl_ValueAdjuster, 60) + click_left_until_off(names.o_PreTreatmentCreate_heparinBolusVolumeControl_ValueAdjuster) + click_left_until_off(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster) + check_arrow_status(names.o_PreTreatmentCreate_heparinStopTimeControl_ValueAdjuster) + # 2. Change Heparin Dispensising Rate from 0.2 to OFF -> Verify Heparing Stop Time is set to OFF + click_left_until_off(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster) + test.compare(waitForObjectExists(names.o_PreTreatmentCreate_heparinStopTime_OFF_Text).text,"OFF") + # 3. Change Heparin Dispensising Rate from OFF to 0.2 -> Verify Heparin Stop Time "active" property is set to off + set_value_based_on_target(o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster, 0.2) + test.compare(waitForObjectExists(names.o_PreTreatmentCreate_heparinStopTime_OFF_Text).text,"-- --") + # # 4. When Duration is set to a value -> Verify the max Heparin Stop Time is the Duration value that is set + set_value_based_on_target(names.o_PreTreatmentCreate_durationControl_ValueAdjuster, 90) + set_value_based_on_target(names.o_PreTreatmentCreate_heparinStopTimeControl_ValueAdjuster, 90) + test.compare(waitForObjectExists(names.o_PreTreatmentCreate_heparinStopTimeControl_ValueAdjuster).value,90.0) + set_value_based_on_target(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster, "0.2") set_value_based_on_target(names.o_PreTreatmentCreate_durationControl_ValueAdjuster, "480") test.compare(waitForObject(names.o_PreTreatmentCreate_heparinStopTime_LabelUnitContainer).text, HEPARIN_STOP_TIME, "Parameter should be -> "+str(HEPARIN_STOP_TIME)) @@ -354,9 +387,10 @@ test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox).currentText, DIALYZER_TYPE[5], "Dialyzer type value should be :"+str(DIALYZER_TYPE[5])) select_different_dropdown(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox,DIALYZER_TYPE,6) test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox).currentText, DIALYZER_TYPE[6], "Dialyzer type value should be :"+str(DIALYZER_TYPE[6])) - + test.endSection() - + + td.td_Treatment_Parameters_Validation( vAccepted = 1, vBloodFlowRateRejectReason = 0, vDialysateFlowRateRejectReason = 0, @@ -380,15 +414,18 @@ ) utils.waitForGUI(3) test.verify(waitForObjectExists(names.o_PreTreatmentCreate_qrCode_Image), "QR Code is visible") - confirmButton = waitForObject(names.o_confirmButtom) + + confirmButton = waitForObject(names.o_PreTreatmentButtom) test.compare(confirmButton.enabled, True, "Confirm button is enabled") + mouseClick(waitForObject(confirmButton)) td.td_operation_mode(TDOpModes.MODE_PRET.value, 0) test.endSection() def verify_editRx_Button(): test.startSection("Verfiy the edit button functionality") td.td_operation_mode(TDOpModes.MODE_STAN.value) td.td_operation_mode(TDOpModes.MODE_TPAR.value, 0 ) + td.td_Treatment_Parameters_Validation( vAccepted = 1, vBloodFlowRateRejectReason = 0, vDialysateFlowRateRejectReason = 0, @@ -411,6 +448,7 @@ vHeparinBolusVolumeRejectReason = 0 ) utils.waitForGUI(3) + mouseClick(waitForObjectExists(names.o_PreTreatmentButtom)) select_different_dropdown(names.o_prescription_menuButton,BUTTON_TYPE,0) test.startSection("Verification of blood flow values") test.compare(waitForObject(names.o_PreTreatmentCreate_bloodFlowRate_LabelUnitContainer).text, BLOOD_FLOW_RATE, "Parameter should be -> "+str(BLOOD_FLOW_RATE)) @@ -433,7 +471,7 @@ test.startSection("Verification of heparin bolus volume values") test.compare(waitForObject(names.o_PreTreatmentCreate_heparinBolusVolume_LabelUnitContainer).text, HEPARIN_BOLUS_VOLUME, "Parameter should be -> "+str(HEPARIN_BOLUS_VOLUME)) mouseClick(waitForObject(names.o_PreTreatmentCreate_heparinBolusVolumeControl_ValueAdjuster)) - test.compare(OFF_TEXT, waitForObject(names.o_PreTreatmentCreate_OFF_Text).text, "OFF text should be enabled") + test.compare(OFF_TEXT, waitForObject(names.o_PreTreatmentCreate_heparinBolusVolume_Off_Text).text, "OFF text should be enabled") for heparin_bolus_volume in CREATE_TREATMENT_PARAMETER[HEPARIN_BOLUS_VOLUME]: set_value_based_on_target(names.o_PreTreatmentCreate_heparinBolusVolumeControl_ValueAdjuster, heparin_bolus_volume) test.endSection() @@ -480,6 +518,7 @@ test.startSection("Verfiy the clear all button functionality") td.td_operation_mode(TDOpModes.MODE_STAN.value) td.td_operation_mode(TDOpModes.MODE_TPAR.value, 0 ) + td.td_Treatment_Parameters_Validation( vAccepted = 1, vBloodFlowRateRejectReason = 0, vDialysateFlowRateRejectReason = 0, @@ -502,8 +541,9 @@ vHeparinBolusVolumeRejectReason = 0 ) utils.waitForGUI(3) + mouseClick(waitForObjectExists(names.o_PreTreatmentButtom)) select_different_dropdown(names.o_prescription_menuButton,BUTTON_TYPE,2) - button = waitForObjectExists(names.o_confirmButtom) + button = waitForObjectExists(names.o_PreTreatmentButtom) test.verify(not button.enabled, "Validate that the button is disabled") test.endSection() @@ -523,6 +563,15 @@ return None +def click_left_until_off(object_name): + parent_obj = waitForObject(object_name) + left_arrow = findObjectById(parent_obj, "_leftArrow") + + # Loop until the value becomes "off" + while findObject(object_name).value != 0.0: + mouseClick(waitForObject(left_arrow)) + snooze(0.2) # Small delay to allow UI to update + def set_value_based_on_target(obj, target_value): """ obj: dictionary containing object paths @@ -567,16 +616,23 @@ test.log(f"✅ Target value reached: {current_value}") - +def check_arrow_status(obj): + parent_obj = waitForObjectExists(obj) + left_arrow = findObjectById(parent_obj, "_leftArrow") + right_arrow =findObjectById(parent_obj, "_rightArrow") + test.verify(not left_arrow.enabled, "left arrow button is disabled") + test.verify(not right_arrow.enabled, "Right arrow button is disabled") + + def set_parameter_type(text,obj): """ Method to set object property based on text @param text : (string) treatment parameter text """ obj["text"] = text return obj - + def verify_custom_treatment_record_rejected(): """ Method to verify custom treatment record, if confirmation rejected @@ -614,7 +670,61 @@ test.compare(COLOR_CODES, parameter_text_color, "parameter color should be ' \red for' " + expected_treatment_title +" , if the confirmation get rejected !") test.endSection() - + +def set_value_with_slider(value_field_obj, slider_obj,parameter): + """ + Opens the slider and moves it gradually to the target value (step of 10). + Uses controlled arrow key input for fine adjustment. + """ + + try: + value_field = waitForObject(value_field_obj) + test.log(f"Opening slider for {parameter}...") + + # Try right-click first + mousePress(value_field, Qt.LeftButton) + snooze(0.7) + value = value_field.value + + # If not visible, try left long-press + if not object.exists(slider_obj): + test.log(f"{parameter}: Slider not opened by left-click, trying long left-press...") + mousePress(value_field, Qt.LeftButton) + snooze(1) + if not object.exists(slider_obj): + test.fail(f"{parameter}: Slider did not appear.") + + + slider = waitForObject(slider_obj) + test.log(f"{parameter}: Slider appeared successfully.") + mousePress(slider,Qt.LeftButton) + final_value = waitForObject(value_field_obj).value + test.verify(final_value!= value, f"{parameter} slider adjusted correctly to {final_value}") + mouseRelease(slider, Qt.LeftButton) + snooze(0.5) + if object.exists(slider_obj): + test.log(f"Waiting for {parameter} slider to close...") + waitFor(lambda: not object.exists(slider_obj), 10000) + snooze(0.5) + except LookupError as e: + test.fail(f"{parameter}: LookupError - {e}") + + +def verify_custom_treatment_slider(): + test.startSection("Verifying slider functionality of custom treatment") + td.td_operation_mode(TDOpModes.MODE_STAN.value) + td.td_operation_mode(TDOpModes.MODE_TPAR.value, 0 ) + set_value_with_slider(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster,names.o_PreTreatmentCreate_bloodFlowRate_slider_Slider,BLOOD_FLOW_RATE) + set_value_with_slider(names.o_PreTreatmentCreate_dialysateFlowRateControl_ValueAdjuster,names.o_PreTreatmentCreate_dialysateFlowRate_slider_Slider,DIALYSATE_FLOW_RATE) + set_value_with_slider(names.o_PreTreatmentCreate_durationControl_ValueAdjuster,names.o_PreTreatmentCreate_duration_slider_Slider,DURATION) + set_value_with_slider(names.o_PreTreatmentCreate_heparinBolusVolumeControl_ValueAdjuster,names.o_PreTreatmentCreate_heprainBolusVolume_slider_Slider,HEPARIN_BOLUS_VOLUME) + set_value_with_slider(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster,names.o_PreTreatmentCreate_heprainDispensingRate_slider_Slider,HEPARIN_DISPENSING_RATE) + set_value_with_slider(names.o_PreTreatmentCreate_heparinStopTimeControl_ValueAdjuster,names.o_PreTreatmentCreate_heprainStopTime_slider_Slider,HEPARIN_STOP_TIME) + set_value_with_slider(names.o_PreTreatmentCreate_dialysateTemperatureControl_ValueAdjuster,names.o_PreTreatmentCreate_dialysateTemperature_slider_Slider,DIALYSATE_TEMPERATURE) + set_value_with_slider(names.o_PreTreatmentCreate_salineBolusVolumeControl_ValueAdjuster,names.o_PreTreatmentCreate_salineBolusVolume_slider_Slider,SALINE_BOLUS_VOLUME) + set_value_with_slider(names.o_PreTreatmentCreate_bpMeasurementIntervalControl_ValueAdjuster,names.o_PreTreatmentCreate_bpMeasurementInterval_slider_Slider,BLOOD_PRESSURE_MEASUREMENT_INTERVAL) + test.endSection() + def main(): utils.tstStart(__file__) startApplication(names.AUT_NAME + " -q") @@ -624,17 +734,28 @@ # verify Standby screen test.verify(waitForObjectExists(names.o_standByScreen_MainHome), "In Standby") - td.td_operation_mode(TDOpModes.MODE_TPAR.value, 0 ) + td.td_operation_mode(TDOpModes.MODE_TPAR.value, 0) test.startSection("Verfiy the treatement parameter validation") test.compare(waitForObject(names.o_PreTreatmentCreate_Prescription_Text).text, PRESCRIPTION_TITLE, "Title text should be -> "+str(PRESCRIPTION_TITLE)) verify_page_step_indicator(screen_obj=names.o_PreTreatmentCreate_gridSteps_Grid, treatment_step=PRE_TREATMENT_STEP, treatment_screens=PRE_TREATMENT_SCREENS) test.log("Verify the Patient ID field") mouseClick(waitForObject(names.o_PatientIDEntry_TextEntry)) + + for expected_patient_id, actual_patient_id in PATIENT_ID_COMBINATION.items(): verify_valid_patient_id_through_keypad(expected_patient_id, actual_patient_id) + verify_create_custom_treatment_parameter() + test.endSection() + test.startSection("Verify the validate function with out entering Patient ID") verify_create_custom_treatment_parameter() + test.endSection() + + test.startSection("Verify the slider function without Patient ID") + verify_custom_treatment_slider() + test.endSection() + verify_editRx_Button() verfiy_clearall_Button()