# Subject/Title: Service - SW - 02 - Institutional - Q&R # # Functionalities: Testing items of Service Institutional feature # # Steps: # 1 Start Leahi Application and simulate TD standby mode and navigate to the Device Settings screen # Navigate to Institutional Configuration screen and compare Title bar text, Verifying the values sent # over reflect on the UI and click Back button # 2 Navigate to Service screen, Enter Password and Click confirm Then Navigate to # Advanced Institutional Settings Screen and compare Title bar text, Verifying the values sent # over reflect on the UI, compare rejection reason and click Back button, navigate back to # Advanced Institutional Settings Screen, Adjust values compare rejection reason and and click confirm # then Compare Advanced Institutional Settings records and preferences updated Notification Text # 3 Navigate to Advanced Institutional Settings Screen and Adjust Values, compare rejection reason # and click confirm then Compare Advanced Institutional Settings records and preferences updated Notification Text # then Compare Advanced Institutional Settings records and preferences Notification Text and click Back button # 4 Navigate to Institutional Configurations Screen and Adjust Values # and click Confirm button then Compare Institutional Configurations records and preferences updated Notification Text # then Compare Advanced Institutional Settings records and preferences Notification Text # 5 Navigate to Institutional Configurations Screen and Adjust Blood Flow Values # and click Confirm button then Compare Institutional Configurations records and preferences updated Notification Text # then Compare Advanced Institutional Settings records and preferences Notification Text and compare rejection reason # Verify Default, Minimum and Maximum Blood Flow value in Create Rx Screen import names import re from configuration import config, utility, navigation, application_init from leahi_dialin.ui import utils from leahi_dialin.ui.td_messaging import TD_Messaging from leahi_dialin.common.td_defs import TDOpModes, TDStandbyStates td_simulator = TD_Messaging() INSTITUTIONAL_CONFIGURATIONS = { "vBloodFlowMin": 80, "vBloodFlowMax": 210, "vBloodFlowDef": 130, "vDialysateFlowMin": 50, "vDialysateFlowMax": 600, "vDialysateFlowDef": 50, "vTxDurationMin": 60, "vTxDurationMax": 480, "vTxDurationDef": 60, "vHepBolVolumeMin": 0.2, "vHepBolVolumeMax": 1.0, "vHepBolVolumeDef": 0.1, "vHepDispRateMin": 0.2, "vHepDispRateMax": 3.0, "vHepDispRateDef": 0.1, "vHepStopTimeMin": 15, "vHepStopTimeMax": 480, "vDialysateTempMin": 35.00, "vDialysateTempMax": 38.00, "vDialysateTempDef": 37.00, "vPotassiumMin": 0.00, "vPotassiumMax": 4.00, "vCalciumMin": 0.00, "vCalciumMax": 3.50, "DialysateBicarbMin": 130, "DialysateBicarbMax": 155, "DialysateBicarbDef": 137, "SodiumBicarbMin": 20, "SodiumBicarbMax": 40, "SodiumBicarbDef": 33, "vFluidBolusMin": 100, "vFluidBolusMax": 300, "vFluidBolusDef": 100, "vArtPressLimitWindowMin": 120, "vArtPressLimitWindowMax": 200, "vArtPressLimitWindowDef": 120, "vVenPressLimitWindowMin": 100, "vVenPressLimitWindowMax": 200, "vVenPressLimitWindowDef": 100, "vVenAsymLimitWindowMin": 20, "vVenAsymLimitWindowMax": 35, "vVenAsymLimitWindowDef": 20, "vTMPPressLimitWindowMin": 40, "vTMPPressLimitWindowMax": 100, "vTMPPressLimitWindowDef": 40, "vUltrafiltrationVolumeMin": 0.00, "vUltrafiltrationVolumeMax": 0.80, "vUltrafiltrationVolumeDef": 0.00, "vVitalsIntervalDef": 5, "RinsebackVolumeMin": 200, "RinsebackVolumeMax": 400, "RinsebackVolumeDef": 300, "RinsebackFlowRateMin": 100, "RinsebackFlowRateMax": 500, "RinsebackFlowRateDef": 200, "vSubstitutionVolumeMin": 1.00, "vSubstitutionVolumeMax": 30.00, "vSubstitutionVolumeDef": 1.00, } EXPECTED_VALUES_PER_ROW = [ {"vBloodFlowMin": 80, "vBloodFlowMax": 210, "vBloodFlowDef": 130}, {"vDialysateFlowMin": 50, "vDialysateFlowMax": 600, "vDialysateFlowDef": 50}, {"vTxDurationMin": 60, "vTxDurationMax": 480, "vTxDurationDef": 60}, {"vHepBolVolumeMin": 0.2, "vHepBolVolumeMax": 1.0, "vHepBolVolumeDef": 0.1}, {"vHepDispRateMin": 0.2, "vHepDispRateMax": 3.0, "vHepDispRateDef": 0.1}, {"vHepStopTimeMin": 15, "vHepStopTimeMax": 480}, {"vDialysateTempMin": 35.0, "vDialysateTempMax": 38.0, "vDialysateTempDef": 37.0}, {"vPotassiumMin": 0.0, "vPotassiumMax": 4.0}, {"vCalciumMin": "0.00", "vCalciumMax": "3.50"}, {"DialysateBicarbMin": 130, "DialysateBicarbMax": 155, "DialysateBicarbDef": 137}, {"SodiumBicarbMin": 20, "SodiumBicarbMax": 40, "SodiumBicarbDef": 33}, {"vFluidBolusMin": 100, "vFluidBolusMax": 300, "vFluidBolusDef": 100}, {"vArtPressLimitWindowMin": 120, "vArtPressLimitWindowMax": 200, "vArtPressLimitWindowDef": 120}, {"vVenPressLimitWindowMin": 100, "vVenPressLimitWindowMax": 200, "vVenPressLimitWindowDef": 100}, {"vVenAsymLimitWindowMin": 20, "vVenAsymLimitWindowMax": 35, "vVenAsymLimitWindowDef": 20}, {"vTMPPressLimitWindowMin": 40, "vTMPPressLimitWindowMax": 100, "vTMPPressLimitWindowDef": 40}, {"vUltrafiltrationVolumeMin": 0.00, "vUltrafiltrationVolumeMax": 0.80, "vUltrafiltrationVolumeDef": 0.00}, {"vVitalsIntervalDef": 5}, {"RinsebackVolumeMin": 200, "RinsebackVolumeMax": 400, "RinsebackVolumeDef": 300}, {"RinsebackFlowRateMin": 100, "RinsebackFlowRateMax": 500, "RinsebackFlowRateDef": 200}, {"vSubstitutionVolumeMin": 1.00, "vSubstitutionVolumeMax": 30.00, "vSubstitutionVolumeDef": 1.00} ] ADVANCED_INSTITUTIONAL_SETTINGS = { 'vMinRORejectionRatioAlarmMin': 1, 'vMinRORejectionRatioAlarmMax': 10, 'vMinRORejectionRatioAlarmDef': 5, 'vDisinfectionFrequencyMin': 1, 'vDisinfectionFrequencyMax': 5, 'vDisinfectionFrequencyDef': 3, 'vDisinfectionParametersCycleTimeMin': 1, 'vDisinfectionParametersCycleTimeMax': 60, 'vDisinfectionParametersCycleTimeDef': 60, 'vMaxBloodPumpStopTimeMin': 5, 'vMaxBloodPumpStopTimeMax': 30, 'vMaxBloodPumpStopTimeDef': 5, 'vInletWaterCondLowThresholdMin': 20, 'vInletWaterCondLowThresholdMax': 200, 'vInletWaterCondLowThresholdDef': 200, 'vInletWaterCondHighThresholdMin': 50, 'vInletWaterCondHighThresholdMax': 200, 'vInletWaterCondHighThresholdDef': 50, 'vChlorineWaterSampleCheckMin': 15, 'vChlorineWaterSampleCheckMax': 480, 'vChlorineWaterSampleCheckDef': 140, 'vWaterSampleTestResultRequiredDef': 1, } ADVANCED_INSTITUTIONAL_SETTINGS_PER_ROW = [ {'vMinRORejectionRatioAlarmMin': 1, 'vMinRORejectionRatioAlarmMax': 10, 'vMinRORejectionRatioAlarmDef': 5}, {'vDisinfectionFrequencyMin': 1, 'vDisinfectionFrequencyMax': 5, 'vDisinfectionFrequencyDef': 3}, {'vDisinfectionParametersCycleTimeMin': 1, 'vDisinfectionParametersCycleTimeMax': 60, 'vDisinfectionParametersCycleTimeDef': 60}, {'vMaxBloodPumpStopTimeMin': 5, 'vMaxBloodPumpStopTimeMax': 30, 'vMaxBloodPumpStopTimeDef': 5}, {'vInletWaterCondLowThresholdMin': 20, 'vInletWaterCondLowThresholdMax': 200, 'vInletWaterCondLowThresholdDef': 200}, {'vInletWaterCondHighThresholdMin': 50, 'vInletWaterCondHighThresholdMax': 200, 'vInletWaterCondHighThresholdDef': 50}, {'vChlorineWaterSampleCheckMin': 15, 'vChlorineWaterSampleCheckMax': 480, 'vChlorineWaterSampleCheckDef': 140}, {'vWaterSampleTestResultRequiredDef': 0} ] ADJUST_INSTITUTIONAL_RECORDS_REJECTION_REASONS = { "vBloodFlowMinReason": 1, "vBloodFlowMaxReason": 1, "vBloodFlowDefReason": 1, "vDialysateFlowMinReason": 0, "vDialysateFlowMaxReason": 0, "vDialysateFlowDefReason": 0, "vTreatmentDurationMinReason": 0, "vTreatmentDurationMaxReason": 0, "vTreatmentDurationDefReason": 0, "vHepBolusVolumeMinReason": 0, "vHepBolusVolumeMaxReason": 0, "vHepBolusVolumeDefReason": 0, "vHepDispRateMinReason": 0, "vHepDispRateMaxReason": 0, "vHepDispRateDefReason": 0, "vHepStopTimeMinReason": 0, "vHepStopTimeMaxReason": 0, "vDialysateTempMinReason": 0, "vDialysateTempMaxReason": 0, "vDialysateTempDefReason": 0, "vPotassiumMinReason": 0, "vPotassiumMaxReason": 0, "vCalciumMinReason": 0, "vCalciumMaxReason": 0, "vDialysateBicarbMinReason": 0, "vDialysateBicarbMaxReason": 0, "vDialysateBicarbDefReason": 0, "vSodiumBicarbMinReason": 0, "vSodiumBicarbMaxReason": 0, "vSodiumBicarbDefReason": 0, "vFluidBolusVolumeMinReason": 0, "vFluidBolusVolumeMaxReason": 0, "vFluidBolusVolumeDefReason": 0, "vArterialPressureMinReason": 0, "vArterialPressureMaxReason": 0, "vArterialPressureDefReason": 0, "vVenousPressureMinReason": 0, "vVenousPressureMaxReason": 0, "vVenousPressureDefReason": 0, "vVenousAsymmetricMinReason": 0, "vVenousAsymmetricMaxReason": 0, "vVenousAsymmetricDefReason": 0, "vTmpPressureMinReason": 0, "vTmpPressureMaxReason": 0, "vTmpPressureDefReason": 0, "vUfVolumeMinReason": 0, "vUfVolumeMaxReason": 0, "vUfVolumeDefReason": 0, "vVitalsIntervalReason": 0, "vRincebackVolumeMinReason": 0, "vRincebackVolumeMaxReason": 0, "vRincebackVolumeDefReason": 0, "vRincebackFlowRateMinReason": 0, "vRincebackFlowRateMaxReason": 0, "vRincebackFlowRateDefReason": 0, "vSubVolumeMinReason": 0, "vSubVolumeMaxReason": 0, "vSubVolumeDefReason": 0 } ADJUST_ADVANCED_INSTITUTIONAL_SETTINGS_REJECTION_REASONS = { "vMinRORejectionRatioAlarmMaxRejectionReason": 1, "vMinRORejectionRatioAlarmMinRejectionReason": 1, "vMinRORejectionRatioAlarmDefRejectionReason": 1, "vDisinfectionFrequencyMinRejectionReason": 0, "vDisinfectionFrequencyMaxRejectionReason": 0, "vDisinfectionFrequencyDefRejectionReason": 0, "vDisinfectionParametersCycleTimeMinRejectionReason": 0, "vDisinfectionParametersCycleTimeMaxRejectionReason": 0, "vDisinfectionParametersCycleTimeDefRejectionReason": 0, "vMaxBloodPumpStopTimeMinRejectionReason": 0, "vMaxBloodPumpStopTimeMaxRejectionReason": 0, "vMaxBloodPumpStopTimeDefRejectionReason": 0, "vInletWaterCondLowThresholdMinRejectionReason": 0, "vInletWaterCondLowThresholdMaxRejectionReason": 0, "vInletWaterCondLowThresholdDefRejectionReason": 0, "vInletWaterCondHighThresholdMinRejectionReason": 0, "vInletWaterCondHighThresholdMaxRejectionReason": 0, "vInletWaterCondHighThresholdDefRejectionReason": 0, "vChlorineWaterSampleCheckMinRejectionReason": 0, "vChlorineWaterSampleCheckMaxRejectionReason": 0, "vChlorineWaterSampleCheckDefRejectionReason": 0, "vWaterSampleTestResultRequiredDefRejectionReason": 0 } ADVANCED_INSTITUTIONAL_SETTINGS_PARAMETER_RANGE = { "vMinRORejectionRatioAlarmMin" : [2], "vMinRORejectionRatioAlarmMax" : [8], "vMinRORejectionRatioAlarmDef" : [3], } MINIMUM_RO_REJECTION_RATIO_ALARM_MIN = "vMinRORejectionRatioAlarmMin" MINIMUM_RO_REJECTION_RATIO_ALARM_MAX = "vMinRORejectionRatioAlarmMax" MINIMUM_RO_REJECTION_RATIO_ALARM_DEF = "vMinRORejectionRatioAlarmDef" INSTITUTIONAL_CONFIGURATIONS_PARAMETER_RANGE = { "vBloodFlowMin": [60], "vBloodFlowMax": [180], "vBloodFlowDef": [160], } INSTITUTIONAL_CONFIGURATIONS_BLOOD_FLOW_CUSTOM_RANGE = { "vBloodFlowMin": [100], "vBloodFlowMax": [200], "vBloodFlowDef": [150], } BLOOD_FLOW_RATE_MIN = "vBloodFlowMin" BLOOD_FLOW_RATE_MAX = "vBloodFlowMax" BLOOD_FLOW_RATE_DEF = "vBloodFlowDef" INSTITUTIONAL_CONFIGURATIONS_BLOOD_FLOW_CUSTOM_VALUES = { "vBloodFlowMin": 100, "vBloodFlowMax": 200, "vBloodFlowDef": 150, } def institutional_configurations_screen(): """ Navigate to Institutional Configuration screen and compare Title bar text, Verifying the values sent over reflect on the UI and click Back button and Verifying rejection reasons """ test.startSection("Navigating to 'Institutional Configurations' Screen") device_settings_grid = waitForObject(names.o_DeviceSettingsGrid) mouseClick(utility.findChildByText(device_settings_grid, config.INSTITUTIONAL_CONFIGURATIONS)) institutional_headerbar = waitForObject(names.o_headerBar_HeaderBar, 2000) institutional_configurations_screen_headerbar_title_text = utility.findChildByText( institutional_headerbar, config.INSTITUTIONAL_CONFIGURATIONS_SCREEN_TITLE_TEXT ) if institutional_configurations_screen_headerbar_title_text is not None: test.compare( institutional_configurations_screen_headerbar_title_text.text, config.INSTITUTIONAL_CONFIGURATIONS_SCREEN_TITLE_TEXT, "{} screen is displayed and Comparison of Institutional Configurations Screen Title text".format( config.INSTITUTIONAL_CONFIGURATIONS_SCREEN_TITLE_TEXT ), ) td_simulator.td_institutional_response( vRejectionReason=1, **INSTITUTIONAL_CONFIGURATIONS ) total_rows = 21 rows_per_scroll = 13 verified_count = 0 for row_index in range(0, 13): row_object = utility.get_row_object( names.o_SettingsBase_SettingsInstitutionalRecord, row_index ) bullet_children = object.children(waitForObject(row_object)) expected_values = EXPECTED_VALUES_PER_ROW[row_index] # Using zip() to iterate through children and the row's expected items for bullet_child, (key, expected_value) in zip( bullet_children, expected_values.items() ): value = utility.findObjectById(bullet_child, "_text") if value: # Format both values to handle decimal precision actual_text = str(value.text) expected_text = str(expected_value) actual_float = float(actual_text) expected_float = float(expected_text) # Format to 2 decimal places for comparison test.compare( f"{actual_float:.2f}", f"{expected_float:.2f}", f"Comparison of Institutional Configurations '{key}' in Row {row_index + 1}", ) verified_count += 1 # Scroll after 13 rows if (row_index + 1) % rows_per_scroll == 0 and (row_index + 1) < total_rows: test.log(f"Scrolling after row {row_index + 1}") flick(waitForObject(names.o_SettingsInstitutionalRecord_ListView), 0, 943) snooze(1) break expected_values_counter = 13 for index in range(6,14): row_object = utility.get_row_object( names.o_SettingsBase_SettingsInstitutionalRecord, index ) bullet_children = object.children(waitForObject(row_object)) expected_values = EXPECTED_VALUES_PER_ROW[expected_values_counter] # Using zip() to iterate through children and the row's expected items for bullet_child, (key, expected_value) in zip( bullet_children, expected_values.items() ): value = utility.findObjectById(bullet_child, "_text") if value: # Format both values to handle decimal precision actual_text = str(value.text) expected_text = str(expected_value) actual_float = float(actual_text) expected_float = float(expected_text) # Format to 2 decimal places for comparison test.compare( f"{actual_float:.2f}", f"{expected_float:.2f}", f"Comparison of Institutional Configurations '{key}' in Row {index + 1}", ) verified_count += 1 expected_values_counter +=1 test.log(f"Verified {verified_count} out of {total_rows} rows") flick(waitForObject(names.o_SettingsInstitutionalRecord_ListView), 0, -943) snooze(1) for rejection_reason in range(1, 60): td_simulator.td_institutional_response( vRejectionReason=rejection_reason, **INSTITUTIONAL_CONFIGURATIONS ) institutional_reject_notification = utility.get_object_from_names( names.o_SettingsInstitutionalRecord_NotificationBar ) institutional_reject_notification_text = str(institutional_reject_notification.text) digit = re.sub(r'^.*?\[(\d+)\].*$', r'\1', institutional_reject_notification_text) if digit: digit_int = int(float(digit)) test.compare(rejection_reason, digit_int, f"Rejection reason number comparison for reason {rejection_reason}") test.log(f"Rejection reason text is {institutional_reject_notification_text}") mouseClick(utility.get_object_from_names(names.o_SettingsInstitutionalRecord_BackButton)) test.endSection() def advanced_institutional_configurations_screen(): """ Navigate to Advanced Institutional Settings Screen and compare Title bar text, Verifying the values sent over reflect on the UI, compare rejection reason and click Back button, navigate back toAdvanced Institutional Settings Screen, Adjust values compare rejection reason and and click confirm """ test.startSection("Navigating to 'Advanced Institutional Settings' Screen") navigation.navigate_to_device_settings_using_service_password() device_settings_grid = waitForObject(names.o_DeviceSettingsGrid, 2000) mouseClick(utility.findChildByText(device_settings_grid, config.ADVANCED_INSTITUTIONAL_SETTINGS)) advanced_institutional_headerbar = waitForObject(names.o_headerBar_HeaderBar, 2000) advanced_institutional_settings_screen_headerbar_title_text = ( utility.findChildByText(advanced_institutional_headerbar, config.ADVANCED_INSTITUTIONAL_SETTINGS_SCREEN_TITLE_TEXT) ) if advanced_institutional_settings_screen_headerbar_title_text is not None: test.compare( advanced_institutional_settings_screen_headerbar_title_text.text, config.ADVANCED_INSTITUTIONAL_SETTINGS_SCREEN_TITLE_TEXT, "{} screen is displayed and Comparison of Advanced Institutional Settings Screen Title text".format( config.ADVANCED_INSTITUTIONAL_SETTINGS_SCREEN_TITLE_TEXT ), ) td_simulator.td_advanced_institutional_response( vRejectionReason=0, **ADVANCED_INSTITUTIONAL_SETTINGS ) for row_index in range(0, 7): row_object = utility.get_row_object( names.o_SettingsBase_SettingsAdvancedInstitutional, row_index ) bullet_children = object.children(waitForObject(row_object)) # Get expected values for this specific row if row_index < len(ADVANCED_INSTITUTIONAL_SETTINGS_PER_ROW): expected_values = ADVANCED_INSTITUTIONAL_SETTINGS_PER_ROW[row_index] else: expected_values = ADVANCED_INSTITUTIONAL_SETTINGS # Using zip() to iterate through children and the row's expected items for bullet_child, (key, expected_value) in zip( bullet_children, expected_values.items() ): value = utility.findObjectById(bullet_child, "_text") if value: test.compare( str(value.text), str(expected_value), f"Comparison of Heparin Prescription '{key}' in Row {row_index}", ) td_simulator.td_advanced_institutional_response( vRejectionReason=1, **ADVANCED_INSTITUTIONAL_SETTINGS ) advanced_reject_notification = utility.get_object_from_names( names.o_SettingsAdvancedInstitutional_Notification ) advanced_reject_notification_text = str(advanced_reject_notification.text) digit = re.sub(r"^.*?\[(\d+)\].*$", r"\1", advanced_reject_notification_text) if digit: digit_int = int(float(digit)) test.compare(1, digit_int, f"Rejection reason number comparison for reason {1}") test.log(f"Rejection reason text is {advanced_reject_notification_text}") mouseClick(utility.get_object_from_names(names.o_SettingsAdvancedInstitutional_BackButton)) mouseClick(utility.findChildByText(device_settings_grid, config.ADVANCED_INSTITUTIONAL_SETTINGS)) td_simulator.td_advanced_institutional_response( vRejectionReason=2, **ADVANCED_INSTITUTIONAL_SETTINGS ) advanced_reject_notification = utility.get_object_from_names( names.o_SettingsAdvancedInstitutional_Notification ) advanced_reject_notification_text = str(advanced_reject_notification.text) digit = re.sub(r"^.*?\[(\d+)\].*$", r"\1", advanced_reject_notification_text) if digit: digit_int = int(float(digit)) test.compare(2, digit_int, f"Rejection reason number comparison for reason {2}") test.log(f"Rejection reason text is {advanced_reject_notification_text}") td_simulator.td_Adjust_Advanced_Institutional_Records( vAccepted = 1, **ADJUST_ADVANCED_INSTITUTIONAL_SETTINGS_REJECTION_REASONS ) mouseClick(utility.get_object_from_names(names.o_SettingsAdvancedInstitutional_ConfirmButton)) advanced_confirm_notification = utility.get_object_from_names( names.o_SettingsAdvancedInstitutional_Notification ) test.compare( advanced_confirm_notification.text, config.ADVANCED_INSTITUTIONAL_SETTINGS_NOTIFICATION_TEXT, f"Confirm Advanced Institutional Settings Notification Text", ) mouseClick(utility.get_object_from_names(names.o_SettingsAdvancedInstitutional_BackButton)) test.endSection() def adjust_advanced_institutional_configurations_values(): """ Navigate to Institutional Configurations Screen and Adjust Values and click Confirm button then Compare Institutional Configurations records and preferences updated Notification Text then Compare Advanced Institutional Settings records and preferences Notification Text """ test.startSection("Navigating to 'Advanced Institutional Settings' Values Adjust") device_settings_grid = waitForObject(names.o_DeviceSettingsGrid, 2000) mouseClick(utility.findChildByText(device_settings_grid, config.ADVANCED_INSTITUTIONAL_SETTINGS)) for ( minimum_ro_rejection_ratio_alarm ) in ADVANCED_INSTITUTIONAL_SETTINGS_PARAMETER_RANGE[ MINIMUM_RO_REJECTION_RATIO_ALARM_DEF ]: utility.set_value_based_on_target( names.o_SettingsAdvancedInstitutional_def_ValueAdjuster, minimum_ro_rejection_ratio_alarm ) for ( minimum_ro_rejection_ratio_alarm ) in ADVANCED_INSTITUTIONAL_SETTINGS_PARAMETER_RANGE[ MINIMUM_RO_REJECTION_RATIO_ALARM_MAX ]: utility.set_value_based_on_target( names.o_SettingsAdvancedInstitutional_max_ValueAdjuster, minimum_ro_rejection_ratio_alarm ) for ( minimum_ro_rejection_ratio_alarm ) in ADVANCED_INSTITUTIONAL_SETTINGS_PARAMETER_RANGE[ MINIMUM_RO_REJECTION_RATIO_ALARM_MIN ]: utility.set_value_based_on_target( names.o_SettingsAdvancedInstitutional_min_ValueAdjuster, minimum_ro_rejection_ratio_alarm ) mouseClick(utility.get_object_from_names(names.o_SettingsAdvancedInstitutional_ConfirmButton)) advanced_confirm_notification = utility.get_object_from_names( names.o_SettingsAdvancedInstitutional_Notification ) test.compare( advanced_confirm_notification.text, config.ADVANCED_INSTITUTIONAL_SETTINGS_NOTIFICATION_TEXT, f"Confirm Advanced Institutional Settings Notification Text", ) td_simulator.td_Adjust_Advanced_Institutional_Records(vAccepted = 0, **ADJUST_ADVANCED_INSTITUTIONAL_SETTINGS_REJECTION_REASONS ) mouseClick(utility.get_object_from_names(names.o_SettingsAdvancedInstitutional_ConfirmButton)) advanced_confirm_notification = utility.get_object_from_names( names.o_SettingsAdvancedInstitutional_Notification, timeout_ms=3000 ) test.compare( advanced_confirm_notification.text, config.ERROR_ADVANCED_INSTITUTIONAL_SETTINGS_NOTIFICATION_TEXT, f"Confirm Advanced Institutional Settings Error Notification Text", ) mouseClick(utility.get_object_from_names(names.o_SettingsAdvancedInstitutional_BackButton)) test.endSection() def adjust_institutional_configurations_values(): """ Navigate to Advanced Institutional Settings Screen and Adjust Values, compare rejection reason and click confirm then Compare Advanced Institutional Settings records and preferences updated Notification Text then Compare Advanced Institutional Settings records and preferences Notification Text and click Back button """ test.startSection("Navigating to 'Institutional Settings' And Adjust Values") device_settings_grid = waitForObject(names.o_DeviceSettingsGrid) mouseClick(utility.findChildByText(device_settings_grid, config.INSTITUTIONAL_CONFIGURATIONS)) institutional_headerbar = waitForObject(names.o_headerBar_HeaderBar, 2000) institutional_configurations_screen_headerbar_title_text = utility.findChildByText( institutional_headerbar, config.INSTITUTIONAL_CONFIGURATIONS_SCREEN_TITLE_TEXT ) if institutional_configurations_screen_headerbar_title_text is not None: test.compare( institutional_configurations_screen_headerbar_title_text.text, config.INSTITUTIONAL_CONFIGURATIONS_SCREEN_TITLE_TEXT, "{} screen is displayed and Comparison of Institutional Configurations Screen Title text".format( config.INSTITUTIONAL_CONFIGURATIONS_SCREEN_TITLE_TEXT ), ) td_simulator.td_institutional_response( vRejectionReason=0, **INSTITUTIONAL_CONFIGURATIONS ) for ( blood_flow_rate_default ) in INSTITUTIONAL_CONFIGURATIONS_PARAMETER_RANGE[BLOOD_FLOW_RATE_DEF]: utility.set_value_based_on_target( names.o_SettingsInstitutional_def_ValueAdjuster, blood_flow_rate_default ) for ( blood_flow_rate_minimum ) in INSTITUTIONAL_CONFIGURATIONS_PARAMETER_RANGE[BLOOD_FLOW_RATE_MIN]: utility.set_value_based_on_target( names.o_SettingsInstitutional_min_ValueAdjuster, blood_flow_rate_minimum ) for ( blood_flow_rate_maximum ) in INSTITUTIONAL_CONFIGURATIONS_PARAMETER_RANGE[BLOOD_FLOW_RATE_MAX]: utility.set_value_based_on_target( names.o_SettingsInstitutional_max_ValueAdjuster, blood_flow_rate_maximum ) td_simulator.td_Adjust_Institutional_Records(vAccepted = 1, **ADJUST_INSTITUTIONAL_RECORDS_REJECTION_REASONS ) mouseClick(utility.get_object_from_names(names.o_SettingsInstitutional_ConfirmButton)) institutional_confirm_notification = utility.get_object_from_names( names.o_SettingsInstitutionalRecord_NotificationBar ) test.compare( institutional_confirm_notification.text, config.INSTITUTIONAL_SETTINGS_NOTIFICATION_TEXT, f"Confirm Institutional Configurations Notification Text", ) td_simulator.td_Adjust_Institutional_Records(vAccepted = 0, **ADJUST_INSTITUTIONAL_RECORDS_REJECTION_REASONS ) mouseClick(utility.get_object_from_names(names.o_SettingsInstitutional_ConfirmButton)) institutional_confirm_notification = utility.get_object_from_names( names.o_SettingsInstitutionalRecord_NotificationBar ) test.compare( institutional_confirm_notification.text, config.ERROR_INSTITUTIONAL_SETTINGS_NOTIFICATION_TEXT, f"Confirm Institutional Configurations Error Notification Text", ) mouseClick(utility.get_object_from_names(names.o_SettingsInstitutionalRecord_BackButton)) test.endSection() def adjust_blood_flow_of_institutional_configurations(): """ Navigate to Institutional Configurations Screen and Adjust Blood Flow Values and click Confirm button then Compare Institutional Configurations records and preferences updated Notification Text then Compare Advanced Institutional Settings records and preferences Notification Text and compare rejection reason """ test.startSection( "Navigating to 'Institutional Settings' Adjust Values and Verify it Create Rx Screen" ) device_settings_grid = waitForObject(names.o_DeviceSettingsGrid) mouseClick(utility.findChildByText(device_settings_grid, config.INSTITUTIONAL_CONFIGURATIONS)) td_simulator.td_institutional_response( vRejectionReason=1, **INSTITUTIONAL_CONFIGURATIONS ) for ( blood_flow_rate_default ) in INSTITUTIONAL_CONFIGURATIONS_BLOOD_FLOW_CUSTOM_RANGE[BLOOD_FLOW_RATE_DEF]: utility.set_value_based_on_target( names.o_SettingsInstitutional_def_ValueAdjuster, blood_flow_rate_default ) for ( blood_flow_rate_maximum ) in INSTITUTIONAL_CONFIGURATIONS_BLOOD_FLOW_CUSTOM_RANGE[BLOOD_FLOW_RATE_MAX]: utility.set_value_based_on_target( names.o_SettingsInstitutional_max_ValueAdjuster, blood_flow_rate_maximum ) for ( blood_flow_rate_minimum ) in INSTITUTIONAL_CONFIGURATIONS_BLOOD_FLOW_CUSTOM_RANGE[BLOOD_FLOW_RATE_MIN]: utility.set_value_based_on_target( names.o_SettingsInstitutional_min_ValueAdjuster, blood_flow_rate_minimum ) td_simulator.td_Adjust_Institutional_Records( **ADJUST_INSTITUTIONAL_RECORDS_REJECTION_REASONS ) mouseClick(utility.get_object_from_names(names.o_SettingsInstitutional_ConfirmButton)) institutional_confirm_notification = utility.get_object_from_names( names.o_SettingsInstitutionalRecord_NotificationBar ) test.compare( institutional_confirm_notification.text, config.INSTITUTIONAL_SETTINGS_NOTIFICATION_TEXT, f"Confirm Institutional Configurations Notification Text", ) combined_configs = {**INSTITUTIONAL_CONFIGURATIONS, **INSTITUTIONAL_CONFIGURATIONS_BLOOD_FLOW_CUSTOM_VALUES} td_simulator.td_institutional_response(vRejectionReason=0, **combined_configs) mouseClick(utility.get_object_from_names(names.o_SettingsInstitutionalRecord_BackButton)) main_menu_container = waitForObject(names.o_mainMenu_MainMenu, 2000) mouseClick(utility.findChildByText(main_menu_container, config.PRESCRIPTIONS)) mouseClick(utility.findChildByText(main_menu_container, config.TREATMENT)) mouseClick(waitForObject(names.o_createTreatmentRect_TouchRect, 2000)) td_simulator.td_operation_mode(TDOpModes.MODE_PRET.value) td_simulator.td_blood_set_auto_load_response(vRejectionReason = 0) navigation.navigation_pageIndicator_step(config.CREATERX) mouseClick(waitForObject(names.o_PreTreatmentCreate_pretreatmentPatientIDEntry_TextEntry, 2000)) waitForObject(names.o_PreTreatmentCreate_pretreatmentPatientIDEntry_TextEntry, 2000).text ="1234" mouseClick(waitForObjectExists(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster, 2000)) parent_obj = waitForObjectExists(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster, 2000) default_value = utility.findObjectById(parent_obj, "_text") test.compare( str(default_value.text), '150', "Comparison of Default Blood Flow Value", ) utility.set_value_based_on_target(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster, 100) left_arrow = findObject(names.o_PreTreatmentCreate_leftArrow_IconButton) if not left_arrow.enabled: parent_obj = waitForObjectExists(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster, 2000) minimum_value = utility.findObjectById(parent_obj, "_text") test.compare( str(minimum_value.text), '100', "Comparison of Default Blood Flow Value", ) utility.set_value_based_on_target(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster, 200) right_arrow = findObject(names.o_PreTreatmentCreate_rightArrow_IconButton) if not right_arrow.enabled: parent_obj = waitForObject(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster, 2000) maxmum_value = utility.findObjectById(parent_obj, "_text") test.compare( str(maxmum_value.text), '200', "Comparison of Default Blood Flow Value", ) test.endSection() def main(): utils.tstStart(__file__) startApplication(utility.aut("-q")) navigation.navigate_to_device_settings_screen() institutional_configurations_screen() advanced_institutional_configurations_screen() adjust_advanced_institutional_configurations_values() adjust_institutional_configurations_values() adjust_blood_flow_of_institutional_configurations()