Index: suite_leahi/tst_edit_parameters/test.py =================================================================== diff -u -r3092de4d51953039ef1a683b8f8708f798996afe -r0130028593cbcfc6ec7e97af4b4c48f26b96898b --- suite_leahi/tst_edit_parameters/test.py (.../test.py) (revision 3092de4d51953039ef1a683b8f8708f798996afe) +++ suite_leahi/tst_edit_parameters/test.py (.../test.py) (revision 0130028593cbcfc6ec7e97af4b4c48f26b96898b) @@ -1,5 +1,44 @@ -# -*- coding: utf-8 -*- +#Subject/Title: LDT-2819 Edit Treatment Parameters During Treatment - SW - 02 - Edit Treatment Parameters During Treatment - Q&R +# Functionalities: Testing all functionalities of Edit treatement parameter in the main treatment screen +#Steps +# Pressure Edit +# 1 Navigate to create treatement set all the parameters and navigate to the main treatement page +# 2 Click on Pressures Edit ->Edit the parameters in the pressure popup and perform confirm +# 3 Send the rejection reasom from FW and verify the message in the UI +# 4 Send the No Rejection from the FW and verify the popup closed and Fw recieved the values +# +# Saline Edit +# 1 Send saline data to main treatment container +# 2 Open Saline edit settings +# 3.Verify Saline Bolus target volume set is populated on saline edit popup +# 4 Change settings and confirm +# 5 Send the rejection reason 1 and populate the error message on the popup +# 6 Send the rejection reason 0 and verify the popup closes and verify FW recieves the values +# Treatement parameters +# 1 Send set point low values i.e blood flow,dialysate flow and dialysate temp low value +# 2 Verify Blood flow rate , dialysate flow rate, dialysate temp are colored red +# 3 Perform any of the arrows and value should change to min and color should change to white +# 4 Verify the rejection reason 1 and check the error message in the UI +# 5 Verify the rejection reason 0 and check FW recieves the values +# 6 On Main treatment screen send values in range and test arrow buttons for each Blood flow, Dialysate flow, dialystae temp +# ex. blood flow set to 70 (Step value is 10) +# Press the up arrow and confirm the fw receives the incremented value 80 +# Test rejection -> rejection banner on maintreatment screen +# 7 Verify the values for non step value for blood flow,dialysate flow and dialysate temp +# +# Treatment Duration Edit +# 1 Set a main treatment duration, elapsed time, Ultrafiltration Set volume, ultrafiltration volume delivered +# 2 Send Param Ranges treatment range ex 50 - 300 min +# 3 Click the treatment duration edit button. +# 4 Verify Top 3 parameters (Volume Delivered, Set Volume, Elapsed time are updated +# 5 Verify min and max values for New Treatment duration and perform continue button +# 6 Send rejection reason 1 and check the message in the popup +# 7 Send the rejection reason 0 and verify the popup closes and verify the fw recieves values +# 8 Verify the Duration Edit FW Response value reflect on the next screen +# 9 Verify the rejection reason 1 and check the error message in the UI +# 10 Verify the rejection reason 0 and check FW recieves the values + import names import squish from leahi_dialin.ui import utils @@ -14,11 +53,20 @@ from leahi_dialin.protocols import CAN td =TD_Messaging() +can_interface = td.can_interface ArtWindow = None -Venouspressurewindow ="0" -venouspressurelimitasymetric ="0" -tmppressurelimut ="0" -salineBolusvalue ="0" +Venouspressurewindow = None +venouspressurelimitasymetric = None +tmppressurelimut = None +saline = None +bloodflowrate = None +dialysateflow = None +dialysatetemp = None +bloodFlowrate = 0 +dialtemperature = None +dialflow = 0 +durationvalue = 0 +durationconfirm = 0 @@ -50,9 +98,10 @@ global dialysateflow dialysateflow = state - val,self.index = conversions.bytearray_to_integer( message, self. Index) - global dialysatetemperature - dialysatetemperature = val + val,self.index = conversions.bytearray_to_integer( message, self. index) + global dialysatetemp + test.log(val) + dialysatetemp = val def handle_pressure_request( message, timestamp = 0.0): @@ -66,9 +115,6 @@ state,index = conversions.bytearray_to_integer( message, index) global ArtWindow ArtWindow = state - test.log("Inside function") - test.log(str(ArtWindow)) - test.log(str(state)) state,index = conversions.bytearray_to_integer( message, index) global Venouspressurewindow @@ -82,32 +128,51 @@ global tmppressurelimut tmppressurelimut = state -def handle_bloodflow_request(): +def handle_bloodflow_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 bloodflow - bloodflow = state + global bloodFlowrate + bloodFlowrate = state - -def main(): - can_interface = td.can_interface - global Venouspressurewindow +def handle_dialflow_request(message, timestamp = 0.0): + message = message['message'] + index = MsgFieldPositions.START_POS_FIELD_1 + state,index = conversions.bytearray_to_integer( message, index) + global dialflow + dialflow = state - if can_interface is not None: - channel_id = CAN.DenaliChannels.ui_to_td_ch_id - message_id = MsgIds.MSG_ID_UI_PRESSURE_LIMITS_CHANGE_REQUEST.value - can_interface.register_receiving_publication_function(channel_id, - message_id, - handle_pressure_request) +def handle_dialtmp_request(message, timestamp = 0.0): + message = message['message'] + index = MsgFieldPositions.START_POS_FIELD_1 + val,index = conversions.bytearray_to_float( message, index) + global dialtemperature + dialtemperature = val +def handle_duration_request(message,timestamp =0.0): + message = message['message'] + index = MsgFieldPositions.START_POS_FIELD_1 - utils.tstStart(__file__) - startApplication(config.AUT_NAME) - td.td_operation_mode(TDOpModes.MODE_STAN.value) - # mouseClick(waitForObject(names.o_createTreatmentRect_TouchRect)) - # td.td_operation_mode(TDOpModes.MODE_PRET.value) - # utility.verify_create_treatment_parameters() + state,index = conversions.bytearray_to_integer( message, index) + global durationvalue + durationvalue = state + + +def handle_duration_confirm_request(message,timestamp =0.0): + message = message['message'] + index = MsgFieldPositions.START_POS_FIELD_1 + + state,index = conversions.bytearray_to_integer( message, index) + global durationconfirm + durationconfirm = state + +def check_pressure_edit_maintreatment(): + test.startSection("Pressure Edit") td.td_tx_state( TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value, 0 , 0 , @@ -131,22 +196,30 @@ tmp_min = -640 , tmp_max = 210) - # mouseClick(waitForObject(names.o_treatmentHome_editButton_IconButton)) pressureEdit = waitForObject(names.o_treatmentHome_treatmentPressures_TreatmentPressures) - parent = utility.findObjectById(pressureEdit, "_editButton") - mouseClick(parent) - test.log("Check pressure edit values") - #check the values in edit pressure - + pressureEditButton = utility.findObjectById(pressureEdit, "_editButton") + mouseClick(pressureEditButton) + arterialwindow_value = waitForObject(names.o_arterialWindow_LabelUnitValueAdjuster) + arterial_value =arterialwindow_value.value + test.log(str(arterial_value)) venouswindow_value = waitForObject(names.o_venousWindow_LabelUnitValueAdjuster) - test.log(str(venouswindow_value.value)) + venous_value = venouswindow_value.value + test.log(str(venous_value)) tmpwindow_value = waitForObject(names.o_tmpWindow_LabelUnitValueAdjuster) - test.log(str(tmpwindow_value.value)) + tmp_value =tmpwindow_value.value + test.log(str(tmp_value)) utility.set_value_based_on_target(names.o_arterialWindow_LabelUnitValueAdjuster,80) arterialwindow_value = waitForObject(names.o_arterialWindow_LabelUnitValueAdjuster) - Arterial_Value =arterialwindow_value.value + change_arterialwindow_value =arterialwindow_value.value + test.log(str(change_arterialwindow_value)) utility.set_value_based_on_target(names.o_venousWindow_LabelUnitValueAdjuster,60) + venouswindow_value = waitForObject(names.o_venousWindow_LabelUnitValueAdjuster) + change_venouswindow_value =venouswindow_value.value + test.log(str(change_venouswindow_value)) utility.set_value_based_on_target(names.o_tmpWindow_LabelUnitValueAdjuster,100) + tmpwindow_value = waitForObject(names.o_tmpWindow_LabelUnitValueAdjuster) + change_tmpwindow_value =tmpwindow_value.value + test.log(str(change_tmpwindow_value)) #rejection reason is 1 payload = conversions.integer_to_bytearray(0) @@ -163,8 +236,6 @@ # handle sent messages from UI mouseClick(waitForObject(names.o_confirmButton_TouchRect)) - - #rejection reason 0 payload = conversions.integer_to_bytearray(1) payload += conversions.integer_to_bytearray(0) @@ -174,19 +245,20 @@ is_pure_data = False, has_parameters = True, parameters_payload= payload) - - global ArtWindow - test.verify(waitFor( lambda: ArtWindow == 10, 5000), "Testing lambda this should fail") - test.verify(waitFor( lambda: ArtWindow == arterialwindow_value.value, 5000), "Testing FW received Arterial Window Value") - test.log("Post waitfor() Verify ArtWindow: ") - test.log(str(ArtWindow)) - test.log(str(arterialwindow_value.value)) - - test.verify(Venouspressurewindow == venouswindow_value.value ) + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_UI_PRESSURE_LIMITS_CHANGE_REQUEST.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_pressure_request) + test.verify(waitFor( lambda: ArtWindow == change_arterialwindow_value, 5000), "Testing FW received Arterial Window Value") + test.verify(waitFor( lambda: Venouspressurewindow == change_venouswindow_value,5000 ), "Testing Fw received Venous Window values") + test.verify(waitFor( lambda: tmppressurelimut == change_tmpwindow_value,5000 ), "Testing Fw received temp Window values") pressurepopup = waitFor(lambda: not object.exists(names.o_HeaderBar_WiFi_Popup), 3000) test.compare(pressurepopup, True, "Popup is not present") + test.endSection() - +def check_saline_edit_maintreatment(): test.startSection("Saline data") td.td_saline( 100 , # target_volume @@ -199,7 +271,9 @@ fluidbolusvolume_value = waitForObject(names.o_valueAdjuster_ValueAdjuster) test.log(str(fluidbolusvolume_value.value)) utility.set_value_based_on_target(names.o_valueAdjuster_ValueAdjuster,200) - + change_fluidbolusvolume_value = waitForObject(names.o_valueAdjuster_ValueAdjuster).value + test.log(str(change_fluidbolusvolume_value)) + #saline rejection reason is 1 payload = conversions.integer_to_bytearray(0) payload += conversions.integer_to_bytearray(1) td.cmd_send_general_response(message_id =MsgIds.MSG_ID_TD_BOLUS_VOLUME_CHANGE_RESPONSE.value, @@ -212,8 +286,6 @@ rejectionReason = utility.get_object_from_names(names.o_notification_bar) test.compare(rejectionReason.text, "[1] Request is not allowed in the current operating mode", "Rejection Reason text should be :" + str("[1] Request is not allowed in the current operating mode")) #rejection reason 0 - - mouseClick(waitForObject(names.o_confirmButton_TouchRect)) payload = conversions.integer_to_bytearray(1) payload += conversions.integer_to_bytearray(0) @@ -231,39 +303,51 @@ message_id, handle_saline_request) - # test.log(str(salineBolusvalue)) + test.verify(waitFor( lambda: saline == change_fluidbolusvolume_value, 5000), "Testing FW received Bolus volumeValue") salinepopup = waitFor(lambda: not object.exists(names.o_HeaderBar_WiFi_Popup), 3000) test.compare(salinepopup, True, "Popup is not present") - #check the recieved values + test.endSection() + +def check_treatement_edit_maintreatment(): test.startSection("Treatment Parameters") td.td_treatment_set_points( blood_flow = 42, dialysate_flow = 43, dialysate_temp = 49) - test.log("Sample") treatmentEdit = waitForObject(names.o_treatmentHome_treatmentFlows_TreatmentFlows) treatmentEditbutton = utility.findObjectById(treatmentEdit, "_editButton") mouseClick(treatmentEditbutton) bloodFlow = waitForObject(names.o_bloodFlowRate_LabelUnitValueAdjuster) bloodflowvalue = utility.findObjectById(bloodFlow, "_valueAdjuster") test.log(str(bloodflowvalue.value)) - test.log(str(waitForObject(names.o_bloodFlowRate_LabelUnitValueAdjuster).valueTextColor.name)) + bloodflowcolor = waitForObject(names.o_bloodFlowRate_LabelUnitValueAdjuster).valueTextColor.name + test.compare(str(bloodflowcolor),config.RED_COLOR,"Blood flow text color should be:"+str(config.RED_COLOR)) utility.set_value_based_on_target(names.o_bloodFlowRate_LabelUnitValueAdjuster,"50") - test.log(str(bloodflowvalue.value)) - test.log(str(waitForObject(names.o_bloodFlowRate_LabelUnitValueAdjuster).valueTextColor.name)) + changedbloodflowvalue = bloodflowvalue.value + test.log(str(changedbloodflowvalue)) + changedbloodflowcolor = waitForObject(names.o_bloodFlowRate_LabelUnitValueAdjuster).valueTextColor.name + test.compare(str(changedbloodflowcolor), config.WHITE_COLOR, "Blood Flow text color changed to"+ str(config.WHITE_COLOR)) + #dialysate flow dialysateFlow = waitForObject(names.o_dialysateFlowRate_LabelUnitValueAdjuster) dialysateflowvalue = utility.findObjectById(dialysateFlow, "_valueAdjuster") test.log(str(dialysateflowvalue.value)) - test.log(str(waitForObject(names.o_dialysateFlowRate_LabelUnitValueAdjuster).valueTextColor.name)) + dialysateflowcolor = waitForObject(names.o_dialysateFlowRate_LabelUnitValueAdjuster).valueTextColor.name + test.compare(str(dialysateflowcolor),config.RED_COLOR,"Dialysate flow text color should be"+str(config.RED_COLOR)) utility.set_value_based_on_target(names.o_dialysateFlowRate_LabelUnitValueAdjuster,"50") - test.log(str(dialysateflowvalue.value)) - test.log(str(waitForObject(names.o_dialysateFlowRate_LabelUnitValueAdjuster).valueTextColor.name)) + changeddialysateflowvalue =dialysateflowvalue.value + test.log(str(changeddialysateflowvalue)) + changeddialysateflowcolor = waitForObject(names.o_dialysateFlowRate_LabelUnitValueAdjuster).valueTextColor.name + test.compare(str(changeddialysateflowcolor),config.WHITE_COLOR,"Dialysate flow text color changed to"+str(changeddialysateflowcolor)) + #dialysate temp dialysateTemp = waitForObject(names.o_dialysateTemperature_LabelUnitValueAdjuster) dialysatetempvalue = utility.findObjectById(dialysateTemp, "_valueAdjuster") test.log(str(dialysatetempvalue.value)) - test.log(str(waitForObject(names.o_dialysateTemperature_LabelUnitValueAdjuster).valueTextColor.name)) + dialysatetempcolor = waitForObject(names.o_dialysateTemperature_LabelUnitValueAdjuster).valueTextColor.name + test.compare(str(dialysatetempcolor),config.RED_COLOR,"Dialysate temp color should be"+str(dialysatetempcolor)) utility.set_value_based_on_target(names.o_dialysateTemperature_LabelUnitValueAdjuster,"38") - test.log(str(dialysatetempvalue.value)) - test.log(str(waitForObject(names.o_dialysateTemperature_LabelUnitValueAdjuster).valueTextColor.name)) + changedialysatetemp = dialysatetempvalue.value + test.log(str(changedialysatetemp)) + changeddialysatetempcolor =waitForObject(names.o_dialysateTemperature_LabelUnitValueAdjuster).valueTextColor.name + test.compare(str(changeddialysatetempcolor),config.WHITE_COLOR,"Dialysate temp text color changed to"+str(config.WHITE_COLOR)) #rejection reason is 1 payload = conversions.integer_to_bytearray(0) payload += conversions.integer_to_bytearray(1) @@ -293,10 +377,13 @@ message_id, handle_treatment_request) - # test.log(str(salineBolusvalue)) + test.verify(waitFor( lambda: bloodflowrate == changedbloodflowvalue, 5000), "Testing FW received blood flow Value") + test.verify(waitFor( lambda: dialysateflow == changeddialysateflowvalue, 5000), "Testing FW received dialysate flow Value") + # test.verify(waitFor( lambda: dialysatetemp == changedialysatetemp, 5000), "Testing FW received dialysate temp Value") treatmentpopup = waitFor(lambda: not object.exists(names.o_HeaderBar_WiFi_Popup), 3000) test.compare(treatmentpopup, True, "Popup is not present") test.endSection() + test.startSection("Main treatment screen check the set points") td.td_treatment_set_points( blood_flow = 70, dialysate_flow = 70, @@ -305,51 +392,85 @@ bloodflowUpArrow = waitForObject(names.o_blood_flow_value) bloodflowUpArrowbutton = utility.findObjectById(bloodflowUpArrow,"_upArrowIcon") mouseClick(bloodflowUpArrowbutton) + bloodFlow = utility.get_object_from_names(names.o_blood_flow_value) + bloodFlow_properties = object.properties(bloodFlow) + changedbloodflow = bloodFlow_properties["value"] + + # handle_bloodflow_request(MsgIds.MSG_ID_UI_TREATMENT_SET_POINT_BLOOD_FLOW_CHANGE_REQUEST.value) + test.verify(waitFor( lambda: bloodFlowrate == changedbloodflow+10, 10000), "Testing FW received blood flow Value in main treatment screen") + + bloodflowdownArrowbutton = utility.findObjectById(bloodflowUpArrow,"_downArrowIcon") + mouseClick(bloodflowdownArrowbutton) + bloodFlow = utility.get_object_from_names(names.o_blood_flow_value) + bloodFlow_properties = object.properties(bloodFlow) + changedbloodflow = bloodFlow_properties["value"] if can_interface is not None: channel_id = CAN.DenaliChannels.ui_to_td_ch_id message_id = MsgIds.MSG_ID_UI_TREATMENT_SET_POINT_BLOOD_FLOW_CHANGE_REQUEST.value can_interface.register_receiving_publication_function(channel_id, message_id, handle_bloodflow_request) - - #check the value incremented in blood flow + test.verify(waitFor( lambda: bloodFlowrate == changedbloodflow-10, 5000), "Testing FW received blood flow Value in main treatment screen") - bloodflowdownArrowbutton = utility.findObjectById(bloodflowUpArrow,"_downArrowIcon") - mouseClick(bloodflowdownArrowbutton) - #check the decremented value - dialysateflowuparrow = waitForObject(names.o_dial_flow_value) dialysateflowuparrowbutton = utility.findObjectById(dialysateflowuparrow,"_upArrowIcon") mouseClick(dialysateflowuparrowbutton) + dialFlow = utility.get_object_from_names(names.o_dial_flow_value) + dialFlow_properties = object.properties(dialFlow) + changeddialflow = dialFlow_properties["value"] if can_interface is not None: channel_id = CAN.DenaliChannels.ui_to_td_ch_id - message_id = MsgIds.MSG_ID_TD_TREATMENT_SET_POINT_DIALYSATE_FLOW_CHANGE_RESPONSE.value + message_id = MsgIds.MSG_ID_UI_TREATMENT_SET_POINT_DIALYSATE_FLOW_CHANGE_REQUEST.value can_interface.register_receiving_publication_function(channel_id, message_id, - handle_bloodflow_request) + handle_dialflow_request) - #check the value incremented in dialysate flow value + test.verify(waitFor( lambda: dialflow == changeddialflow+5, 10000), "Testing FW received dial flow Value in main treatment screen") - dialysateflowdownArrowbutton = utility.findObjectById(dialysateflowuparrow,"_downArrowIcon") - mouseClick(dialysateflowdownArrowbutton) - #check the decremented value - - dialysatetempuparrow = waitForObject(names.o_dial_tmp_value) - dialysatetempuparrowbutton = utility.findObjectById(dialysatetempuparrow,"_upArrowIcon") - mouseClick(dialysatetempuparrowbutton) + dialysateflowdownarrowbutton = utility.findObjectById(dialysateflowuparrow,"_downArrowIcon") + mouseClick(dialysateflowdownarrowbutton) + dialFlow = utility.get_object_from_names(names.o_dial_flow_value) + dialFlow_properties = object.properties(dialFlow) + changeddialflow = dialFlow_properties["value"] if can_interface is not None: channel_id = CAN.DenaliChannels.ui_to_td_ch_id - message_id = MsgIds.MSG_ID_TD_TREATMENT_SET_POINT_DIALYSATE_TEMPERATURE_CHANGE_RESPONSE.value + message_id = MsgIds.MSG_ID_UI_TREATMENT_SET_POINT_DIALYSATE_FLOW_CHANGE_REQUEST.value can_interface.register_receiving_publication_function(channel_id, message_id, - handle_bloodflow_request) + handle_dialflow_request) - #check the value incremented in dialysate flow value + test.verify(waitFor( lambda: dialflow == changeddialflow-20, 10000), "Testing FW received dial flow Value in main treatment screen") - dialysatetempdownArrowbutton = utility.findObjectById(dialysatetempuparrow,"_downArrowIcon") - mouseClick(dialysatetempdownArrowbutton) + dialysatetmpuparrow = waitForObject(names.o_dial_tmp_value) + dialysatetmpuparrowbutton = utility.findObjectById(dialysatetmpuparrow,"_upArrowIcon") + mouseClick(dialysatetmpuparrowbutton) + dialtmp = utility.get_object_from_names(names.o_dial_tmp_value) + dialtmp_properties = object.properties(dialtmp) + changeddialtmp = dialtmp_properties["value"] + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_UI_TREATMENT_SET_POINT_DIALYSATE_TEMPERATURE_CHANGE_REQUEST.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_dialtmp_request) + + test.verify(waitFor( lambda: dialtemperature == changeddialtmp+0.5, 20000), "Testing FW received dial tmp Value in main treatment screen") + dialysatetmpdownarrowbutton = utility.findObjectById(dialysatetmpuparrow,"_downArrowIcon") + mouseClick(dialysatetmpdownarrowbutton) + dialtmp = utility.get_object_from_names(names.o_dial_tmp_value) + dialtmp_properties = object.properties(dialtmp) + changeddialtmp = dialtmp_properties["value"] + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_UI_TREATMENT_SET_POINT_DIALYSATE_TEMPERATURE_CHANGE_REQUEST.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_dialtmp_request) + + test.verify(waitFor( lambda: dialtemperature == changeddialtmp-0.5, 30000), "Testing FW received dial tmp Value in main treatment screen") + #rejection reason is 1 payload = conversions.integer_to_bytearray(0) @@ -364,7 +485,7 @@ rejectionReason = utility.get_object_from_names(names.o_treatmentHome_notification_NotificationBarSmall) test.compare(rejectionReason.text, "[1] Request is not allowed in the current operating mode", "Rejection Reason text should be :" + str("[1] Request is not allowed in the current operating mode")) - #rejection reason is 0 + #rejection reason is 1 payload = conversions.integer_to_bytearray(1) payload += conversions.integer_to_bytearray(0) td.cmd_send_general_response(message_id =MsgIds.MSG_ID_TD_TREATMENT_SET_POINT_BLOOD_FLOW_CHANGE_RESPONSE.value, @@ -374,8 +495,6 @@ has_parameters = True, parameters_payload= payload) - #need to verify the response - td.td_treatment_set_points( blood_flow = 94, dialysate_flow = 94, dialysate_temp = 28) @@ -390,7 +509,7 @@ message_id, handle_bloodflow_request) - #check the value incremented in blood flow + test.verify(waitFor( lambda: bloodFlowrate == 100, 40000), "Testing FW received blood flow Value in main treatment screen") dialysateflowuparrow = waitForObject(names.o_dial_flow_value) dialysateflowuparrowbutton = utility.findObjectById(dialysateflowuparrow,"_upArrowIcon") @@ -402,7 +521,7 @@ message_id, handle_bloodflow_request) - #check the value incremented in dialysate flow value + test.verify(waitFor( lambda: dialflow == 100, 40000), "Testing FW received dial flow Value in main treatment screen") dialysatetempuparrow = waitForObject(names.o_dial_tmp_value) dialysatetempuparrowbutton = utility.findObjectById(dialysatetempuparrow,"_upArrowIcon") @@ -413,10 +532,10 @@ can_interface.register_receiving_publication_function(channel_id, message_id, handle_bloodflow_request) - - #check the value incremented in dialysate flow value + test.verify(waitFor( lambda: dialtemperature == 35, 50000), "Testing FW received dial tmp Value in main treatment screen") test.endSection() - + +def check_duration_edit_maintreatment(): test.startSection("Treatment Duration Edit") td.td_treatment_time( tx_duration_s = 51 , tx_elapsed_s = 5 , @@ -441,37 +560,34 @@ test.log(str(treatmenttimeelapsed)) utility.set_value_based_on_target(names.o_newTreatmentDuration_LabelUnitValueAdjuster,51) utility.set_value_based_on_target(names.o_newTreatmentDuration_LabelUnitValueAdjuster,300) - #rejection reason 0 - # payload = conversions.integer_to_bytearray(1) - # payload += conversions.integer_to_bytearray(0) - # td.cmd_send_general_response(message_id =MsgIds.MSG_ID_TD_DURATION_CONFIRM_RESPONSE.value, - # reason=0, - # accepted=1, - # is_pure_data = False, - # has_parameters = True, - # parameters_payload= payload) - # - # #need to verify the response - # - # - - #rejection reason is 1 + + mouseClick(names.o_continueButton_TouchRect) + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_TD_DURATION_VALIDATE_RESPONSE.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_duration_request) + + + test.verify(waitFor( lambda: durationvalue == 300, 3000), "Testing FW received duration Value in main treatment screen") td.td_duration_validate_response(vRejectionReason =1, - vDuration= 78, - vUFVolume= 0.9, - vUFRate= 0.6) + vDuration= 0, + vUFVolume= 0.0, + vUFRate= 0.0) rejectionReason = utility.get_object_from_names(names.o_notification_bar) test.compare(rejectionReason.text, "[1] Request is not allowed in the current operating mode", "Rejection Reason text should be :" + str("[1] Request is not allowed in the current operating mode")) - td.td_duration_validate_response(vRejectionReason =0, vDuration= 78, vUFVolume= 0.9, vUFRate= 0.6) + #check the values in the ui + newufrate = waitForObject(names.o_ufRate_LabelUnitText).value + test.compare(newufrate,0.60,"Duration value is updated in"+str(newufrate)) + newduration = waitForObject(names.o_newTreatmentDuration_LabelUnitText).value + test.compare(int(newduration),78,"UF rate value is updated in"+str(newduration)) - - #need to check the request - #rejection reason is 1 payload = conversions.integer_to_bytearray(0) payload += conversions.integer_to_bytearray(1) td.cmd_send_general_response(message_id =MsgIds.MSG_ID_TD_DURATION_CONFIRM_RESPONSE.value, @@ -493,18 +609,35 @@ is_pure_data = False, has_parameters = True, parameters_payload= payload) - # if can_interface is not None: - # channel_id = CAN.DenaliChannels.ui_to_td_ch_id - # message_id = MsgIds.MSG_ID_UI_TREATMENT_SET_POINTS_CHANGE_REQUEST.value - # can_interface.register_receiving_publication_function(channel_id, - # message_id, - # handle_treatment_request) + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_TD_DURATION_CONFIRM_RESPONSE.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_duration_confirm_request) - + test.verify(waitFor( lambda: durationconfirm == 78, 50000), "Testing FW received duration Value in main treatment screen") treatmentpopup = waitFor(lambda: not object.exists(names.o_HeaderBar_WiFi_Popup), 3000) - test.compare(treatmentpopup, True, "Popup is not present") + test.compare(treatmentpopup, True, "Popup is not present") + +def main(): + utils.tstStart(__file__) + startApplication(config.AUT_NAME) + td.td_operation_mode(TDOpModes.MODE_STAN.value) + mouseClick(waitForObject(names.o_createTreatmentRect_TouchRect)) + td.td_operation_mode(TDOpModes.MODE_PRET.value) + utility.verify_create_treatment_parameters() + check_pressure_edit_maintreatment() + check_saline_edit_maintreatment() + check_treatement_edit_maintreatment() + check_duration_edit_maintreatment() + + + + + \ No newline at end of file