# Subject/Title: LDT -1456 Ultrafiltration - SW - 02 - Q&R - 15: SIT - Software Integration Tests - Squish Qt # # Functionalities: Testing all functionalities of ultra filtration in main treatment page # # Steps: # 1 Check min,max and mid values of UF Volume,UF rate and Volume delivered in main treatment page # 2 Click on edit icon and check the values UF Volume Removed and UF Volume Goal values in edit popup # 3 Check the Edit UF, Pause UF and Isolated UF button in the edit popup # 4 Click on the Edit Uf button and check ultrafiltration popup is displayed # 5 Check the UF Volume Removed and UF Volume Goal values in the popup # 6 Check the UF Volume Goal values in the popup # 7 Check the New UF Volume and New UF rate values in Confirm Ultrafiltration popup # 8 Check the back button functionality in the popup screen # 9 Check the rejection reason message in the popup screen import names from configuration import 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 msg_ids from leahi_dialin.utils import conversions td =TD_Messaging() MAX_UF_VOLUME = 10.00 MAX_UF_RATE = 10.00 MAX_VOLUME_DELIVERED = 8.00 MIN_UF_VOLUME = 0.35 MIN_UF_RATE = 0.22 MIN_VOLUME_DELIVERED = 0.09 MID_UF_VOLUME = 5.00 MID_UF_RATE = 5.00 MID_VOLUME_DELIVERED = 4.00 ULTRAFILTRATION_VOLUME = "Ultrafiltration Volume (L)" UF_VOLUME_REMOVED = "UF Volume Removed" UF_VOLUME_GOAL = "UF Volume Goal" NEW_UF_VOLUME = "New UF Volume" NEW_UF_RATE = "New UF Rate" REJECT_TEXT = "[1] Request is not allowed in the current operating mode" MAX_NEW_UF_VOLUME = 8.0 MAX_NEW_UF_RATE = 2.0 def get_title_text_obj(text): names.o_title_Text["text"] = text return names.o_title_Text def findObjectById(parent, id): """ Recursively searches for a child object by its id. Returns the found object or None if not found. """ if str(parent.id) == id: return parent for child in object.children(parent): found = findObjectById(child, id) if found: return found return None def set_value_based_on_target(obj, target_value): """ obj: dictionary containing object paths Example: { "value_obj": ":mainTreatmentScreen.PressureText", "left_arrow": ":mainTreatmentScreen.LeftArrow", "right_arrow": ":mainTreatmentScreen.RightArrow" } target_value: integer or string number, e.g. 220 """ target_value = target_value # Wait for all objects parent_obj = waitForObjectExists(obj) # change range as per your screen count left_arrow = findObjectById(parent_obj, "_leftArrow") right_arrow =findObjectById(parent_obj, "_rightArrow") # Read current value (supports invisible text too) try: current_value = round(float(findObject(obj).value),1) except LookupError: current_value = float(findObject(obj).property("value")) # Determine direction while current_value != float(target_value): if current_value < float(target_value): mouseClick(waitForObject(right_arrow)) elif current_value > float(target_value): mouseClick(waitForObject(left_arrow)) # Update current value after click try: current_value = round(float(findObject(obj).value),1) except Exception: current_value = float(findObject(obj).property("value")) test.log(f"Updated value: {current_value}") test.log(f"✅ Target value reached: {current_value}") def continue_edit_changes(accept,rejectionReason): payload = conversions.integer_to_bytearray(accept) payload += conversions.integer_to_bytearray(rejectionReason) payload += conversions.float_to_bytearray(0.32) payload += conversions.integer_to_bytearray(170) payload += conversions.integer_to_bytearray(119) payload += conversions.float_to_bytearray(0.04) payload += conversions.float_to_bytearray(0.14) payload += conversions.float_to_bytearray(0.12) td.cmd_send_general_response(message_id =msg_ids.MsgIds.MSG_ID_TD_RESP_ULTRAFILTRATION_VOLUME_TO_VALIDATE.value, accepted=1, reason=0, is_pure_data = False, has_parameters = True, parameters_payload= payload) def confirm_ultrafiltration_volume(): payload = conversions.integer_to_bytearray(1) payload += conversions.integer_to_bytearray(0) payload += conversions.float_to_bytearray(0.22) payload += conversions.integer_to_bytearray(19) payload += conversions.float_to_bytearray(0.33) td.cmd_send_general_response(message_id =msg_ids.MsgIds.MSG_ID_USER_UF_SETTINGS_CHANGE_CONFIRMATION_RESPONSE.value, accepted=1, reason=0, is_pure_data = False, has_parameters = True, parameters_payload= payload) def check_values_ultrfiltration_main_treatment(uf_volume,uf_rate,volume_delivered): td.td_ultrafiltration(set_volume = uf_volume , target_rate = uf_rate , volume_delivered = volume_delivered , state = 0 ) #Check the send the values test.compare(waitForObjectExists(names.o_uf_Volume_LabelValue).bottomText, "{:.2f}".format(float(uf_volume)), "UF Volume value should be :" + str(uf_volume)) test.compare(waitForObjectExists(names.o_uf_Rate_LabelValue).bottomText, "{:.2f}".format(float(uf_rate)), "UF Rate value should be :" + str(uf_rate)) test.compare(waitForObjectExists(names.o_volume_Delivered).text, "{:.2f}".format(float(volume_delivered)) +" L", "Volume delivered value should be :" + str(volume_delivered)) def main(): utils.tstStart(__file__) startApplication(names.AUT_NAME) td.td_operation_mode(TDOpModes.MODE_STAN.value) # verify Standby screen test.verify(waitForObjectExists(names.o_standByScreen_MainHome), "In Standby") td.td_operation_mode(TDOpModes.MODE_TPAR.value, 0) td.td_operation_mode(TDOpModes.MODE_TREA.value, 0) td.td_tx_state(TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0) td.td_param_ranges(min_tx_time_s = 0, max_tx_time_s = 0, min_uf_volume_mL = 0.0, max_uf_volume_mL = 1790, min_dial_rate_mLH = 0, max_dial_rate_mLH = 0) test.startSection("Check the maximum values in Ultra filtration") check_values_ultrfiltration_main_treatment(uf_volume = MAX_UF_VOLUME, uf_rate = MAX_UF_RATE, volume_delivered = MAX_VOLUME_DELIVERED) test.endSection() test.startSection("Check the mid values in Ultra filtration") check_values_ultrfiltration_main_treatment(uf_volume = MID_UF_VOLUME, uf_rate = MID_UF_RATE, volume_delivered = MID_VOLUME_DELIVERED) test.endSection() test.startSection("Check the minimum values in Ultra filtration") check_values_ultrfiltration_main_treatment(uf_volume = MIN_UF_VOLUME, uf_rate = MIN_UF_RATE, volume_delivered = MIN_VOLUME_DELIVERED) test.endSection() test.startSection("Check the values in the Ultrafiltration Volume Popup") mouseClick(waitForObject(names.o_editButton_ultrafiltration_IconButton)) #check the tittle in edit popup title = waitForObjectExists(get_title_text_obj(ULTRAFILTRATION_VOLUME)) test.compare(title.text, ULTRAFILTRATION_VOLUME, "Title text should be -> "+ str(ULTRAFILTRATION_VOLUME)) #check the value in the edit popup uf_volume_removed_text = waitForObjectExists(names.o_ufVolumeRemovedItem_ValueItem).label test.compare(uf_volume_removed_text,UF_VOLUME_REMOVED ,"Text Value should be ->" +str(UF_VOLUME_REMOVED)) uf_volume_removed_value = waitForObjectExists(names.o_ufVolumeRemovedItem_ValueItem).value test.compare(str(uf_volume_removed_value), str(MIN_VOLUME_DELIVERED), "UF Volume Removed value should be ->"+str(uf_volume_removed_value)) uf_volume_goal_text =waitForObjectExists(names.o_ufVolumeGoalItem_ValueItem).label test.compare(uf_volume_goal_text,UF_VOLUME_GOAL ,"Text Value should be ->" +str(UF_VOLUME_GOAL)) uf_volume_goal_value = waitForObjectExists(names.o_ufVolumeGoalItem_ValueItem).value test.compare(str(uf_volume_goal_value), str(MIN_UF_VOLUME), "UF Volume Removed value should be ->"+str(uf_volume_goal_value)) test.endSection() test.startSection("Check the values in the Confirm Ultrafiltration Volume Popup ") #edit the popup mouseClick(waitForObject(names.o_editButton_TouchRect)) mouseClick(waitForObject(names.o_backButton_BackButton)) test.verify(waitForObjectExists(names.o_editButton_TouchRect).visible,"Edit button is visible") mouseClick(waitForObject(names.o_editButton_TouchRect)) set_value_based_on_target(names.o_volumeGoalAdjuster_ValueAdjuster, 1.50) mouseClick(waitForObject(names.o_continueButton_TouchRect)) continue_edit_changes(accept = 1, rejectionReason = 0) #check the values in the confirm ultrafiltration volume confirm_ultrafiltrationtitle = waitForObjectExists(get_title_text_obj("Confirm Ultrafiltration Volume (L)")) test.compare(confirm_ultrafiltrationtitle.text, "Confirm Ultrafiltration Volume (L)", "Title text should be -> "+ str("Confirm Ultrafiltration Volume (L)")) new_uf_volume_text = waitForObjectExists(names.o_newVolumeContainer_ValueContainer).text test.compare(new_uf_volume_text,NEW_UF_VOLUME ,"Text Value should be ->" +str(NEW_UF_VOLUME)) new_uf_rate_text = waitForObjectExists(names.o_newRateContainer_ValueContainer).text test.compare(new_uf_rate_text,NEW_UF_RATE ,"Text Value should be ->" +str(NEW_UF_RATE)) new_uf_volume_value = waitForObjectExists(names.o_newRateContainer_ValueContainer).value test.compare(new_uf_volume_value, "0.04","Text Value should be ->" +str("0.04")) #click on the continue button mouseClick(waitForObject(names.o_confirmButton_TouchRect)) #perform the continue button confirm_ultrafiltration_volume() test.verify(waitForObjectExists(names.mainTreatmentScreen), "In Main Treatment") test.endSection() mouseClick(waitForObject(names.o_editButton_ultrafiltration_IconButton)) continue_edit_changes(accept = 0, rejectionReason = 1) reject_text = waitForObject(names.o_notificationBar_NotificationBarSmall).text test.compare(reject_text,REJECT_TEXT,"Text should be ->" +str(REJECT_TEXT)) utils.tstDone()