Index: suite_leahi/tst_main_treatment/test.py =================================================================== diff -u -rb6aa1adafbc0b279e012c904ecde7774fb0000ea -r9e9fb3fcb3825db1635bd4be27e49c5e0d354b8a --- suite_leahi/tst_main_treatment/test.py (.../test.py) (revision b6aa1adafbc0b279e012c904ecde7774fb0000ea) +++ suite_leahi/tst_main_treatment/test.py (.../test.py) (revision 9e9fb3fcb3825db1635bd4be27e49c5e0d354b8a) @@ -20,11 +20,15 @@ # -Set lower and upper bound for dialysate cond and test each limit import names -from leahi_dialin.ui import utils +from leahi_dialin.ui import utils from leahi_dialin.ui.td_messaging import TD_Messaging from leahi_dialin.ui.dd_messaging import DD_Messaging -from configuration import utility, config -from leahi_dialin.common.td_defs import TDOpModes,TDTreatmentStates +from configuration import utility, config +from leahi_dialin.common.td_defs import TDOpModes,TDTreatmentStates +from leahi_dialin.common.ui_defs import TXStates +from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions +from leahi_dialin.utils import conversions +from leahi_dialin.protocols import CAN ART_LOW_VAL_MINUS_390 = -390 ART_HIGH_VAL_220 = 220 @@ -46,7 +50,22 @@ td = TD_Messaging() dd = DD_Messaging() +can_interface = td.can_interface +newTreatmentDuration = None + +def handle_new_treatment_duration_request(message, timestamp=0.0): + """ + Called when the user requests to firmware from UI + @return: None + """ + message = message["message"] + index = MsgFieldPositions.START_POS_FIELD_1 + + state, index = conversions.bytearray_to_integer(message, index) + global newTreatmentDuration + newTreatmentDuration = state + def verify_arterial_and_venous_value_in_main_treatment_screen(accepted, art_low, art_high, ven_low, ven_high,tmp_low,tmp_high): """ Method to verify Arterial low and high @@ -286,6 +305,55 @@ dialCond = utility.get_object_from_names(names.o_dial_cond_value) dialCond_properties = object.properties(dialCond) test.compare(str(dialCond_properties["value"]), str(target_dial_cond), "Dialyste conductivity value should be :" + str(target_dial_cond)) + test.endSection() + +def edit_treatment_duration(): + """ + Verifying New Treatment Duration in Main Treatment Screen + """ + td.td_treatment_time(tx_duration_s=51, tx_elapsed_s=5, tx_remaining_s=6) + td.td_ultrafiltration(10, 0.53, 0.37, 0) + + td.td_param_ranges( + min_tx_time_s=50, + max_tx_time_s=300, + min_uf_volume_mL=0.0, + max_uf_volume_mL=1790, + min_dial_rate_mLH=0, + max_dial_rate_mLH=0, + ) + + treatmentEdit = waitForObject(names.o_treatment_duration) + treatmentEditbutton = utility.findObjectById(treatmentEdit, "_editTimeIcon") + mouseClick(treatmentEditbutton) + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_UI_DURATION_VALIDATE_REQUEST.value + can_interface.register_receiving_publication_function( + channel_id, message_id, handle_new_treatment_duration_request + ) + utility.set_value_based_on_target(names.o_newTreatmentDuration_ValueAdjuster, 60) + mouseClick(waitForObject(names.o_continueButton_TouchRect, 3000)) + test.verify( + waitFor(lambda: newTreatmentDuration == 60, 5000), + "Verifying FW received New Treatment Duration", + ) + td.td_duration_validate_response(0, 60, 0, 0) + + parent_object = waitForObject(names.o_newTreatmentDuration, 3000) + newTreatmentDuration_value_object = utility.findObjectById(parent_object, "_value") + test.log(f"New Treatment Duration value: {str(newTreatmentDuration_value_object.text)}") + + parent_object = waitForObject(names.o_ufVolumeGoal, 3000) + ufVolumeGoal_value_object = utility.findObjectById(parent_object, "_value") + test.log(f"UF Volume Goal value: {str(ufVolumeGoal_value_object.text)}") + + parent_object = waitForObject(names.o_ufRate, 3000) + ufRate_value_object = utility.findObjectById(parent_object, "_value") + test.log(f"New UF Rate value: {str(ufRate_value_object.text)}") + + mouseClick(waitForObject(names.o_confirmButton_TouchRect, 3000)) + mouseClick(waitForObject(names.o_Popup_CloseButton, 3000)) def main(): @@ -364,6 +432,10 @@ #TX Parameter Set Points test.startSection("Verifying blood flow, dialysate temp,dialysate flow and dialyste cond on main treatment screen") verify_setPoints_from_main_treatement() + test.endSection() - utils.tstDone() + test.startSection("Verifying New Treatment Duration in Main Treatment Screen") + edit_treatment_duration() test.endSection() + + utils.tstDone()