Index: suite_leahi/tst_general_alarm_requirements_instruction/test.py =================================================================== diff -u -r78b8c96491bbd93516c4c97293e80835e18380b4 -r1b36b810f4cc30d9d9a2d87010da9093b3032184 --- suite_leahi/tst_general_alarm_requirements_instruction/test.py (.../test.py) (revision 78b8c96491bbd93516c4c97293e80835e18380b4) +++ suite_leahi/tst_general_alarm_requirements_instruction/test.py (.../test.py) (revision 1b36b810f4cc30d9d9a2d87010da9093b3032184) @@ -72,17 +72,6 @@ mouseClick(waitForObject(names.o_AlarmButton_Maximize, 2000)) -def findChildByText(parent_object, target_text): - """Recursively finds a child object by its text property.""" - for child in object.children(parent_object): - if hasattr(child, "text") and str(child.text) == target_text: - return child - found = findChildByText(child, target_text) - if found: - return found - return None - - def test_send_active_list_response_batch_alarms(): alarm.cmd_activate_alarm_id(state=1, alarm=1, silence_expires=0, flags=0) mouseClick(waitForObject(names.o_AlarmsList_IconButton, 2000)) @@ -119,7 +108,7 @@ # Using the findChildByText function to find the text object containing the expected alarm ID # within the alarm grid container. - text_object = findChildByText(alarm_grid, expected_alarm_id) + text_object = utility.findChildByText(alarm_grid, expected_alarm_id) if text_object: test.compare( @@ -161,15 +150,15 @@ ) test.compare( - str(waitForObjectExists(names.o_Alarm_Dialog_TitleBar, 2000).color.name), - config.ALARMS_COLORS_HEADER[(config.ALARM_PRIORITY_OPTIONS[alarm_priority])], + utility.get_object_color(names.o_Alarm_Dialog_TitleBar, 2000), + config.ALARMS_COLORS_HEADER[config.ALARM_PRIORITY_OPTIONS[alarm_priority]], "Comparison of Alarm TitleBar Color", ) minimize() test.compare( - str(waitForObject(names.o_Alarm_Bar, 2000).color.name), - config.ALARMS_COLORS_HEADER[(config.ALARM_PRIORITY_OPTIONS[alarm_priority])], + utility.get_object_color(names.o_Alarm_Bar, 2000), + config.ALARMS_COLORS_HEADER[config.ALARM_PRIORITY_OPTIONS[alarm_priority]], "Comparison of Alarm Bar Color After Alarm minimized", ) @@ -212,46 +201,46 @@ muteTimeout_min, muteTimeout_sec = divmod(alarm_timeout, 60) if muted: test.compare( - str(waitForObjectExists(names.o_AlarmButton_Mute_Img, 2000).source.path), + utility.get_object_source_path(names.o_AlarmButton_Mute_Img, 2000), "/images/iBellOff", "Comparison of Alarm BellOff", ) test.compare( - str(waitForObjectExists(names.o_AlarmButton_Mute_Min, 2000).text), + utility.get_object_text(names.o_AlarmButton_Mute_Min, 2000), "{}".format(muteTimeout_min), "Comparison of Mute Minutes", ) test.compare( - str(waitForObjectExists(names.o_AlarmButton_Mute_Sec, 2000).text), + utility.get_object_text(names.o_AlarmButton_Mute_Sec, 2000), "{0:02}".format(muteTimeout_sec), "Comparison of Mute seconds", ) minimize() test.compare( - str(waitForObjectExists(names.o_Alarm_Bar_Mute_Img, 2000).source.path), + utility.get_object_source_path(names.o_Alarm_Bar_Mute_Img, 2000), "/images/iBellOff", "Comparison of Alarm BellOff After minimized", ) test.compare( - str(waitForObjectExists(names.o_Alarm_Bar_Mute_Min, 2000).text), + utility.get_object_text(names.o_Alarm_Bar_Mute_Min, 2000), "{}".format(muteTimeout_min), "Comparison of Mute Minutes After minimized", ) test.compare( - str(waitForObjectExists(names.o_Alarm_Bar_Mute_Sec, 2000).text), + utility.get_object_text(names.o_Alarm_Bar_Mute_Sec, 2000), "{0:02}".format(muteTimeout_sec), "Comparison of Mute seconds After minimized", ) else: test.compare( - str(waitForObjectExists(names.o_AlarmButton_Mute_Img, 2000).source.path), + utility.get_object_source_path(names.o_AlarmButton_Mute_Img, 2000), "/images/iBellOn", "Comparison of Alarm BellOn", ) minimize() test.compare( - str(waitForObjectExists(names.o_Alarm_Bar_Mute_Img, 2000).source.path), + utility.get_object_source_path(names.o_Alarm_Bar_Mute_Img, 2000), "/images/iBellOn", "Comparison of Alarm BellOn After minimized", )