Index: suite_leahi/tst_rinseback/test.py =================================================================== diff -u -r96c6a54fac7f3f0c740264eafe2d11f6db377508 -rc2bd9c5111de498925aff408a70f9701d92bc74d --- suite_leahi/tst_rinseback/test.py (.../test.py) (revision 96c6a54fac7f3f0c740264eafe2d11f6db377508) +++ suite_leahi/tst_rinseback/test.py (.../test.py) (revision c2bd9c5111de498925aff408a70f9701d92bc74d) @@ -15,7 +15,8 @@ td =TD_Messaging() can_interface = td.can_interface -salineBolusStartState = "-1" +rinsebackrequest = 0 +request ="[1] Request is not allowed in the current operating mode" def change_treatmentstates(state): test.startSection("Change the treatment parameter") @@ -31,21 +32,28 @@ 0) test.endSection() -def handle_solution_infusion_request( message, timestamp = 0.0): +def handle_rinseback_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 salineBolusStartState - salineBolusStartState = str(state) + global rinsebackrequest + rinsebackrequest = state + def main(): utils.tstStart(__file__) startApplication(config.AUT_NAME) - + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_UI_RINSEBACK_CMD_REQUEST.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_rinseback_request) test.startSection("Verify the rinseback page") td.td_operation_mode(TDOpModes.MODE_STAN.value) change_treatmentstates(TDTreatmentStates.TREATMENT_RINSEBACK_STATE.value) @@ -106,13 +114,63 @@ test.log(str(flow_rate_text)) mouseClick(waitForObject(names.o_EndTreatmentRinseback_pauseResumeButton_TouchRect)) # handle sent messages from UI - if can_interface is not None: - channel_id = CAN.DenaliChannels.ui_to_td_ch_id - message_id = MsgIds.MSG_ID_UI_RINSEBACK_CMD_REQUEST.value - can_interface.register_receiving_publication_function(channel_id, - message_id, - handle_solution_infusion_request) + # handle_solution_infusion_request(MsgIds.MSG_ID_UI_RINSEBACK_CMD_REQUEST.value) - test.verify(waitFor("'salineBolusStartState == 0'", 5000), "Testing UI -> TD message stop bolus") - test.log("names") + test.verify(waitFor( lambda: rinsebackrequest == 3, 10000), "Testing FW received Arterial Window Value") + #test rejection + td.td_rinseback_cmd_response(vRejectionReason = 1) + rejectionReason = waitForObject(utility.setObjectText(text=request ,obj =names.o_EndTreatmentRinseback_NotificationBar_NotificationBarSmall)) + test.compare(rejectionReason.text, "[1] Request is not allowed in the current operating mode", "Rejection Reason text should be :" + str(rejectionReason.text)) + td.td_rinseback_cmd_response(vRejectionReason = 0) + td.td_tx_state( TDTreatmentStates.TREATMENT_RINSEBACK_STATE.value, + 0 , + 0 , + 0 , + 0 , + TXStates.RINSEBACK_PAUSED_STATE , + 0 , + 0 , + 0 , + 0) + + + color = waitForObject(names.o_EndTreatmentRinseback_targetVolumeProgress_ProgressCircle).color.name + test.log(str(color)) + rinseback = waitForObject(utility.setObjectText(text="Rinseback Paused" ,obj =names.o_EndTreatmentRinseback)) + test.log(str(rinseback.text)) + td.td_rinseback_progress( vTargetVolume = 32, + vDeliveredVolume = 13, + vFlowRate = 150, + vTimeout = 43, + vCountdown = 84, + vIsCompleted = 0) + timeouttext = waitForObject(names.o_EndTreatmentRinseback_timeout_TimeText) + test.log(str(timeouttext.time)) + mouseClick(waitForObject(names.o_EndTreatmentRinseback_pauseResumeButton_TouchRect)) + test.verify(waitFor( lambda: rinsebackrequest == 4, 10000), "Testing FW received Arterial Window Value") + td.td_tx_state( TDTreatmentStates.TREATMENT_RINSEBACK_STATE.value, + 0 , + 0 , + 0 , + 0 , + TXStates.RINSEBACK_RUN_STATE , + 0 , + 0 , + 0 , + 0) + + test.log("test") + + + + + + + + + + + + +