Index: suite_leahi/tst_headerbar_information_popup/test.py =================================================================== diff -u -r4ae35475c883bf1b41279ffd753290ce2a2efc40 -r53c5b62d1fbf9121df012d6c025f482bfd3826b0 --- suite_leahi/tst_headerbar_information_popup/test.py (.../test.py) (revision 4ae35475c883bf1b41279ffd753290ce2a2efc40) +++ suite_leahi/tst_headerbar_information_popup/test.py (.../test.py) (revision 53c5b62d1fbf9121df012d6c025f482bfd3826b0) @@ -14,7 +14,7 @@ import os import names import subprocess -from configuration import config +from configuration import config, utility from leahi_dialin.ui.td_messaging import TD_Messaging from leahi_dialin.ui import utils from leahi_dialin.ui.dd_messaging import DD_Messaging @@ -23,14 +23,6 @@ td_simulator = TD_Messaging() dd_simulator = DD_Messaging() -def information_parameters(text): - """ - Method to set custom object property for information pop screen. - @param text : (string) parameter text - """ - names.o_InformationParameters["text"] = text - return names.o_InformationParameters - def verify_parameters_under_information(): """ Method to verify the parameter under 'Information Popup' @@ -41,44 +33,13 @@ for info_parameter in config.INFORMATION_PARAMETERS: info_parameter_text = waitForObjectExists( - information_parameters(info_parameter)) + utility.setObjectText(names.o_InformationParameters, info_parameter) + ) test.compare(info_parameter_text.text, info_parameter, "{} should be available under 'Information'".format(info_parameter)) test.endSection() -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 - -def get_aut_version(aut_path): - """ - Executes the AUT with the --version argument and captures the output. - """ - actual_aut_path = os.path.join(aut_path, "leahi") - command = [actual_aut_path, "--version"] - # Running the command and capturing the output. - result = subprocess.run( - command, - capture_output=True, - text=True, - ) - aut_name_and_version = result.stdout.strip() - aut_version = aut_name_and_version.split(" ") - aut_version_only = aut_version[1] - return aut_version_only - def verify_td_and_dd_versions( td_major, td_minor, @@ -148,7 +109,7 @@ dd_simulator.dd_serial(dd_serial) aut_path = currentApplicationContext().cwd - ui_version = get_aut_version(aut_path) + ui_version = application_init.get_aut_version(aut_path) version_details = { "OS Version" : "123.123.123.20230628230011", @@ -186,7 +147,7 @@ # Using zip() to iterate through children and the dictionary's items for child, (key, expected_value) in zip(children, version_details.items()): - value = findObjectById(child, "_value") + value = utility.findObjectById(child, "_value") if value: test.compare(str(value.text), expected_value, " Comparison of Information Parameter '" + key + "'",