Index: suite_leahi/tst_main_treatment/test.py =================================================================== diff -u -r56599f7ae0abe203a89be48e5694396d274969c8 -r7ef176d3f63909e4f1c7df096f0b2d6499d164ef --- suite_leahi/tst_main_treatment/test.py (.../test.py) (revision 56599f7ae0abe203a89be48e5694396d274969c8) +++ suite_leahi/tst_main_treatment/test.py (.../test.py) (revision 7ef176d3f63909e4f1c7df096f0b2d6499d164ef) @@ -62,8 +62,9 @@ td = TD_Messaging() dd = DD_Messaging() -can_interface = td.can_interface -pauseresumerequest = "-1" +can_interface = td.can_interface +pause = None +vitals = None def verify_arterial_and_venous_value_in_main_treatment_screen(accepted, art_low, art_high, ven_low, ven_high,tmp_low,tmp_high): """ @@ -308,33 +309,39 @@ test.compare(round(float(dialCond_properties["value"]),1), round(float(target_dial_cond/1000),1), "Dialyste conductivity value should be :" + str(target_dial_cond)) test.endSection() -def handle_pause_resume_request( message, timestamp = 0.0): +def handle_pause_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 pauseresumerequest - pauseresumerequest = state + + state,index = conversions.bytearray_to_integer(message, index) + global pause + pause = str(state) + +def handle_vitals_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 vitals + vitals = str(state) + def main(): utils.tstStart(__file__) startApplication(utility.aut("-q")) - global pauseresumerequest - if can_interface is not None: - channel_id = CAN.CanChannels.ui_to_td_ch_id - message_id = MsgIds.MSG_ID_UI_UF_PAUSE_RESUME_REQUEST.value - can_interface.register_receiving_publication_function(channel_id, - message_id, - handle_pause_resume_request) td.td_operation_mode(TDOpModes.MODE_STAN.value,0) # verify Standby screen test.verify(waitForObjectExists(names.o_standByScreen_MainHome), "In Standby") - td.td_operation_mode( TDOpModes.MODE_PRET.value, 0 ) td.td_tx_state(TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value , 0 , @@ -378,42 +385,49 @@ start_test_treatment_ultrafiltration(**value) test.endSection() + # handle sent messages from UI + if can_interface is not None: + channel_id = CAN.CanChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_UI_UF_PAUSE_RESUME_REQUEST.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_pause_request) + #Test New UF pause/Resume button pauseResume = waitForObject(names.o_treatmentHome_iconImage_Image_main,1000) - mouseClick(pauseResume) - # global pauseresumerequest - test.verify(waitFor(" 'pauseresumerequest == 0'", 3000), "Testing FW received Pause Request from the UI") + mouseClick(waitForObject(pauseResume)) + test.verify(waitFor( lambda: pause == 0, 5000), "Testing FW received from the UI") td.td_ultrafiltration( set_volume = 1.2 , target_rate = 0.5 , volume_delivered = 0.2 , state = 1 ) mouseClick(pauseResume) - test.verify(waitFor(" 'pauseresumerequest == 1'", 3000), "Testing FW received Resume Request from the UI ") + test.verify(waitFor(lambda: pause == 1, 3000), "Testing FW received Resume Request from the UI ") td.td_ultrafiltration( set_volume = 1.2 , target_rate = 0.5 , volume_delivered = 0.2 , state = 0 ) + - - #check the vitals mouseClick(waitForObject(names.o_treatmentHome_vitals_IconButton)) + if can_interface is not None: channel_id = CAN.CanChannels.ui_to_td_ch_id message_id = MsgIds.MSG_ID_UI_BLOOD_PRESSURE_REQUEST.value can_interface.register_receiving_publication_function(channel_id, message_id, - handle_pause_resume_request) + handle_vitals_request) - test.verify(waitFor(" 'pauseresumerequest == 1'", 3000), "Testing FW received Request from the UI ") + test.verify(waitFor( lambda: vitals == "Requested", 5000), "Testing FW received from the UI") #TX Time #Calculating total seconds into minutes and passing to treatment time verification test.startSection("Verifying TX time on main treatment screen") for value in total_time_list: treatment_time_verification(value) #Check the treatment complete text message - test.compare(waitForObjectExists(names.o_treatmentHome_notification_NotificationBarSmall,2000).text, "Treatment Complete", "Tx time completed text should be :" + str("Treatment Complete")) + test.compare(waitForObjectExists(names.o_treatmentHome_notification_NotificationBarSmall,2000).text, "HD Mode", "Tx time completed text should be :" + str("HD Mode")) td.td_treatment_time( tx_duration_s = 51 , tx_elapsed_s = 5 , tx_remaining_s = 6 )