Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -re2c906a7b5fde31d48d168f097fe6a5a2ab0afea -rc641ef1cd371fa90784d7fc843072987ed9c0d92 --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision e2c906a7b5fde31d48d168f097fe6a5a2ab0afea) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision c641ef1cd371fa90784d7fc843072987ed9c0d92) @@ -1,5 +1,6 @@ import squish import test +import object def get_object_from_names(names_dict, error_message = "Missing object", timeout_ms = 200): """ @@ -12,3 +13,22 @@ except LookupError: test.fail("ERROR : " + error_message) return None + +def setObjectText(obj, text): + obj["text"] = text + return obj + +def findObjectById(parent, id): + """ + Recursively searches for a child object by its id. + Returns the found object or None if not found. + """ + if str(parent.id) == id: + return parent + + for child in object.children(parent): + found = findObjectById(child, id) + if found: + return found + + return None \ No newline at end of file Index: suite_leahi/tst_headerbar_wifi_indicator/test.py =================================================================== diff -u -r845657f82743b8c2699e7ce608bacf1330561553 -rc641ef1cd371fa90784d7fc843072987ed9c0d92 --- suite_leahi/tst_headerbar_wifi_indicator/test.py (.../test.py) (revision 845657f82743b8c2699e7ce608bacf1330561553) +++ suite_leahi/tst_headerbar_wifi_indicator/test.py (.../test.py) (revision c641ef1cd371fa90784d7fc843072987ed9c0d92) @@ -11,15 +11,10 @@ import names -from configuration import config +from configuration import config, utility from leahi_dialin.ui import utils -def wifi_popup_text_obj(text): - names.o_HeaderBar_Wifi_PopuoParameters["text"] = text - return names.o_HeaderBar_Wifi_PopuoParameters - - def headerbar_wifi_popup(): """ Method to verify "WiFi" Pop-up @@ -48,7 +43,9 @@ # The test environment is running the UI application in an Ubuntu OS within VMware, # where the WiFi button is not enabled in the UI. So Comparing error message - wifi_popup_text = waitForObjectExists(wifi_popup_text_obj(config.WIFI_POPUP_TEXT)) + wifi_popup_text = waitForObjectExists( + utility.setObjectText(names.o_HeaderBar_Wifi_PopuoParameters, config.WIFI_POPUP_TEXT) + ) test.compare( wifi_popup_text.text, config.WIFI_POPUP_TEXT,