Index: suite_leahi/tst_edit_parameters/test.py =================================================================== diff -u -re79975dc325f90441f70e114390d1adf4e7d58f9 -r3a5e8df68c2370134a53c29d7f8f47a8efb66f4d --- suite_leahi/tst_edit_parameters/test.py (.../test.py) (revision e79975dc325f90441f70e114390d1adf4e7d58f9) +++ suite_leahi/tst_edit_parameters/test.py (.../test.py) (revision 3a5e8df68c2370134a53c29d7f8f47a8efb66f4d) @@ -1,4 +1,5 @@ -#Subject/Title: LDT-2819 Edit Treatment Parameters During Treatment - SW - 02 - Edit Treatment Parameters During Treatment - Q&R +#Subject/Title: LDT-2819 Edit Treatment Parameters During Treatment - SW - 02 - Edit Treatment Parameters During Treatment - Q&R +# LDT-4708 NON-FEATURE: SW Misc & Enhc - SW - 02 - Treatment adjustments - Vitals alarm limits - Q&R - 15: SIT - Software Integration Tests - Squish Qt # Functionalities: Testing all functionalities of Edit treatement parameter in the main treatment screen #Steps # Pressure Edit @@ -37,21 +38,26 @@ # 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 +# Vital Settings +# 1 Click on Vital settings Edit ->Edit the parameters in the vitals popup and perform confirm +# 2 Send the rejection reasom from FW and verify the color border for parameters +# 3 Send the No Rejection from the FW and verify the popup closed and Fw recieved the values +# - import names import squish import can from leahi_dialin.ui import utils -from configuration import utility,config,navigation -from configuration import config +from configuration import utility,config,navigation,application_init from leahi_dialin.ui.td_messaging import TD_Messaging from leahi_dialin.common.ui_defs import TXStates from leahi_dialin.common.td_defs import TDOpModes,TDTreatmentStates from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions from leahi_dialin.utils import conversions from leahi_dialin.protocols import CAN +from configuration.getrejectiontext import ScopedRejectionRepository + td = TD_Messaging() can_interface = td.can_interface ArterialWindow = None @@ -67,18 +73,25 @@ dialflow = 0 durationvalue = 0 durationconfirm = None +systolicLow = None +systolicHigh = None +heartRateLow = None +heartRateHigh = None -PRESSURE_TREATEMENT_OBJ = [names.o_arterialWindow_LabelUnitValueAdjuster, +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, +PRESCRIPTION_SETTINGS_OBJ =[names.o_bloodFlowRate_LabelUnitValueAdjuster, names.o_dialysateFlowRate_LabelUnitValueAdjuster, names.o_dialysateTemperature_LabelUnitValueAdjuster] +conf_path = application_init.configuration_folder_path() + "Alarms/Rejections.conf" +repo = ScopedRejectionRepository(path=conf_path) + def handle_saline_request( message, timestamp = 0.0): """ Called when the user requests to firmware from UI @@ -180,6 +193,27 @@ global durationconfirm durationconfirm = state +def handle_vital_confirm_request(message,timestamp =0.0): + message = message['message'] + index = MsgFieldPositions.START_POS_FIELD_1 + + state,index = conversions.bytearray_to_integer( message, index) + global systolicLow + systolicLow = state + + state,index = conversions.bytearray_to_integer( message, index) + global systolicHigh + systolicHigh= state + + state,index = conversions.bytearray_to_integer( message, index) + global heartRateLow + heartRateLow = state + + state,index = conversions.bytearray_to_integer( message, index) + global heartRateHigh + heartRateHigh = state + + def check_pressure_edit_maintreatment(): test.startSection("Pressure Edit") td.td_tx_state( TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value, @@ -219,15 +253,15 @@ tmpwindow_value = waitForObject(names.o_tmpWindow_LabelUnitValueAdjuster) tmp_value =tmpwindow_value.value test.log(str(tmp_value)) - utility.set_value_based_on_target(names.o_arterialWindow_LabelUnitValueAdjuster,200) + utility.set_value_based_on_target(names.o_arterialWindow_LabelUnitValueAdjuster,70) arterialwindow_value = waitForObject(names.o_arterialWindow_LabelUnitValueAdjuster) change_arterialwindow_value =arterialwindow_value.value test.log(str(change_arterialwindow_value)) - utility.set_value_based_on_target(names.o_venousWindow_LabelUnitValueAdjuster,140) + utility.set_value_based_on_target(names.o_venousWindow_LabelUnitValueAdjuster,80) 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) + utility.set_value_based_on_target(names.o_tmpWindow_LabelUnitValueAdjuster,50) tmpwindow_value = waitForObject(names.o_tmpWindow_LabelUnitValueAdjuster) change_tmpwindow_value =tmpwindow_value.value test.log(str(change_tmpwindow_value)) @@ -263,14 +297,14 @@ mouseClick(names.o_vitals_close_btn) test.endSection() + def check_saline_edit_maintreatment(): test.startSection("Saline data") td.td_saline( - 100 , # target_volume - 150 , # cumulative_volume - 75 , # bolus_volume - 0 - ) + 100, # target_volume + 150, # cumulative_volume + 75 , # bolus_volume + 0 ) mouseClick(waitForObject(names.o_treatmentHome_editButton_IconButton)) fluidbolusvolume_value = waitForObject(names.o_valueAdjuster_ValueAdjuster) @@ -281,15 +315,16 @@ #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, - reason=0, - accepted=1, + td.cmd_send_general_response(message_id = MsgIds.MSG_ID_TD_BOLUS_VOLUME_CHANGE_RESPONSE.value, + reason = 1, + accepted = 0, is_pure_data = False, has_parameters = True, parameters_payload= payload) 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")) + REJECT_TEXT = repo.get("1", "Title") + test.compare(rejectionReason, "[1] "+REJECT_TEXT, "Rejection Reason text should be :" + str(rejectionReason)) #rejection reason 0 mouseClick(waitForObject(names.o_confirmButton_TouchRect)) payload = conversions.integer_to_bytearray(1) @@ -441,7 +476,7 @@ message_id, handle_dialflow_request) - test.verify(waitFor( lambda: dialflow == changeddialflow+5, 3000), "Testing FW received dial flow Value in main treatment screen") + test.verify(waitFor( lambda: dialflow == changeddialflow+10, 3000), "Testing FW received dial flow Value in main treatment screen") dialysateflowdownarrowbutton = utility.findObjectById(dialysateflowuparrow,"_downArrowIcon") mouseClick(dialysateflowdownarrowbutton) @@ -454,7 +489,7 @@ message_id, handle_dialflow_request) - test.verify(waitFor( lambda: dialflow == changeddialflow-20, 3000), "Testing FW received dial flow Value in main treatment screen") + test.verify(waitFor( lambda: dialflow == changeddialflow-10, 3000), "Testing FW received dial flow Value in main treatment screen") dialysatetmpuparrow = waitForObject(names.o_dial_tmp_value) @@ -484,7 +519,6 @@ test.verify(waitFor( lambda: dialtemperature == changeddialtmp-0.5, 3000), "Testing FW received dial tmp Value in main treatment screen") - #rejection reason is 1 payload = conversions.integer_to_bytearray(0) payload += conversions.integer_to_bytearray(1) @@ -495,9 +529,10 @@ has_parameters = True, parameters_payload= payload) - 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")) + REJECT_TEXT = repo.get("1", "Title") + rejectionReason = waitForObjectExists(names.o_treatmentHome_notification_NotificationBarSmall) + test.compare(rejectionReason.text,"[1] "+ REJECT_TEXT, "Rejection Reason text should be :" + str(rejectionReason.text)) #rejection reason is 0 payload = conversions.integer_to_bytearray(1) payload += conversions.integer_to_bytearray(0) @@ -589,7 +624,8 @@ vUFRate= 0.0) 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")) + REJECT_TEXT = repo.get("1", "Title") + test.compare(rejectionReason,"[1] "+REJECT_TEXT, "Rejection Reason text should be :" + str(rejectionReason)) td.td_duration_validate_response(vRejectionReason =0, vDuration= 78, vHeparinDuration = 0, @@ -611,7 +647,8 @@ parameters_payload= payload) 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")) + REJECT_TEXT = repo.get("1", "Title") + test.compare(rejectionReason,"[1] "+REJECT_TEXT, "Rejection Reason text should be :" + str(rejectionReason)) #rejection reason is 0 mouseClick(waitForObject(names.o_confirmButton_TouchRect)) payload = conversions.integer_to_bytearray(1) @@ -632,7 +669,66 @@ test.verify(waitFor( lambda: durationconfirm == 78, 5000), "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.endSection() + test.endSection() + +def check_vitals_edit_maintreatment(): + test.startSection("Check the vitals edit in the main treatment screen") + parent_obj = waitForObject(names.o_treatmentHome_treatmentVitals_TreatmentVitals) + edit_button = utility.findObjectById(parent_obj,"_editButton") + mouseClick(waitForObject(edit_button)) + test.log("Check the vitals") + parent_obj = waitForObject(names.o_controlLeftColumn_Column) + systolic_BP_low = utility.findObjectById(parent_obj, "_systolicLowAlarmLimit") + utility.set_value_based_on_target(systolic_BP_low, 80) + systolic_BP_High = utility.findObjectById(parent_obj, "_systolicHighAlarmLimit") + utility.set_value_based_on_target(systolic_BP_High, 150) + right_obj = waitForObject(names.o_controlRightColumn_Column) + heart_rate_low = utility.findObjectById(right_obj, "_heartRateLowAlarmLimit") + utility.set_value_based_on_target(heart_rate_low, 95) + heart_rate_high = utility.findObjectById(right_obj,"_heartRateHighAlarmLimit") + utility.set_value_based_on_target(heart_rate_high, 105) + mouseClick(names.o_confirm_button) + global systolicHigh + global systolicLow + global heartRateHigh + global heartRateLow + if can_interface is not None: + channel_id = CAN.CanChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_UI_VITALS_ADJUSTMENT_REQUEST.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_vital_confirm_request) + + test.verify(waitFor( lambda: systolicLow == 80 ,1000 ), "Testing FW received from UI") + test.verify(waitFor( lambda: systolicHigh == 150 ,1000 ), "Testing Fw received from UI") + test.verify(waitFor( lambda: heartRateHigh == 105 ,1000 ), "Testing Fw received from UI") + test.verify(waitFor( lambda: heartRateLow == 95 ,1000 ), "Testing Fw received from UI") + td.td_vitals_alarm_limits_adjustment_response( vAccepted = 0, + vSystolicBpLowAlarmLimitRejectionReson = 1, + vSystolicBpHighAlarmLimitRejectionReson = 1, + vHeartRateLowAlarmLimitRejectionReson = 1, + vHeartRateHighAlarmLimitRejectionReson = 1, + vVitalsIntervalRejectionReson = 1) + + parent_obj = waitForObject(names.o_controlLeftColumn_Column) + systolic_BP_low = utility.findObjectById(parent_obj, "_systolicLowAlarmLimit") + parameter_text = waitForObject(systolic_BP_low) + parameter_text_color = parameter_text.border.color.name + test.compare(config.COLOR_CODES, parameter_text_color, "Systolic Low Alarm limit field color should be ' \red for' " + str(parameter_text_color)) + systolic_BP_High = utility.findObjectById(parent_obj, "_systolicHighAlarmLimit") + parameter_text = waitForObject(systolic_BP_High) + parameter_text_color = parameter_text.border.color.name + test.compare(config.COLOR_CODES, parameter_text_color, "Systolic High Alarm limit field color should be ' \red for' " + str(parameter_text_color)) + td.td_vitals_alarm_limits_adjustment_response( vAccepted = 1, + vSystolicBpLowAlarmLimitRejectionReson = 0, + vSystolicBpHighAlarmLimitRejectionReson = 0, + vHeartRateLowAlarmLimitRejectionReson = 0, + vHeartRateHighAlarmLimitRejectionReson = 0, + vVitalsIntervalRejectionReson = 0) + + vitalsettingspopup = waitFor(lambda: not object.exists(names.o_HeaderBar_WiFi_Popup), 3000) + test.compare(vitalsettingspopup, True, "Popup is not present") + test.endSection() def main(): utils.tstStart(__file__) @@ -647,11 +743,5 @@ check_saline_edit_maintreatment() check_treatement_edit_maintreatment() check_duration_edit_maintreatment() - utils.tstDone() - - - - - - - \ No newline at end of file + check_vitals_edit_maintreatment() + utils.tstDone() \ No newline at end of file