# Subject/Title: LDT-3210 Isolated UF - SW - 02 - Q&R - 15: SIT - Software Integration Tests - Squish Qt # # Functionalities: Testing all functionalities of Isolated UF in main treatment page # # Steps: # 1. Navigate to Main Treatment and Perform the edit button on the Ultrafiltration area # 2. Press the Isolated UF button and check the following # a. Check the values in the popup # b. Change the value in the slider # 3. Mouse click on Continue button # a.Check FW receives request with the correct value # 1.Test rejection status # 2.Test no rejection status # 4. Navigate to the next screen change the Isolated UF VOlume goal # a.Verify values updated in the screen # b.Verify Progress bar values # c,Verify minimum range and maximum range # 1. Minimum has to be greater than Volume removed # 2. Max has to be the set Volume Goal max set responded from FW # 5.Mouse click on Continue button # a.Verify Volume Goal Change request is received by FW with values # 1..Test Rejection status # 2. Test no rejection with response from fw # a. Verify FW sends Volume goal, Duration, Rate values to the UI # 6. Mouse click on the Confirm button # a.Confirm values sent from FW are shown on UI # 7. Navigate to the next page # a.Verify FW gets request with values # b.Test Rejection status # c.Test no rejection and verify the popup is closed import names import can from configuration import config,utility from leahi_dialin.ui import utils from leahi_dialin.ui.td_messaging import TD_Messaging from leahi_dialin.common.td_defs import TDOpModes,TDTreatmentStates from leahi_dialin.common import MsgIds,MsgFieldPositions from leahi_dialin.protocols import CAN from leahi_dialin.utils import conversions from configuration.getrejectiontext import ScopedRejectionRepository td =TD_Messaging() can_interface = td.can_interface isolatedufdurationrequest = None isolatedvolumerequest = None confirmrequest = "0" def handle_isolated_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 isolatedufdurationrequest isolatedufdurationrequest = state def handle_isolated_volume_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 isolatedvolumerequest isolatedvolumerequest = state def handle_confirm_isolated_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.integer_to_bytearray( message, index) global confirmrequest confirmrequest = str(state) def main(): utils.tstStart(__file__) conf_path = "/home/denali/Public/luis/config/configurations/Alarms/Rejections.conf" repo = ScopedRejectionRepository(path=conf_path) startApplication(config.AUT_NAME) td.td_operation_mode(TDOpModes.MODE_STAN.value) td.td_tx_state(TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0) td.td_ultrafiltration(set_volume = 1.36 , target_rate = 0.30, volume_delivered = 0.39 , state = 0 ) mouseClick(waitForObject(names.o_editButton_ultrafiltration_IconButton)) test.startSection("Verify the values in the Isolated UF page") td.td_isolated_uf( duration = 143 , set_volume = 1957 , volume_delivered = 936 , rate = 115 ) mouseClick(waitForObject(names.o_isolatedUfButton_TouchRect)) test.log("Check the values in the Isolated UF Page") isolated_uf_volume_removed = waitForObject(names.o_treatmentAdjustmentIsolatedUFDurationEdit) isolated_uf_volume_removed =utility.findObjectById(isolated_uf_volume_removed, "_left") test.compare(isolated_uf_volume_removed.label, config.ISOLATED_UF_VOLUME_REMOVED, "Isolated Uf Volume removed label text should be"+str(isolated_uf_volume_removed.label)) test.compare(isolated_uf_volume_removed.value,"0.94","Isolated Uf Volume removed value text should be"+str(isolated_uf_volume_removed.value)) isolated_uf_volume_goal = waitForObject(names.o_treatmentAdjustmentIsolatedUFDurationEdit) isolated_uf_volume_goal = utility.findObjectById(isolated_uf_volume_goal, "_right") test.compare(isolated_uf_volume_goal.label,config.ISOLATED_UF_VOLUME_GOAL,"Isolated Uf Volume goal label text should be"+str(isolated_uf_volume_goal.label)) test.compare(isolated_uf_volume_goal.value,"1.96","Isolated Uf Volume goal label text should be"+str(isolated_uf_volume_goal.value)) utility.set_value_based_on_target(names.o_valueAdjuster_ValueAdjuster, 90) mouseClick(waitForObject(names.o_continueButton_TouchRect)) if can_interface is not None: channel_id = CAN.DenaliChannels.ui_to_td_ch_id message_id = MsgIds.MSG_ID_UI_ISOLATED_UF_DURATION_CHANGE_REQUEST.value can_interface.register_receiving_publication_function(channel_id, message_id, handle_isolated_duration_request) test.verify(waitFor( lambda: isolatedufdurationrequest == 90, 3000), "Testing FW -> Check the Isolated Uf duration Request") td.td_isolated_uf_duration_change_response(vRejectionReason = 13, vVolumeMax = 0 ) reject_text = waitForObject(names.o_notificationBar_NotificationBarSmall).text REJECT_TEXT = repo.get("13", "Title") test.compare(reject_text,"[13] "+REJECT_TEXT ,"Text should be ->" +str(REJECT_TEXT)) test.endSection() test.startSection("Verify the values Isolated Ultra filtration Volume page") td.td_isolated_uf_duration_change_response(vRejectionReason = 0, vVolumeMax = 2826 ) isolated_uf_volume_removed = waitForObject(names.o_treatmentAdjustmentIsolatedUFVolumeEdit) isolated_uf_volume_removed =utility.findObjectById(isolated_uf_volume_removed,"_left") test.compare(isolated_uf_volume_removed.value,"0.94","Isolated volume removed value should be"+str(isolated_uf_volume_removed.value)) progress_bar = waitForObject(names.o_treatmentAdjustmentIsolatedUFVolumeEdit) progress_bar =utility.findObjectById(progress_bar,"_volumeProgress") test.verify(progress_bar.visible, "Progress bar is visible") isolated_uf_volume_goal = waitForObject(names.o_volumeAdjuster_LabelUnitValueAdjuster) utility.set_value_with_slider(names.o_valueAdjuster_ValueAdjuster_2,names.o_PreTreatmentCreate_volumeAdjuster_slider_Slider, "Isolated UF Volume Goal") test.log("Verify the minimum and maximum range") utility.set_value_based_on_target(names.o_valueAdjuster_ValueAdjuster_2,1) isolated_uf_volume_goal_value = waitForObject(names.o_valueAdjuster_ValueAdjuster_2) test.log(str(isolated_uf_volume_goal_value.value)) utility.set_value_based_on_target(names.o_valueAdjuster_ValueAdjuster_2,2.80) isolated_uf_volume_goal_value = waitForObject(names.o_valueAdjuster_ValueAdjuster_2) test.log(str(isolated_uf_volume_goal_value.value)) test.log("Click on the continue button") continueButton = waitForObject(names.o_treatmentAdjustmentIsolatedUFVolumeEdit) continueButton =utility.findObjectById(continueButton,"_continueButton") mouseClick(waitForObject(continueButton)) if can_interface is not None: channel_id = CAN.DenaliChannels.ui_to_td_ch_id message_id = MsgIds.MSG_ID_UI_ISOLATED_UF_VOLUME_GOAL_CHANGE_REQUEST.value can_interface.register_receiving_publication_function(channel_id, message_id, handle_isolated_volume_request) test.verify(waitFor( lambda: isolatedvolumerequest == 90, 2000), "Testing FW received Arterial Window Value") test.log("Test the rejection reason 1") td.td_isolated_uf_volume_change_response(vRejectionReason= 13, vVolume= 2300, vDuration= 546, vRate= 175) reject_text = waitForObject(names.o_notificationBar_NotificationBarSmall).text REJECT_TEXT = repo.get("13", "Title") test.compare(reject_text,"[13] "+REJECT_TEXT ,"Text should be ->" +str(REJECT_TEXT)) td.td_isolated_uf_volume_change_response(vRejectionReason= 0, vVolume= 2300, vDuration= 546, vRate= 175) test.endSection() test.startSection("Verify the values in the confirm isolated ultrafiltration pages") isolated_uf_volume = waitForObject(names.o_volumeGoal_LabelUnitText) test.compare(str(isolated_uf_volume.value),"2.30","Isolated Uf volume goal value should be"+str(isolated_uf_volume.value)) isolated_uf_duration = waitForObject(names.o_duration_LabelUnitText) test.compare(str(isolated_uf_duration.value),"546","Isolated UF duration value should be"+str(isolated_uf_duration.value)) isolated_uf_rate = waitForObject(names.o_rate_LabelUnitText) test.compare(str(isolated_uf_rate.value),"0.17","Isolated UF rate value should be"+str(isolated_uf_rate.value)) waitForObject(names.o_confirmButton_TouchRect,2000) mouseClick(waitForObject(names.o_confirmButton_TouchRect)) if can_interface is not None: channel_id = CAN.DenaliChannels.ui_to_td_ch_id message_id = MsgIds.MSG_ID_UI_ISOLATED_UF_CONFIRM_REQUEST.value can_interface.register_receiving_publication_function(channel_id, message_id, handle_confirm_isolated_request) test.verify(waitFor("'confirmrequest == 1'", 5000), "Testing UI -> TD message confirm request") td.td_isolated_uf_confirm_response(vRejectionReason= 13) reject_text = waitForObject(names.o_notificationBar_NotificationBarSmall).text REJECT_TEXT = repo.get("13", "Title") test.compare(reject_text,"[13] "+REJECT_TEXT ,"Text should be ->" +str(REJECT_TEXT)) td.td_isolated_uf_confirm_response(vRejectionReason = 0) confirmpopup = waitFor(lambda: not object.exists(names.o_HeaderBar_WiFi_Popup), 3000) test.compare(confirmpopup, True, "Popup is not present") test.endSection() utils.tstDone()