# Subject/Title: LDT -1220 Main Treatment Screen - SW - 02 - Screen Integration (MSG,QML) - Q&R - 15: SIT - Software Integration Tests - Squish Qt # # Functionalities: Testing all functionalities of main treatment screen # # Steps: # 1 Pressure Ranges: # - Set lower and upper bound for Arterial and test each limit # - Set lower and upper bound for Venous and test each limit # - Set lower and upper bound for trancememberance and test each limit # 2 Ultrafiltration # -Set lower and upper bound for UF Volume and test each limit # -Set lower and upper bound for UF Rate and test each limit # 3 TX time # -Test the TX time completed status and paused status # -Test the Ellapsed time and completed time # 4 Set Points for main treatement screen # -Set lower and upper bound for blood flow and test each limit # -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 import names from leahi_dialin.ui import utils from leahi_dialin.ui.td_messaging import TD_Messaging from leahi_dialin.ui.dd_messaging import DD_Messaging from configuration import utility from leahi_dialin.common.td_defs import TDOpModes,TDTreatmentStates ART_LOW_VAL_MINUS_390 = -390 ART_HIGH_VAL_220 = 220 VENOUS_LOW_VAL_MINUS_90 = -90 VENOUS_HIGH_VAL_410 = 410 TMP_LOW_VAL_MINUS_640 = -640 TMP_HIGH_VAL_210 = 210 REJECTED = 1 ACCEPTED = 0 total_time_list = [90,120] uf_filtration = [ {"uf_volume": 1, "uf_rate": 0.53, "vol_delivered": 0.37 }, {"uf_volume": 10, "uf_rate": 5.05, "vol_delivered": 2.37 }, {"uf_volume": 20, "uf_rate": 10.0, "vol_delivered": 5.0 }, {"uf_volume": 100,"uf_rate": 140.0,"vol_delivered": 156.0 }, {"uf_volume": 0, "uf_rate": 0.0, "vol_delivered": 0.0 } ] td = TD_Messaging() dd = DD_Messaging() 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 and Venous low and high value on main treatment screen @param accepted: (int) boolean accept/reject response @param arterial_low: (int) Arterial Pressure Limit Low (mmHg) @param arterial_high: (int) Arterial Pressure Limit High (mmHg) @param venous_low: (int) Venous Pressure Limit Low (mmHg) @param venous_high: (int) Venous Pressure Limit High (mmHg) @return: none """ test.startSection("Verifying Arterial low and high and Venous low and high value on main treatment screen") if accepted == ACCEPTED: arterial_rangeBar = utility.get_object_from_names(names.o_arterial_RangeBar, error_message="arterial rangeBar object is missing") arterial_low = arterial_rangeBar.lowerBound arterial_high = arterial_rangeBar.upperBound venous_rangeBar = utility.get_object_from_names(names.o_venous_RangeBar, error_message="venous rangeBar object is missing") venous_low = venous_rangeBar.lowerBound venous_high = venous_rangeBar.upperBound tmp_RangeBar = utility.get_object_from_names(names.o_tmp_RangeBar, error_message="trancememberance rangeBar object is missing") trancememberance_low = tmp_RangeBar.lowerBound trancememberance_high = tmp_RangeBar.upperBound test.compare(arterial_low, art_low, "Arterial low value should be '{}'".format(art_low)) test.compare(arterial_high, art_high, "Arterial high value should be '{}'".format(art_high)) test.compare(venous_low, ven_low, "Venous low value should be '{}'".format(ven_low)) test.compare(venous_high, ven_high, "Venous high value should not be '{}'".format(ven_high)) test.compare(trancememberance_low, tmp_low, "Trancememberance low value should be '{}'".format(tmp_low)) test.compare(trancememberance_high, tmp_high, "Trancememberance high value should not be '{}'".format(tmp_high)) else: if object.exists(pressure_text_obj(art_low)): test.fail("Arterial value {} should not exists".format(art_low)) if object.exists(pressure_text_obj(art_high)): test.fail("Arterial value {} should not exists".format(art_high)) if object.exists(pressure_text_obj(ven_low)): test.fail("Venous value {} should not exists".format(ven_low)) if object.exists(pressure_text_obj(ven_high)): test.fail("Venous value {} should not exists".format(ven_high)) if object.exists(pressure_text_obj(tmp_low)): test.fail("Trancememberance value {} should not exists".format(tmp_low)) if object.exists(pressure_text_obj(tmp_high)): test.fail("Trancememberance value {} should not exists".format(tmp_high)) test.endSection() def test_pressure_displayed_in_treatment_screen_range_bar(): TREATMENT_PRESSURE_ADJUSTMENT_TD_TEST_VALUES = [ { "arterial_pressure" : 100, "arterial_limit_low" : -300, "arterial_limit_high" : 120, "venous_pressure" : 140, "venous_limit_low" : -100, "venous_limit_high" : 250, "pressure_limit_state" : 2, "tmp_pressure" : 250 , "tmp_limit_low" : -400, "tmp_limit_high" : 200 }, { "arterial_pressure" : -200, "arterial_limit_low" : -150, "arterial_limit_high" : 120, "venous_pressure" : 140, "venous_limit_low" : -100, "venous_limit_high" : 250, "pressure_limit_state" : 2, "tmp_pressure" : 200 , "tmp_limit_low" : -300, "tmp_limit_high" : 200 }, { "arterial_pressure" : 110, "arterial_limit_low" : 100, "arterial_limit_high" : 120, "venous_pressure" : -100 ,"venous_limit_low" : -50, "venous_limit_high" : 250, "pressure_limit_state" : 2, "tmp_pressure" : 250 , "tmp_limit_low" : -200, "tmp_limit_high" : 400 }, { "arterial_pressure" : -130, "arterial_limit_low" : -140, "arterial_limit_high" : 120, "venous_pressure" : 200, "venous_limit_low" : -100, "venous_limit_high" : 150, "pressure_limit_state" : 2, "tmp_pressure" : 250 , "tmp_limit_low" : -100, "tmp_limit_high" : 600 }, ] for index in range(0, len(TREATMENT_PRESSURE_ADJUSTMENT_TD_TEST_VALUES), 1): test.startSection("Checking the value of the range bar in pressure on the treatment screen - dataset # {}".format(index)) target_arterial_pressure = TREATMENT_PRESSURE_ADJUSTMENT_TD_TEST_VALUES[index]["arterial_pressure"] target_venous_pressure = TREATMENT_PRESSURE_ADJUSTMENT_TD_TEST_VALUES[index]["venous_pressure"] target_pressure_state = TREATMENT_PRESSURE_ADJUSTMENT_TD_TEST_VALUES[index]["pressure_limit_state"] target_arterial_min_limit = TREATMENT_PRESSURE_ADJUSTMENT_TD_TEST_VALUES[index]["arterial_limit_low"] target_arterial_max_limit = TREATMENT_PRESSURE_ADJUSTMENT_TD_TEST_VALUES[index]["arterial_limit_high"] target_venous_min_limit = TREATMENT_PRESSURE_ADJUSTMENT_TD_TEST_VALUES[index]["venous_limit_low"] target_venous_max_limit = TREATMENT_PRESSURE_ADJUSTMENT_TD_TEST_VALUES[index]["venous_limit_high"] target_tmp_pressure = TREATMENT_PRESSURE_ADJUSTMENT_TD_TEST_VALUES[index]["tmp_pressure"] target_tmp_min_limit = TREATMENT_PRESSURE_ADJUSTMENT_TD_TEST_VALUES[index]["tmp_limit_low"] target_tmp_max_limit = TREATMENT_PRESSURE_ADJUSTMENT_TD_TEST_VALUES[index]["tmp_limit_high"] td.td_pressure( H2_arterial_pressure = target_arterial_pressure, H14_venous_pressure = target_venous_pressure, limit_state = target_pressure_state, H2_arterial_min = target_arterial_min_limit, H2_arterial_max = target_arterial_max_limit, H14_venous_min = target_venous_min_limit, H14_venous_max = target_venous_max_limit, H2_arterial_long = 0 , H14_venous_long = 0 , tmp_pressure = target_tmp_pressure, tmp_min = target_tmp_min_limit, tmp_max = target_tmp_max_limit) # check the range bar's upper and lower bounds arterial_rangeBar = waitForObjectExists(names.o_arterial_RangeBar) if arterial_rangeBar is not None: test.compare(arterial_rangeBar.lowerBound, target_arterial_min_limit, "Checking lower bound of arterial pressure range bar") test.compare(arterial_rangeBar.upperBound, target_arterial_max_limit, "Checking upper bound of arterial pressure range bar") #check the marker value for the arterial pressure arterial_rangeBar_marker_text_object = waitForObjectExists(names.o_arterial_RangeBar) if arterial_rangeBar_marker_text_object is not None: actual_text = str(arterial_rangeBar_marker_text_object.pressure) expected_text = str(target_arterial_pressure) test.compare(actual_text, expected_text, "Expecting arterial pressure to be displayed") # check the range bar's upper and lower bounds venous_rangeBar = waitForObjectExists(names.o_venous_RangeBar) if venous_rangeBar is not None: test.compare(venous_rangeBar.lowerBound, target_venous_min_limit, "Checking lower bound of venous pressure range bar") test.compare(venous_rangeBar.upperBound, target_venous_max_limit, "Checking upper bound of venous pressure range bar") #check the marker value for the venous pressure venous_rangeBar_marker_text_object = waitForObjectExists(names.o_venous_RangeBar) if venous_rangeBar_marker_text_object is not None: actual_text = str(venous_rangeBar_marker_text_object.pressure) expected_text = str(target_venous_pressure) test.compare(actual_text, expected_text, "Expecting venous pressure to be displayed") # check the range bar's upper and lower bounds tmp_rangeBar = waitForObjectExists(names.o_tmp_RangeBar) if tmp_rangeBar is not None: test.compare(tmp_rangeBar.lowerBound, target_tmp_min_limit, "Checking lower bound of trancememberance pressure range bar") test.compare(tmp_rangeBar.upperBound, target_tmp_max_limit, "Checking upper bound of trancememberance pressure range bar") #check the marker value for the trancememberance pressure tmp_rangeBar_marker_text_object = waitForObjectExists(names.o_tmp_RangeBar) if tmp_rangeBar_marker_text_object is not None: actual_text = str(tmp_rangeBar_marker_text_object.pressure) expected_text = str(target_tmp_pressure) test.compare(actual_text, expected_text, "Expecting trancememberance pressure to be displayed") test.endSection() #UltraFiltration state def verification_of_uf_from_main_treatment(): """ @return: N/A """ test.compare(utility.get_object_from_names(names.o_treatmentUltrafiltration).visible, True, "UltraFiltration section is visible") test.compare(waitForObjectExists(names.o_UF_Volume_Text).topText, "UF Volume", "UF Volume text verified") test.compare(waitForObjectExists(names.o_UF_Rate_Text).topText, "UF Rate", "UF Rate text verified") def start_test_treatment_ultrafiltration(uf_volume,uf_rate,vol_delivered): """ Test slider movement of UltraFiltration volume. @param ultrafiltration_range: (dictionary) uf minimum and uf maximum volume. @param uf_state: (int) UltraFiltration state to be set. @return: N/A """ td.td_ultrafiltration(uf_volume,uf_rate,vol_delivered,0) test.compare(utility.get_object_from_names(names.o_UF_Volume_LabelValue).bottomText, "{:.2f}".format(float(uf_volume)), "UF Volume value should be :" + str(uf_volume)) test.compare(utility.get_object_from_names(names.o_UF_Rate_LabelValue).bottomText, "{:.2f}".format(float(uf_rate)), "UF Rate value should be :" + str(uf_rate)) test.compare(utility.get_object_from_names(names.o_Volume_Delivered).text, "{:.2f}".format(float(vol_delivered)) +" L", "Volume delivered value should be :" + str(vol_delivered)) #TX time def start_treatment_time_verification(vTotal): """ Method to verify Actual time in seconds to Time appear on UI Screen in seconds. Also it compare the Progress bar value in seconds @param vTotal: (int) Total time in seconds """ for count in range(0,vTotal+1): td.td_treatment_time(vTotal, count, vTotal - count) test.compare(utility.get_object_from_names(names.o_treatment_duration).progressValue, count, "progress value should be {}".format(count)) test.compare(utility.get_object_from_names(names.o_treatment_duration).timeTextValue, vTotal - count, "Expected Time on UI should be in seconds {}".format(vTotal - count)) def reset_treatment_time_verification(vTotal): """ Method to reset and verify Actual time in seconds to Maximum & Minimum values on UI screen in seconds @param vTotal: (int) Total time in seconds """ td.td_treatment_time(vTotal, 0, vTotal) test.compare(utility.get_object_from_names(names.o_treatment_duration).maximum, vTotal, "Reset maximum value and compare it expected value {}".format(vTotal)) test.compare(utility.get_object_from_names(names.o_treatment_duration).minimum, 0, "Reset minimum value and compare it expected value {}".format(0)) def treatment_time_verification(total): test.startSection("Verify the seconds values inside Progress bar and on timer 'Time in seconds'") reset_treatment_time_verification(total) start_treatment_time_verification(total) test.endSection() #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": 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 test.compare(utility.get_object_from_names(names.o_blood_flow_title_Text).title, "Blood Flow", "Blood flow text verified" ) test.compare(utility.get_object_from_names(names.o_dialyste_flow_title_Text).title, "Dialysate Flow", "Dialysate Flow text verified" ) test.compare(utility.get_object_from_names(names.o_dialyste_tmp_title_Text).title, "Dialysate Temp.", "Dialysate trancememberance text verified" ) test.compare(utility.get_object_from_names(names.o_dialyste_cond_title_Text).title, "Dialysate Cond.", "Dialysate cond text verified" ) for index in range(0, len(TREATMENT_PARAMETER_SETPOINTS_TD_TEST_VALUES), 1): test.startSection("Checking the value of the set points".format(index)) target_blood_flow = TREATMENT_PARAMETER_SETPOINTS_TD_TEST_VALUES[index]["blood flow"] target_dial_flow = TREATMENT_PARAMETER_SETPOINTS_TD_TEST_VALUES[index]["dial flow"] target_dial_tmp = TREATMENT_PARAMETER_SETPOINTS_TD_TEST_VALUES[index]["dial tmp"] target_dial_cond = TREATMENT_PARAMETER_SETPOINTS_TD_TEST_VALUES[index]["dial cond"] td.td_treatment_set_points(blood_flow = target_blood_flow, dialysate_flow = target_dial_flow, dialysate_temp = target_dial_tmp) bloodFlow = utility.get_object_from_names(names.o_blood_flow_value) bloodFlow_properties = object.properties(bloodFlow) test.compare(str(bloodFlow_properties["value"]), str(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(str(dialFlow_properties["value"]), str(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)) dd.dd_conductivity(D17 = 0, D27 = 0, D29 = target_dial_cond, D43 = 0, D74 = 0) dialCond = utility.get_object_from_names(names.o_dial_cond_value) dialCond_properties = object.properties(dialCond) test.compare(str(dialCond_properties["value"]), str(target_dial_cond), "Dialyste conductivity value should be :" + str(target_dial_cond)) def main(): utils.tstStart(__file__) startApplication(names.AUT_NAME + " -q") 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_tx_state(TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value , 0 , 0 , 0 , 0 , 0 , 0 , 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() td.td_pressure(H2_arterial_pressure = 0, H14_venous_pressure = 0 , limit_state = 0, H2_arterial_min = ART_LOW_VAL_MINUS_390, H2_arterial_max = ART_HIGH_VAL_220 , H14_venous_min = VENOUS_LOW_VAL_MINUS_90 , H14_venous_max = VENOUS_HIGH_VAL_410 , H2_arterial_long = 0 , H14_venous_long = 0 , tmp_pressure = 0 , tmp_min = TMP_LOW_VAL_MINUS_640 , tmp_max = TMP_HIGH_VAL_210) verify_arterial_and_venous_value_in_main_treatment_screen(ACCEPTED,ART_LOW_VAL_MINUS_390,ART_HIGH_VAL_220,VENOUS_LOW_VAL_MINUS_90,VENOUS_HIGH_VAL_410,TMP_LOW_VAL_MINUS_640,TMP_HIGH_VAL_210) test.endSection() #UltraFiltration state test.startSection("Verifying Ultrafiltration values on main treatment screen") verification_of_uf_from_main_treatment() for value in uf_filtration: start_test_treatment_ultrafiltration(**value) test.endSection() #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(utility.get_object_from_names(names.o_treatmentTimeNotificationBarSmall).text, "Treatment Complete", "Tx time completed text should be :" + str("Treatment Complete")) td.td_treatment_time( tx_duration_s = 51 , tx_elapsed_s = 5 , tx_remaining_s = 6 ) td.td_tx_state(TDTreatmentStates.TREATMENT_PAUSED_STATE.value , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ) test.compare(utility.get_object_from_names(names.o_treatmentTimeNotificationBarSmall).text, "Treatment Paused", "Tx time paused text should be :" + str("Treatment Paused")) test.endSection() #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() utils.tstDone() test.endSection()