Index: suite_leahi/shared/scripts/names.py =================================================================== diff -u -r5242b0f3bde261dff5670b39bdb263f084d237b6 -r56599f7ae0abe203a89be48e5694396d274969c8 --- suite_leahi/shared/scripts/names.py (.../names.py) (revision 5242b0f3bde261dff5670b39bdb263f084d237b6) +++ suite_leahi/shared/scripts/names.py (.../names.py) (revision 56599f7ae0abe203a89be48e5694396d274969c8) @@ -38,7 +38,8 @@ o_dialyste_flow_title_Text = {"container": mainTreatmentScreen, "objectName": "dialysateFlowComponent", "type": "TreatmentFlowsComponent" } o_dialyste_tmp_title_Text = {"container": mainTreatmentScreen, "id": "_dialysateTemp", "objectName": "dialysateTempComponent", "type": "TreatmentFlowsComponent" } o_dialyste_cond_title_Text = {"container": mainTreatmentScreen, "id": "_dialysateCond", "objectName": "dialysateCondComponent", "type": "TreatmentFlowsComponent" } - +o_treatmentHome_iconImage_Image_main = {"container": mainTreatmentScreen, "id": "_iconImage", "source": "qrc:/images/iPause", "type": "Image", "unnamed": 1 } +o_treatmentHome_vitals_IconButton = {"container": mainTreatmentScreen, "id": "_vitals", "type": "IconButton", "unnamed": 1,"visible":True} o_newTreatmentDuration_ValueAdjuster = {"container": o_Overlay, "objectName": "_valueAdjuster", "type": "ValueAdjuster", } o_newTreatmentDuration = {"container": o_Overlay, "objectName": "_newTreatmentDuration", "type": "LabelUnitText", } o_Popup_CloseButton = {"container": o_Overlay, "id": "_closeButton", "type": "CloseButton", "unnamed": 1 } @@ -470,7 +471,7 @@ o_dialysateFlowRate_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_dialysateFlowRate", "type": "LabelUnitValueAdjuster" } o_bloodFlowRate_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_bloodFlowRate", "type": "LabelUnitValueAdjuster" } o_dialysateTemperature_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_dialysateTemperature", "type": "LabelUnitValueAdjuster" } -o_treatmentHome_notification_NotificationBarSmall = {"container": mainTreatmentScreen, "objectName": "_notification", "type": "NotificationBarSmall" } +o_treatmentHome_notification_NotificationBarSmall = {"container": mainTreatmentScreen, "objectName": "notification", "type": "NotificationBarSmall" } o_ufVolumeRemoved_LabelUnitText = {"container": o_Overlay, "objectName": "_ufVolumeRemoved", "type": "LabelUnitText" } o_ufVolumeGoal_LabelUnitText = {"container": o_Overlay, "objectName": "_ufVolumeGoal", "type": "LabelUnitText" } o_timeElapsed_LabelUnitText = {"container": o_Overlay, "objectName": "_timeElapsed", "type": "LabelUnitText" } Index: suite_leahi/tst_main_treatment/test.py =================================================================== diff -u -r14b4280d72f6b236cb2e2c3902e2dea5e10270be -r56599f7ae0abe203a89be48e5694396d274969c8 --- suite_leahi/tst_main_treatment/test.py (.../test.py) (revision 14b4280d72f6b236cb2e2c3902e2dea5e10270be) +++ suite_leahi/tst_main_treatment/test.py (.../test.py) (revision 56599f7ae0abe203a89be48e5694396d274969c8) @@ -1,5 +1,5 @@ # Subject/Title: LDT -1220 Main Treatment Screen - SW - 02 - Screen Integration (MSG,QML) - Q&R - 15: SIT - Software Integration Tests - Squish Qt -# +# LDT - 3816 SW Misc & Enhc - SW - 02 - Usability Requests - Q&R - 15: SIT - Software Integration Tests - Squish Qt # Functionalities: Testing all functionalities of main treatment screen # # Steps: @@ -18,18 +18,30 @@ # -Set lower and upper bound for dialysate temp and test each limit # -Set lower and upper bound for dialysate flow and test each limit # -Set lower and upper bound for dialysate cond and test each limit +# 5 Test new UF pause/resume button +# - Click on pause button +# - Check FW gets pause request +# - Check the UF state to paused +# - Click on resume button +# - Check FW gets pause request +# +# 6 Test new vitals measurement button +# - Click on heart icon in Vitals component in main treatment +# - confirm FW gets request + import names +import can -from leahi_dialin.ui import utils + +from leahi_dialin.ui import utils +from leahi_dialin.protocols import CAN from leahi_dialin.ui.td_messaging import TD_Messaging from leahi_dialin.ui.dd_messaging import DD_Messaging -from configuration import utility, config -from leahi_dialin.common.td_defs import TDOpModes,TDTreatmentStates -from leahi_dialin.common.ui_defs import TXStates +from configuration import utility +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 + ART_LOW_VAL_MINUS_390 = -390 ART_HIGH_VAL_220 = 220 VENOUS_LOW_VAL_MINUS_90 = -90 @@ -49,22 +61,10 @@ td = TD_Messaging() dd = DD_Messaging() -can_interface = td.can_interface -newTreatmentDuration = None +can_interface = td.can_interface +pauseresumerequest = "-1" -def handle_new_treatment_duration_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 newTreatmentDuration - newTreatmentDuration = state - def verify_arterial_and_venous_value_in_main_treatment_screen(accepted, art_low, art_high, ven_low, ven_high,tmp_low,tmp_high): """ Method to verify Arterial low and high @@ -159,12 +159,12 @@ H14_venous_max = target_venous_max_limit, H2_arterial_long = 0 , H14_venous_long = 0 , - tmp_pressure = target_tmp_pressure, + tmp_pressure = target_tmp_pressure, tmp_long = 0.0, tmp_min = target_tmp_min_limit, tmp_max = target_tmp_max_limit, barometric = 0.0) - + # check the range bar's upper and lower bounds arterial_rangeBar = waitForObjectExists(names.o_arterial_RangeBar) if arterial_rangeBar is not None: @@ -260,11 +260,11 @@ #TX Parameter set points def verify_setPoints_from_main_treatement(): TREATMENT_PARAMETER_SETPOINTS_TD_TEST_VALUES = [ - {"blood flow": 56, "dial flow": 22, "dial tmp": 20.0, "dial cond": 100.0 }, - {"blood flow": 99, "dial flow": 78, "dial tmp": 87.0, "dial cond": 200.0 }, - {"blood flow": 34, "dial flow": 99, "dial tmp": 99.0, "dial cond": 300.0 }, - {"blood flow": 100, "dial flow": 100,"dial tmp": 100.0,"dial cond": 400.0}, - {"blood flow": 110, "dial flow": 110,"dial tmp": 110.0,"dial cond": 500.0} + {"blood flow": 56, "dial flow": 22, "dial tmp": 20.0, "dial cond": 34.0 }, + {"blood flow": 99, "dial flow": 78, "dial tmp": 87.0, "dial cond": 55.0 }, + {"blood flow": 34, "dial flow": 99, "dial tmp": 99.0, "dial cond": 99.0 }, + {"blood flow": 100, "dial flow": 100,"dial tmp": 100.0,"dial cond": 100.0}, + {"blood flow": 110, "dial flow": 110,"dial tmp": 110.0,"dial cond": 110.0} ] #Verify the title values in the set points @@ -287,15 +287,15 @@ bloodFlow = utility.get_object_from_names(names.o_blood_flow_value) bloodFlow_properties = object.properties(bloodFlow) - test.compare(bloodFlow_properties["value"], target_blood_flow, "Blood Flow value should be :" + str(target_blood_flow)) + test.compare(float(bloodFlow_properties["value"]), float(target_blood_flow), "Blood Flow value should be :" + str(target_blood_flow)) dialFlow = utility.get_object_from_names(names.o_dial_flow_value) dialFlow_properties = object.properties(dialFlow) - test.compare(dialFlow_properties["value"], target_dial_flow, "Dialyste flow value should be :" + str(target_dial_flow)) + test.compare(float(dialFlow_properties["value"]), float(target_dial_flow), "Dialyste flow value should be :" + str(target_dial_flow)) dialTmp = utility.get_object_from_names(names.o_dial_tmp_value) dialTmp_properties = object.properties(dialTmp) - test.compare(str(dialTmp_properties["value"]), str(target_dial_tmp), "Dialyste Tmp value should be :" + str(target_dial_tmp)) + test.compare(float(dialTmp_properties["value"]), float(target_dial_tmp), "Dialyste Tmp value should be :" + str(target_dial_tmp)) dd.dd_conductivity(D17 = 0, D27 = target_dial_cond, @@ -308,65 +308,34 @@ 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 edit_treatment_duration(): +def handle_pause_resume_request( message, timestamp = 0.0): """ - Verifying New Treatment Duration in Main Treatment Screen + Called when the user requests to firmware from UI + @return: None """ - td.td_treatment_time(tx_duration_s=51, tx_elapsed_s=5, tx_remaining_s=6) - td.td_ultrafiltration(10, 0.53, 0.37, 0) - - td.td_param_ranges( - min_tx_time_s=50, - max_tx_time_s=300, - min_uf_volume_mL=0.0, - max_uf_volume_mL=1790, - min_dial_rate_mLH=0, - max_dial_rate_mLH=0, - ) - - treatmentEdit = waitForObject(names.o_treatment_duration) - treatmentEditbutton = utility.findObjectById(treatmentEdit, "_editTimeIcon") - mouseClick(treatmentEditbutton) - if can_interface is not None: - channel_id = CAN.CanChannels.ui_to_td_ch_id - message_id = MsgIds.MSG_ID_UI_DURATION_VALIDATE_REQUEST.value - can_interface.register_receiving_publication_function( - channel_id, message_id, handle_new_treatment_duration_request - ) - utility.set_value_based_on_target(names.o_newTreatmentDuration_ValueAdjuster, 60) - mouseClick(waitForObject(names.o_continueButton_TouchRect, 3000)) - test.verify( - waitFor(lambda: newTreatmentDuration == 60, 5000), - "Verifying FW received New Treatment Duration", - ) + message = message['message'] + index = MsgFieldPositions.START_POS_FIELD_1 + state,index = conversions.bytearray_to_integer( message, index) + global pauseresumerequest + pauseresumerequest = state - td.td_duration_validate_response(0, 60, 0, 0, 0) - parent_object = waitForObject(names.o_newTreatmentDuration, 3000) - newTreatmentDuration_value_object = utility.findObjectById(parent_object, "_value") - test.log(f"New Treatment Duration value: {str(newTreatmentDuration_value_object.text)}") - - parent_object = waitForObject(names.o_ufVolumeGoal, 3000) - ufVolumeGoal_value_object = utility.findObjectById(parent_object, "_value") - test.log(f"UF Volume Goal value: {str(ufVolumeGoal_value_object.text)}") - - parent_object = waitForObject(names.o_ufRate, 3000) - ufRate_value_object = utility.findObjectById(parent_object, "_value") - test.log(f"New UF Rate value: {str(ufRate_value_object.text)}") - - mouseClick(waitForObject(names.o_confirmButton_TouchRect, 3000)) - mouseClick(waitForObject(names.o_Popup_CloseButton, 3000)) - def main(): utils.tstStart(__file__) - startApplication(config.AUT_NAME_ONLY + " -q") - + 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_TREA.value, 0 ) + td.td_operation_mode( TDOpModes.MODE_PRET.value, 0 ) td.td_tx_state(TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value , 0 , 0 , @@ -377,10 +346,10 @@ 0 , 0 , 0) - + # verify main treatment screen test.verify(waitForObjectExists(names.mainTreatmentScreen), "In Main Treatment") - + # Pressure State test.startSection("Verifying Pressure values on main treatment screen") test_pressure_displayed_in_treatment_screen_range_bar() @@ -393,8 +362,8 @@ H14_venous_max = VENOUS_HIGH_VAL_410 , H2_arterial_long = 0 , H14_venous_long = 0 , - tmp_pressure = 0 , - tmp_long = 0.0, + tmp_pressure = 0 , + tmp_long = 0.0 , tmp_min = TMP_LOW_VAL_MINUS_640 , tmp_max = TMP_HIGH_VAL_210, barometric = 0.0) @@ -409,12 +378,41 @@ start_test_treatment_ultrafiltration(**value) test.endSection() + #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") + 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 ") + 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) + + test.verify(waitFor(" 'pauseresumerequest == 1'", 3000), "Testing FW received Request 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")) td.td_treatment_time( tx_duration_s = 51 , tx_elapsed_s = 5 , @@ -435,10 +433,6 @@ #TX Parameter Set Points test.startSection("Verifying blood flow, dialysate temp,dialysate flow and dialyste cond on main treatment screen") verify_setPoints_from_main_treatement() - test.endSection() - test.startSection("Verifying New Treatment Duration in Main Treatment Screen") - edit_treatment_duration() - test.endSection() - utils.tstDone() + test.endSection() \ No newline at end of file