Index: suite_leahi/shared/scripts/configuration/config.py =================================================================== diff -u -rf89e67f8f2dd341d78381fb45b42ee2d53f242e0 -r9e9fb3fcb3825db1635bd4be27e49c5e0d354b8a --- suite_leahi/shared/scripts/configuration/config.py (.../config.py) (revision f89e67f8f2dd341d78381fb45b42ee2d53f242e0) +++ suite_leahi/shared/scripts/configuration/config.py (.../config.py) (revision 9e9fb3fcb3825db1635bd4be27e49c5e0d354b8a) @@ -5,6 +5,10 @@ AUT_NAME = "leahi -k -K -S -q" AUT_NAME_ONLY = "leahi" # Need only the AUT name for tst_ui_logs, do not add options +#Solution Infusion +TOTAL_FLUID_DELIVERED = "Total Fluid Delivered" +DELIVERING_FLUID = "Delivering Fluid" + # Configuration application_init.py TMP_DIR = "/tmp/" APP_POST_LOG_LOCATION = "".join([str(TMP_DIR),'/post.log']) Index: suite_leahi/shared/scripts/names.py =================================================================== diff -u -rf89e67f8f2dd341d78381fb45b42ee2d53f242e0 -r9e9fb3fcb3825db1635bd4be27e49c5e0d354b8a --- suite_leahi/shared/scripts/names.py (.../names.py) (revision f89e67f8f2dd341d78381fb45b42ee2d53f242e0) +++ suite_leahi/shared/scripts/names.py (.../names.py) (revision 9e9fb3fcb3825db1635bd4be27e49c5e0d354b8a) @@ -37,7 +37,10 @@ o_dialyste_tmp_title_Text = {"container": mainTreatmentScreen, "id": "_dialysateTemp", "objectName": "dialysateTempComponent", "type": "TreatmentFlowsComponent" } o_dialyste_cond_title_Text = {"container": mainTreatmentScreen, "id": "_dialysateCond", "objectName": "dialysateCondComponent", "type": "TreatmentFlowsComponent" } o_treatmentTimeNotificationBarSmall = {"container": mainTreatmentScreen, "objectName": "notification", "type": "NotificationBarSmall" } - +o_newTreatmentDuration_ValueAdjuster = {"container": o_Overlay, "objectName": "_valueAdjuster", "type": "ValueAdjuster", } +o_newTreatmentDuration = {"container": o_Overlay, "objectName": "_newTreatmentDuration", "type": "LabelUnitText", } +o_Popup_CloseButton = {"container": o_Overlay, "id": "_closeButton", "type": "CloseButton", "unnamed": 1 } + # settings_service_export_logs o_listView_ListView = {"container": o_Gui_MainView, "id": "_listView", "type": "ListView", "unnamed": 1 } o_listView_delegateControl = {"container": o_listView_ListView, "index": 2, "objectName": "delegateControl", "type": "Item" } 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() Index: suite_leahi/tst_solution_infusion/test.py =================================================================== diff -u -r88cc7fe95f2dccaf433dae76aa929a4568795102 -r9e9fb3fcb3825db1635bd4be27e49c5e0d354b8a --- suite_leahi/tst_solution_infusion/test.py (.../test.py) (revision 88cc7fe95f2dccaf433dae76aa929a4568795102) +++ suite_leahi/tst_solution_infusion/test.py (.../test.py) (revision 9e9fb3fcb3825db1635bd4be27e49c5e0d354b8a) @@ -3,7 +3,7 @@ # Python import os import can - +from configuration import config # plugin specific from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions from leahi_dialin.protocols import CAN @@ -17,7 +17,7 @@ import names -salineBolusStartState = "-1" +salineBolusStartState = None def main(): td_interface = TD_Messaging() @@ -32,7 +32,7 @@ message_id, handle_solution_infusion_request) - + startApplication("leahi") test.log("Starting leahi") @@ -59,11 +59,11 @@ # verify saline text salineTextObj = waitForObject(names.salineDeliveredText) - test.compare(salineTextObj.text, "Total Saline Delivered", "Testing 'Total Saline Delivered' text") + test.compare(salineTextObj.text, config.TOTAL_FLUID_DELIVERED, "Testing 'Total Saline Delivered' text") # verify send start bolus req message mouseClick(waitForObject(names.startFluidButton)) - test.verify(waitFor("'salineBolusStartState == 1'", 5000), "Testing UI -> TD message start bolus") + test.verify(waitFor(lambda: salineBolusStartState == 1, 5000), "Testing UI -> TD message start bolus") # change state to in progress td_interface.td_tx_state( @@ -84,7 +84,7 @@ test.compare(treatmentSaline.isStarted, True, "Testing vTDTreatmentStates.sbRunning") # verify text - test.compare(salineTextObj.text, "Delivering Saline", "Testing Saline Description text") + test.compare(salineTextObj.text, config.DELIVERING_FLUID, "Testing Saline Description text") # verify saline data bolusValueInTest = 75 @@ -105,7 +105,7 @@ # verify send stop bolus req message mouseClick(waitForObject(names.startFluidButton)) - test.verify(waitFor("'salineBolusStartState == 0'", 5000), "Testing UI -> TD message stop bolus") + test.verify(waitFor(lambda: salineBolusStartState == 0, 5000), "Testing UI -> TD message stop bolus") # change state to idle td_interface.td_tx_state( @@ -134,9 +134,5 @@ index = MsgFieldPositions.START_POS_FIELD_1 state,index = conversions.bytearray_to_integer( message, index) global salineBolusStartState - salineBolusStartState = str(state) - - - - - \ No newline at end of file + salineBolusStartState = state + \ No newline at end of file