Index: suite_leahi/tst_service_institutional/test.py =================================================================== diff -u -r279e768763ca90eadc690f1c922889f8969e5e6f -rea332e15d3df5245676b6e5fb6f1a235e990c860 --- suite_leahi/tst_service_institutional/test.py (.../test.py) (revision 279e768763ca90eadc690f1c922889f8969e5e6f) +++ suite_leahi/tst_service_institutional/test.py (.../test.py) (revision ea332e15d3df5245676b6e5fb6f1a235e990c860) @@ -269,21 +269,6 @@ } -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_SettingsInstitutionalRecord_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(): """ Navigate to Institutional Configuration screen and compare Title bar text, @@ -292,17 +277,12 @@ """ test.startSection("Navigating to 'Institutional Configurations' Screen") - grid_container = waitForObject(names.o_DeviceSettingsGrid, 2000) - institutional_configurations_option = utility.findChildByText( - grid_container, "Institutional Configurations" - ) + device_settings_grid = waitForObject(names.o_DeviceSettingsGrid) + mouseClick(utility.findChildByText(device_settings_grid, config.INSTITUTIONAL_CONFIGURATIONS)) - if institutional_configurations_option is not None: - mouseClick(institutional_configurations_option) - - headerbar_container = waitForObject(names.o_headerBar_HeaderBar, 2000) + institutional_headerbar = waitForObject(names.o_headerBar_HeaderBar, 2000) institutional_configurations_screen_headerbar_title_text = utility.findChildByText( - headerbar_container, "Institutional Configurations" + institutional_headerbar, config.INSTITUTIONAL_CONFIGURATIONS_SCREEN_TITLE_TEXT ) if institutional_configurations_screen_headerbar_title_text is not None: test.compare( @@ -315,21 +295,18 @@ td_simulator.td_institutional_response( vRejectionReason=1, **INSTITUTIONAL_CONFIGURATIONS ) - total_rows = 12 - rows_per_scroll = 12 + total_rows = 21 + rows_per_scroll = 13 verified_count = 0 - for row_index in range(0, total_rows): + 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] - if row_index < len(EXPECTED_VALUES_PER_ROW): - expected_values = EXPECTED_VALUES_PER_ROW[row_index] - else: - expected_values = INSTITUTIONAL_CONFIGURATIONS - # 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() @@ -350,16 +327,47 @@ ) verified_count += 1 - # Scroll after every 12 rows (0-11, then scroll, then 12-23, etc.) + # 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}") - if not scroll_to_next_rows(): - test.log("Failed to scroll, stopping verification") - break - else: - test.log("Scroll completed, continuing with next batch") + 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( @@ -368,8 +376,7 @@ ) institutional_reject_notification = utility.get_object_from_names( - names.o_SettingsInstitutionalRecord_NotificationBar, - timeout_ms=3000 + names.o_SettingsInstitutionalRecord_NotificationBar ) institutional_reject_notification_text = str(institutional_reject_notification.text) @@ -381,14 +388,7 @@ f"Rejection reason number comparison for reason {rejection_reason}") 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) - + mouseClick(utility.get_object_from_names(names.o_SettingsInstitutionalRecord_BackButton)) test.endSection() @@ -401,17 +401,13 @@ """ 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" - ) + device_settings_grid = waitForObject(names.o_DeviceSettingsGrid, 2000) + mouseClick(utility.findChildByText(device_settings_grid, config.ADVANCED_INSTITUTIONAL_SETTINGS)) - if advanced_modes_option is not None: - mouseClick(advanced_modes_option) - - headerbar_container = waitForObject(names.o_headerBar_HeaderBar, 2000) + advanced_institutional_headerbar = waitForObject(names.o_headerBar_HeaderBar, 2000) advanced_institutional_settings_screen_headerbar_title_text = ( - utility.findChildByText(headerbar_container, "Advanced Institutional Settings") + 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( @@ -453,7 +449,7 @@ vRejectionReason=1, **ADVANCED_INSTITUTIONAL_SETTINGS ) advanced_reject_notification = utility.get_object_from_names( - names.o_SettingsAdvancedInstitutional_Notification, timeout_ms=3000 + names.o_SettingsAdvancedInstitutional_Notification ) advanced_reject_notification_text = str(advanced_reject_notification.text) digit = re.sub(r"^.*?\[(\d+)\].*$", r"\1", advanced_reject_notification_text) @@ -462,29 +458,16 @@ 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)) - 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 + names.o_SettingsAdvancedInstitutional_Notification ) advanced_reject_notification_text = str(advanced_reject_notification.text) digit = re.sub(r"^.*?\[(\d+)\].*$", r"\1", advanced_reject_notification_text) @@ -498,29 +481,17 @@ td_simulator.td_Adjust_Advanced_Institutional_Records( vAccepted = 1, **ADJUST_ADVANCED_INSTITUTIONAL_SETTINGS_REJECTION_REASONS ) - confirm_button = utility.get_object_from_names( - names.o_SettingsAdvancedInstitutional_ConfirmButton, - "Error Missing Confirm Button", - 2000, - ) - if confirm_button is not None: - mouseClick(confirm_button) + 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 + names.o_SettingsAdvancedInstitutional_Notification ) 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) + mouseClick(utility.get_object_from_names(names.o_SettingsAdvancedInstitutional_BackButton)) test.endSection() @@ -531,13 +502,8 @@ then Compare Advanced Institutional Settings records and preferences Notification Text """ 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) + device_settings_grid = waitForObject(names.o_DeviceSettingsGrid, 2000) + mouseClick(utility.findChildByText(device_settings_grid, config.ADVANCED_INSTITUTIONAL_SETTINGS)) for ( minimum_ro_rejection_ratio_alarm @@ -565,17 +531,11 @@ utility.set_value_based_on_target( names.o_SettingsAdvancedInstitutional_min_ValueAdjuster, minimum_ro_rejection_ratio_alarm ) - - confirm_button = utility.get_object_from_names( - names.o_SettingsAdvancedInstitutional_ConfirmButton, - "Error Missing Confirm Button", - 2000, - ) - if confirm_button is not None: - mouseClick(confirm_button) + 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 + names.o_SettingsAdvancedInstitutional_Notification ) test.compare( advanced_confirm_notification.text, @@ -586,13 +546,7 @@ td_simulator.td_Adjust_Advanced_Institutional_Records(vAccepted = 0, **ADJUST_ADVANCED_INSTITUTIONAL_SETTINGS_REJECTION_REASONS ) - confirm_button = utility.get_object_from_names( - names.o_SettingsAdvancedInstitutional_ConfirmButton, - "Error Missing Confirm Button", - 2000, - ) - if confirm_button is not None: - mouseClick(confirm_button) + 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 @@ -602,13 +556,7 @@ config.ERROR_ADVANCED_INSTITUTIONAL_SETTINGS_NOTIFICATION_TEXT, f"Confirm Advanced Institutional Settings Error 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) + mouseClick(utility.get_object_from_names(names.o_SettingsAdvancedInstitutional_BackButton)) test.endSection() @@ -620,17 +568,12 @@ records and preferences Notification Text and click Back button """ test.startSection("Navigating to 'Institutional Settings' And Adjust Values") - grid_container = waitForObject(names.o_DeviceSettingsGrid, 2000) - institutional_configurations_option = utility.findChildByText( - grid_container, "Institutional Configurations" - ) + device_settings_grid = waitForObject(names.o_DeviceSettingsGrid) + mouseClick(utility.findChildByText(device_settings_grid, config.INSTITUTIONAL_CONFIGURATIONS)) - if institutional_configurations_option is not None: - mouseClick(institutional_configurations_option) - - headerbar_container = waitForObject(names.o_headerBar_HeaderBar, 2000) + institutional_headerbar = waitForObject(names.o_headerBar_HeaderBar, 2000) institutional_configurations_screen_headerbar_title_text = utility.findChildByText( - headerbar_container, "Institutional Configurations" + institutional_headerbar, config.INSTITUTIONAL_CONFIGURATIONS_SCREEN_TITLE_TEXT ) if institutional_configurations_screen_headerbar_title_text is not None: test.compare( @@ -670,16 +613,10 @@ **ADJUST_INSTITUTIONAL_RECORDS_REJECTION_REASONS ) - confirm_button = utility.get_object_from_names( - names.o_SettingsInstitutional_ConfirmButton, - "Error Missing Confirm Button", - 2000, - ) - if confirm_button is not None: - mouseClick(confirm_button) + mouseClick(utility.get_object_from_names(names.o_SettingsInstitutional_ConfirmButton)) institutional_confirm_notification = utility.get_object_from_names( - names.o_SettingsInstitutionalRecord_NotificationBar, timeout_ms=3000 + names.o_SettingsInstitutionalRecord_NotificationBar ) test.compare( institutional_confirm_notification.text, @@ -691,31 +628,18 @@ **ADJUST_INSTITUTIONAL_RECORDS_REJECTION_REASONS ) - confirm_button = utility.get_object_from_names( - names.o_SettingsInstitutional_ConfirmButton, - "Error Missing Confirm Button", - 2000, - ) - if confirm_button is not None: - mouseClick(confirm_button) + mouseClick(utility.get_object_from_names(names.o_SettingsInstitutional_ConfirmButton)) institutional_confirm_notification = utility.get_object_from_names( - names.o_SettingsInstitutionalRecord_NotificationBar, timeout_ms=3000 + names.o_SettingsInstitutionalRecord_NotificationBar ) test.compare( institutional_confirm_notification.text, config.ERROR_INSTITUTIONAL_SETTINGS_NOTIFICATION_TEXT, f"Confirm Institutional Configurations Error 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) - + mouseClick(utility.get_object_from_names(names.o_SettingsInstitutionalRecord_BackButton)) test.endSection() @@ -729,14 +653,9 @@ 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" - ) + device_settings_grid = waitForObject(names.o_DeviceSettingsGrid) + mouseClick(utility.findChildByText(device_settings_grid, config.INSTITUTIONAL_CONFIGURATIONS)) - if institutional_configurations_option is not None: - mouseClick(institutional_configurations_option) - td_simulator.td_institutional_response( vRejectionReason=1, **INSTITUTIONAL_CONFIGURATIONS ) @@ -766,16 +685,10 @@ **ADJUST_INSTITUTIONAL_RECORDS_REJECTION_REASONS ) - confirm_button = utility.get_object_from_names( - names.o_SettingsInstitutional_ConfirmButton, - "Error Missing Confirm Button", - 2000, - ) - if confirm_button is not None: - mouseClick(confirm_button) + mouseClick(utility.get_object_from_names(names.o_SettingsInstitutional_ConfirmButton)) institutional_confirm_notification = utility.get_object_from_names( - names.o_SettingsInstitutionalRecord_NotificationBar, timeout_ms=3000 + names.o_SettingsInstitutionalRecord_NotificationBar ) test.compare( institutional_confirm_notification.text, @@ -786,27 +699,17 @@ td_simulator.td_institutional_response(vRejectionReason=0, **combined_configs) - 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) + mouseClick(utility.get_object_from_names(names.o_SettingsInstitutionalRecord_BackButton)) td_simulator.td_operation_mode(TDOpModes.MODE_STAN.value) main_menu_container = waitForObject(names.o_mainMenu_MainMenu, 2000) - settings_menu_object = utility.findChildByText( - main_menu_container, "Treatment" - ) - if settings_menu_object is not None: - mouseClick(settings_menu_object) + mouseClick(utility.findChildByText(main_menu_container, config.TREATMENT)) # settings_menu_object = utility.findChildByText( 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 ="abcd" + 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")