# 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 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': 99, 'vMinRORejectionRatioAlarmDef': 90, '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, } ADVANCED_INSTITUTIONAL_SETTINGS_PER_ROW = [ {'vMinRORejectionRatioAlarmMin': 1, 'vMinRORejectionRatioAlarmMax': 99, 'vMinRORejectionRatioAlarmDef': 90}, {'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 = { "vAccepted": 1, "vBloodFlowMinReason": 0, "vBloodFlowMaxReason": 0, "vBloodFlowDefReason": 0, "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 = { "vAccepted": 0, "vMinRORejectionRatioAlarmMaxRejectionReason": 0, "vMinRORejectionRatioAlarmMinRejectionReason": 0, "vMinRORejectionRatioAlarmDefRejectionReason": 0, "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" : [0], "vMinRORejectionRatioAlarmMax" : [0], "vMinRORejectionRatioAlarmDef" : [0], } 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" def scroll_to_next_rows(): """ Scroll down to view next set of rows using flick gesture """ try: # Use flick gesture to scroll down flick(waitForObject(names.o_SettingsBase_listView_ListView), 0, 943) # Wait for scroll to complete and content to load snooze(1) return True except Exception as e: test.log(f"Scroll failed: {str(e)}") return False def institutional_configurations_screen(): test.startSection("Navigating to 'Institutional Configurations' Screen") grid_container = waitForObject(names.o_DeviceSettingsGrid, 2000) institutional_configurations_option = utility.findChildByText( grid_container, "Institutional Configurations" ) if institutional_configurations_option is not None: mouseClick(institutional_configurations_option) headerbar_container = waitForObject(names.o_headerBar_HeaderBar, 2000) institutional_configurations_screen_headerbar_title_text = utility.findChildByText( headerbar_container, "Institutional Configurations" ) 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 = 12 rows_per_scroll = 12 verified_count = 0 for row_index in range(0, total_rows): row_object = utility.get_row_object( names.o_SettingsBase_SettingsInstitutionalRecord, row_index ) bullet_children = object.children(waitForObject(row_object)) if row_index < len(EXPECTED_VALUES_PER_ROW): expected_values = EXPECTED_VALUES_PER_ROW[row_index] else: expected_values = INSTITUTIONAL_CONFIGURATIONS # fallback # 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) # If both are numeric, format to same decimal places try: 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}", ) except ValueError: # If not numeric, compare as strings test.compare( actual_text, expected_text, f"Comparison of Heparin Prescription '{key}' in Row {row_index + 1}", ) verified_count += 1 # Scroll after every 12 rows (0-11, then scroll, then 12-23, etc.) if (row_index + 1) % rows_per_scroll == 0 and (row_index + 1) < total_rows: test.log(f"Scrolling after row {row_index + 1}") if not scroll_to_next_rows(): test.log("Failed to scroll, stopping verification") break else: test.log("Scroll completed, continuing with next batch") test.log(f"Verified {verified_count} out of {total_rows} rows") back_button = utility.get_object_from_names( names.o_SettingsInstitutionalRecord_BackButton, "Error Missing Back Button", 2000, ) if back_button is not None: mouseClick(back_button) test.endSection() def advanced_institutional_configurations_screen(): test.startSection("Navigating to 'Advanced Institutional Settings' Screen") navigation.navigate_to_device_settings_using_service_password() grid_container = waitForObject(names.o_DeviceSettingsGrid, 2000) advanced_modes_option = utility.findChildByText( grid_container, "Advanced Institutional Settings" ) if advanced_modes_option is not None: mouseClick(advanced_modes_option) headerbar_container = waitForObject(names.o_headerBar_HeaderBar, 2000) advanced_institutional_settings_screen_headerbar_title_text = ( utility.findChildByText(headerbar_container, "Advanced Institutional Settings") ) 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=1, **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 # fallback # 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}", ) advanced_reject_notification = utility.get_object_from_names( names.o_SettingsAdvancedInstitutional_Notification, timeout_ms=3000 ) 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}") back_button = utility.get_object_from_names( names.o_SettingsAdvancedInstitutional_BackButton, "Error Missing Back Button", 2000, ) if back_button is not None: mouseClick(back_button) grid_container = waitForObject(names.o_DeviceSettingsGrid, 2000) advanced_modes_option = utility.findChildByText( grid_container, "Advanced Institutional Settings" ) td_simulator.td_advanced_institutional_response( vRejectionReason=2, **ADVANCED_INSTITUTIONAL_SETTINGS ) if advanced_modes_option is not None: mouseClick(advanced_modes_option) advanced_reject_notification = utility.get_object_from_names( names.o_SettingsAdvancedInstitutional_Notification, timeout_ms=3000 ) 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}") confirm_button = utility.get_object_from_names( names.o_SettingsBase_confirmButton_ConfirmButton, "Error Missing Confirm Button", 2000, ) td_simulator.td_Adjust_Advanced_Institutional_Records( **ADJUST_ADVANCED_INSTITUTIONAL_SETTINGS_REJECTION_REASONS ) if confirm_button is not None: mouseClick(confirm_button) advanced_confirm_notification = utility.get_object_from_names( names.o_SettingsAdvancedInstitutional_Notification, timeout_ms=3000 ) test.compare( advanced_confirm_notification.text, config.ADVANCED_INSTITUTIONAL_SETTINGS_NOTIFICATION_TEXT, f"Confirm Advanced Institutional Settings Notification Text", ) back_button = utility.get_object_from_names( names.o_SettingsAdvancedInstitutional_BackButton, "Error Missing Back Button", 2000, ) if back_button is not None: mouseClick(back_button) test.endSection() def adjust_advanced_institutional_configurations_values(): test.startSection("Navigating to 'Advanced Institutional Settings' Values Adjust") grid_container = waitForObject(names.o_DeviceSettingsGrid, 2000) advanced_modes_option = utility.findChildByText( grid_container, "Advanced Institutional Settings" ) if advanced_modes_option is not None: mouseClick(advanced_modes_option) td_simulator.td_advanced_institutional_response( vRejectionReason=2, **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_SettingsBase_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_SettingsBase_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_SettingsBase_min_ValueAdjuster, minimum_ro_rejection_ratio_alarm ) advanced_reject_notification = utility.get_object_from_names( names.o_SettingsAdvancedInstitutional_Notification, timeout_ms=3000 ) 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( **ADJUST_ADVANCED_INSTITUTIONAL_SETTINGS_REJECTION_REASONS ) confirm_button = utility.get_object_from_names( names.o_SettingsBase_confirmButton_ConfirmButton, "Error Missing Confirm Button", 2000, ) if confirm_button is not None: mouseClick(confirm_button) advanced_confirm_notification = utility.get_object_from_names( names.o_SettingsAdvancedInstitutional_Notification, timeout_ms=3000 ) test.compare( advanced_confirm_notification.text, config.ADVANCED_INSTITUTIONAL_SETTINGS_NOTIFICATION_TEXT, f"Confirm Advanced Institutional Settings Notification Text", ) back_button = utility.get_object_from_names( names.o_SettingsAdvancedInstitutional_BackButton, "Error Missing Back Button", 2000, ) if back_button is not None: mouseClick(back_button) test.endSection() def adjust_institutional_configurations_values(): test.startSection("Navigating to 'Institutional Settings' And Adjust Values") navigation.navigate_to_device_settings_using_service_password() grid_container = waitForObject(names.o_DeviceSettingsGrid, 2000) institutional_configurations_option = utility.findChildByText( grid_container, "Institutional Configurations" ) if institutional_configurations_option is not None: mouseClick(institutional_configurations_option) headerbar_container = waitForObject(names.o_headerBar_HeaderBar, 2000) institutional_configurations_screen_headerbar_title_text = utility.findChildByText( headerbar_container, "Institutional Configurations" ) 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=2, **INSTITUTIONAL_CONFIGURATIONS ) for ( minimum_ro_rejection_ratio_alarm ) in INSTITUTIONAL_CONFIGURATIONS_PARAMETER_RANGE[BLOOD_FLOW_RATE_MIN]: utility.set_value_based_on_target( names.o_SettingsBase_min_ValueAdjuster_3, minimum_ro_rejection_ratio_alarm ) for ( minimum_ro_rejection_ratio_alarm ) in INSTITUTIONAL_CONFIGURATIONS_PARAMETER_RANGE[BLOOD_FLOW_RATE_MAX]: utility.set_value_based_on_target( names.o_SettingsBase_max_ValueAdjuster_3, minimum_ro_rejection_ratio_alarm ) for ( minimum_ro_rejection_ratio_alarm ) in INSTITUTIONAL_CONFIGURATIONS_PARAMETER_RANGE[BLOOD_FLOW_RATE_DEF]: utility.set_value_based_on_target( names.o_SettingsBase_def_ValueAdjuster_3, minimum_ro_rejection_ratio_alarm ) td_simulator.td_Adjust_Institutional_Records( **ADJUST_INSTITUTIONAL_RECORDS_REJECTION_REASONS ) confirm_button = utility.get_object_from_names( names.o_SettingsBase_confirmButton_ConfirmButton_2, "Error Missing Confirm Button", 2000, ) if confirm_button is not None: mouseClick(confirm_button) institutional_confirm_notification = utility.get_object_from_names( names.o_SettingsInstitutionalRecord_NotificationBar, timeout_ms=3000 ) test.compare( institutional_confirm_notification.text, config.INSTITUTIONAL_SETTINGS_NOTIFICATION_TEXT, f"Confirm Institutional Configurations Notification Text", ) td_simulator.td_institutional_response( vRejectionReason=2, **INSTITUTIONAL_CONFIGURATIONS ) institutional_reject_notification = utility.get_object_from_names( names.o_SettingsInstitutionalRecord_NotificationBar, timeout_ms=3000 ) 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(2, digit_int, f"Rejection reason number comparison for reason {2}") test.log(f"Rejection reason text is {institutional_reject_notification_text}") back_button = utility.get_object_from_names( names.o_SettingsInstitutionalRecord_BackButton, "Error Missing Back Button", 2000, ) if back_button is not None: mouseClick(back_button) test.endSection() def adjust_blood_flow_of_institutional_configurations(): test.startSection( "Navigating to 'Institutional Settings' Adjust Values and Verify it Create Rx Screen" ) grid_container = waitForObject(names.o_DeviceSettingsGrid, 2000) institutional_configurations_option = utility.findChildByText( grid_container, "Institutional Configurations" ) if institutional_configurations_option is not None: mouseClick(institutional_configurations_option) td_simulator.td_institutional_response( vRejectionReason=1, **INSTITUTIONAL_CONFIGURATIONS ) for ( minimum_ro_rejection_ratio_alarm ) in INSTITUTIONAL_CONFIGURATIONS_BLOOD_FLOW_CUSTOM_RANGE[BLOOD_FLOW_RATE_MIN]: utility.set_value_based_on_target( names.o_SettingsBase_min_ValueAdjuster_3, minimum_ro_rejection_ratio_alarm ) for ( minimum_ro_rejection_ratio_alarm ) in INSTITUTIONAL_CONFIGURATIONS_BLOOD_FLOW_CUSTOM_RANGE[BLOOD_FLOW_RATE_MAX]: utility.set_value_based_on_target( names.o_SettingsBase_max_ValueAdjuster_3, minimum_ro_rejection_ratio_alarm ) for ( minimum_ro_rejection_ratio_alarm ) in INSTITUTIONAL_CONFIGURATIONS_BLOOD_FLOW_CUSTOM_RANGE[BLOOD_FLOW_RATE_DEF]: utility.set_value_based_on_target( names.o_SettingsBase_def_ValueAdjuster_3, minimum_ro_rejection_ratio_alarm ) td_simulator.td_Adjust_Institutional_Records( **ADJUST_INSTITUTIONAL_RECORDS_REJECTION_REASONS ) confirm_button = utility.get_object_from_names( names.o_SettingsBase_confirmButton_ConfirmButton_2, "Error Missing Confirm Button", 2000, ) if confirm_button is not None: mouseClick(confirm_button) institutional_confirm_notification = utility.get_object_from_names( names.o_SettingsInstitutionalRecord_NotificationBar, timeout_ms=3000 ) test.compare( institutional_confirm_notification.text, config.INSTITUTIONAL_SETTINGS_NOTIFICATION_TEXT, f"Confirm Institutional Configurations Notification Text", ) back_button = utility.get_object_from_names( names.o_SettingsInstitutionalRecord_BackButton, "Error Missing Back Button", 2000, ) if back_button is not None: mouseClick(back_button) td_simulator.td_operation_mode(TDOpModes.MODE_STAN.value) mouseClick(waitForObject(names.o_createTreatmentRect_TouchRect)) 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)) waitForObject(names.o_PreTreatmentCreate_pretreatmentPatientIDEntry_TextEntry).text ="abcd" mouseClick(waitForObjectExists(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster)) parent_obj = waitForObjectExists(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster) 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 = waitForObject(names.o_PreTreatmentCreate_leftArrow_IconButton) if left_arrow.enabled is not config.ENABLED: parent_obj = waitForObjectExists(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster) 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 = waitForObject(names.o_PreTreatmentCreate_rightArrow_IconButton) if right_arrow.enabled is not config.ENABLED: parent_obj = waitForObjectExists(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster) 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("leahi", "-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()