Index: suite_leahi/tst_edit_parameters/test.py =================================================================== diff -u -r861179f9b370bbbf286228837d52489d184231dc -r509186885561d57fef899a35b06e183d0ccd51b2 --- suite_leahi/tst_edit_parameters/test.py (.../test.py) (revision 861179f9b370bbbf286228837d52489d184231dc) +++ suite_leahi/tst_edit_parameters/test.py (.../test.py) (revision 509186885561d57fef899a35b06e183d0ccd51b2) @@ -4,7 +4,7 @@ # 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 +# 3 Send the rejection reasom from FW and verify the color border for parameters # 4 Send the No Rejection from the FW and verify the popup closed and Fw recieved the values # # Saline Edit @@ -18,7 +18,7 @@ # 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 +# 4 Verify the rejection reason 1 and check the color border for parameters # 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) @@ -68,8 +68,17 @@ durationvalue = 0 durationconfirm = None +PRESSURE_TREATEMENT_OBJ = [names.o_arterialWindow_LabelUnitValueAdjuster, + names.o_venousWindow_LabelUnitValueAdjuster, + names.o_venousAsymmetricWindow_LabelUnitValueAdjuster, + names.o_tmpWindow_LabelUnitValueAdjuster] +PRESCRIPTION_SETTINGS_OBJ =[names.o_bloodFlowRate_LabelUnitValueAdjuster, + names.o_dialysateFlowRate_LabelUnitValueAdjuster, + names.o_dialysateTemperature_LabelUnitValueAdjuster] + + def handle_saline_request( message, timestamp = 0.0): """ Called when the user requests to firmware from UI @@ -223,31 +232,25 @@ change_tmpwindow_value =tmpwindow_value.value test.log(str(change_tmpwindow_value)) - #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_PRESSURE_LIMITS_CHANGE_RESPONSE.value, - reason=1, - accepted=1, - is_pure_data = False, - has_parameters = True, - parameters_payload= payload) - - mouseClick(waitForObject(names.o_vitals_close_btn)) - rejectionReason = waitForObject(names.o_notification_bar).text - test.compare(rejectionReason, "[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")) - mouseClick(pressureEditButton) + td.td_pressures_adjustment_response(vAccepted = 0, + vArterialWindowRejectReason = 1, + vVenousWindowRejectReason = 1, + vVenousAsymmetricRejectReason= 1, + vTmpWindowRejectReason = 1) + for expected_treatment_title,object in zip(config.PRESSURE_TREATMENT_PARAMETERS,PRESSURE_TREATEMENT_OBJ): + + parameter_object = utility.setObjectText(text = expected_treatment_title,obj =object) + parameter_text = waitForObject(parameter_object) + parameter_text_color = parameter_text.border.color.name + test.compare(config.COLOR_CODES, parameter_text_color, "parameter color should be ' \red for' " + expected_treatment_title +" , if the confirmation get rejected !") + # handle sent messages from UI + td.td_pressures_adjustment_response(vAccepted = 0, + vArterialWindowRejectReason = 0, + vVenousWindowRejectReason = 0, + vVenousAsymmetricRejectReason= 0, + vTmpWindowRejectReason = 0) mouseClick(waitForObject(names.o_confirmButton_TouchRect)) - #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_PRESSURE_LIMIT_WIDEN_RESPONSE.value, - reason=0, - accepted=1, - 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_PRESSURE_LIMITS_CHANGE_REQUEST.value @@ -257,8 +260,7 @@ 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") + mouseClick(names.o_vitals_close_btn) test.endSection() def check_saline_edit_maintreatment(): @@ -286,8 +288,8 @@ has_parameters = True, parameters_payload= payload) - 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")) + rejectionReason = waitForObject(names.o_notificationBar_NotificationBarSmall).text + test.compare(rejectionReason, "[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) @@ -352,27 +354,38 @@ 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) - td.cmd_send_general_response(message_id =MsgIds.MSG_ID_TD_TREATMENT_SET_POINTS_CHANGE_RESPONSE.value, - reason=0, - accepted=1, - is_pure_data = False, - has_parameters = True, - parameters_payload= payload) + td.td_set_points_adjustment_response(vAccepted = 0, + vBloodFlowRejectReason = 1, + vDialysateFlowRateRejectReason = 1, + vspnDialysateTempRejectReason = 1, + vAcidConcentrateRejectReason = 0, + vAcidConcentrateFactorRejectReason= 0, + vBicarbConcentrateRejectReason = 0, + vTreatmentModalityRejectReason = 0, + vHepatitisRejectReason = 0, + vSodiumRejectReason = 0, + vBicarbonateRejectReason = 0) - rejectionReason = utility.get_object_from_names(names.o_notification_bar).text - test.compare(rejectionReason, "[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 + for expected_treatment_title,object in zip(config.PRESCRIPTION_SETTINGS_PARAMETERS,PRESCRIPTION_SETTINGS_OBJ): + + parameter_object = utility.setObjectText(text = expected_treatment_title,obj =object) + parameter_text = waitForObject(parameter_object) + parameter_text_color = parameter_text.border.color.name + test.compare(config.COLOR_CODES, parameter_text_color, "parameter color should be ' \red for' " + expected_treatment_title +" , if the confirmation get rejected !") + + td.td_set_points_adjustment_response(vAccepted = 0, + vBloodFlowRejectReason = 0, + vDialysateFlowRateRejectReason = 0, + vspnDialysateTempRejectReason = 0, + vAcidConcentrateRejectReason = 0, + vAcidConcentrateFactorRejectReason= 0, + vBicarbConcentrateRejectReason = 0, + vTreatmentModalityRejectReason = 0, + vHepatitisRejectReason = 0, + vSodiumRejectReason = 0, + vBicarbonateRejectReason = 0) + mouseClick(waitForObject(names.o_confirmButton_TouchRect)) - 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_POINTS_CHANGE_RESPONSE.value, - reason=0, - accepted=1, - 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 @@ -382,9 +395,7 @@ 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") + mouseClick(names.o_vitals_close_btn) test.endSection() test.startSection("Main treatment screen check the set points") @@ -395,23 +406,21 @@ 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"] + bloodFlow = waitForObject(names.o_blood_flow_value) + changedbloodflow = bloodFlow.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) # 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") + 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) - bloodFlow = utility.get_object_from_names(names.o_blood_flow_value) - bloodFlow_properties = object.properties(bloodFlow) - changedbloodflow = bloodFlow_properties["value"] + bloodFlow = waitForObject(names.o_blood_flow_value) + changedbloodflow = bloodFlow.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 @@ -423,9 +432,8 @@ 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"] + dialFlow = waitForObject(names.o_dial_flow_value) + changeddialflow = dialFlow.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_FLOW_CHANGE_REQUEST.value @@ -437,9 +445,8 @@ 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"] + dialFlow = waitForObject(names.o_dial_flow_value) + changeddialflow = dialFlow.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_FLOW_CHANGE_REQUEST.value @@ -453,9 +460,8 @@ 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"] + dialtmp = waitForObject(names.o_dial_tmp_value) + changeddialtmp = dialtmp.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 @@ -467,9 +473,8 @@ 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"] + dialtmp = waitForObject(names.o_dial_tmp_value) + changeddialtmp = dialtmp.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 @@ -560,18 +565,11 @@ treatmentEdit = waitForObject(names.o_treatment_duration) treatmentEditbutton = utility.findObjectById(treatmentEdit,"_editTimeIcon") mouseClick(treatmentEditbutton) - ufvolumeremoved = waitForObject(names.o_ufVolumeRemoved_LabelUnitText).value - test.log(str(ufvolumeremoved)) - ufvolumegoal =waitForObject(names.o_ufVolumeGoal_LabelUnitText) - test.log(str(ufvolumegoal)) - treatmenttimeelapsed =waitForObject(names.o_timeElapsed_LabelUnitText) - 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) - mouseClick(names.o_continueButton_TouchRect) td.td_duration_validate_response(vRejectionReason =0, vDuration= 0, + vHeparinDuration = 0, vUFVolume= 0.0, vUFRate= 0.0) if can_interface is not None: @@ -583,15 +581,18 @@ test.verify(waitFor( lambda: durationvalue == 300, 3000), "Testing FW received duration Value in main treatment screen") + td.td_duration_validate_response(vRejectionReason =1, vDuration= 0, + vHeparinDuration = 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")) + rejectionReason = waitForObject(names.o_notificationBar_NotificationBarSmall).text + test.compare(rejectionReason, "[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, + vHeparinDuration = 0, vUFVolume= 0.5, vUFRate= 0.6) #check the values in the ui @@ -609,7 +610,7 @@ has_parameters = True, parameters_payload= payload) - rejectionReason = utility.get_object_from_names(names.o_notification_bar).text + rejectionReason = waitForObject(names.o_notificationBar_NotificationBarSmall).text test.compare(rejectionReason, "[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 mouseClick(waitForObject(names.o_confirmButton_TouchRect)) @@ -634,10 +635,8 @@ test.endSection() def main(): - - utils.tstStart(__file__) - startApplication(config.AUT_NAME) + startApplication(utility.aut("-q")) td.td_operation_mode(TDOpModes.MODE_STAN.value) hemodialysis = waitForObject(names.o_createHDTreatment_TouchRect) hemodialysis_btn = utility.findChildByText(hemodialysis, "Hemodialysis") @@ -648,11 +647,11 @@ check_saline_edit_maintreatment() check_treatement_edit_maintreatment() check_duration_edit_maintreatment() + utils.tstDone() - \ No newline at end of file