Index: suite_leahi/tst_headerbar_information_popup/test.py =================================================================== diff -u --- suite_leahi/tst_headerbar_information_popup/test.py (revision 0) +++ suite_leahi/tst_headerbar_information_popup/test.py (revision bf2ea2cbfd4e8cd89c5ef2b811c20d911d2d3250) @@ -0,0 +1,320 @@ +# Subject/Title: LDT-1650 HeaderBar - SW - 02 - Information - Q&R +# +# Functionalities: Testing all items of HeaderBar Information Pop up +# +# Steps: +# 1 Set OS version using application_init, Start Leahi Application and Click on HeaderBar Information icon +# 2 Verify the parameter under 'Information Pop up screen +# 3 Set and Compare Information Parameters values +# 4 Set and Compare Information Parameters at their Maximum values +# 5 Set and Compare Information Parameters at their Minimum values +# 6 Set and Compare Information Parameters at their values Beyond the Maximum Allowed +# 7 Set and Compare Information Parameters at their values Below the Minimum Allowed + +import names +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 +from configuration import application_init + +td_simulator = TD_Messaging() +dd_simulator = DD_Messaging() + +INFORMATION_PARAMETERS = [ + "OS Version", "UI Version", "TD Version", "TD FPGA Version", + "TD Serial Number", "DD Version", "DD FPGA Version", "DD Serial Number", +] + + +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' + """ + test.startSection("Verify the parameter under 'Information Popup '") + test.log("Navigating to 'Information Popup' screen") + mouseClick(waitForObjectExists(names.o_informationIconButton)) + + for info_parameter in config.INFORMATION_PARAMETERS: + info_parameter_text = waitForObjectExists( + information_parameters(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 verify_td_and_dd_versions( + td_major, + td_minor, + td_micro, + td_build, + td_fpga_id, + td_fpga_major, + td_fpga_minor, + td_fpga_lab, + td_compatibility_rev, + td_serial, + dd_major, + dd_minor, + dd_micro, + dd_build, + dd_fpga_id, + dd_fpga_major, + dd_fpga_minor, + dd_fpga_lab, + dd_compatibility_rev, + dd_serial, +): + """ + Method to verify the OS, UI, 'TD' and 'DD' version + @param td_major: (uint) - TD Major version number + @param td_minor: (uint) - TD Minor version number + @param td_micro: (uint) - TD Micro version number + @param td_build: (uint) - TD Build version number + @param td_fpga_id: (int) - TD FPGA id version number + @param td_fpga_major: (int) - TD FPGA Major version number + @param td_fpga_minor: (int) - TD FPGA Minor version number + @param td_fpga_lab: (int) - TD FPGA Lab version number + @param dd_major: (uint) - DD Major version number + @param dd_minor: (uint) - DD Minor version number + @param dd_micro: (uint) - DD Micro version number + @param dd_build: (uint) - DD Build version number + @param dd_fpga_id: (int) - DD FPGA id version number + @param dd_pga_major: (int) - DD FPGA Major version number + @param dd__fpga_minor: (int) - DD FPGA Minor version number + @param dd_fpga_lab: (int) - DD FPGA Lab version number + @param compatibility_rev: (uint) - The FWs/UI compatibility revision + """ + td_simulator.td_versions( + major = td_major, + minor = td_minor, + micro = td_micro, + build = td_build, + fpga_id = td_fpga_id, + fpga_major = td_fpga_major, + fpga_minor = td_fpga_minor, + fpga_lab = td_fpga_lab, + compatibility_rev = td_compatibility_rev + ) + td_simulator.td_serial(td_serial) + + dd_simulator.dd_versions( + major = dd_major, + minor = dd_minor, + micro = dd_micro, + build = dd_build, + fpga_id = dd_fpga_id, + fpga_major = dd_fpga_major, + fpga_minor = dd_fpga_minor, + fpga_lab = dd_fpga_lab, + compatibility_rev = dd_compatibility_rev + ) + dd_simulator.dd_serial(dd_serial) + + version_details = { + "OS Version" : "123.123.123.20230628230011", + "UI Version" : "staging-09241954-0", + "TD Version" : None, + "TD FPGA Version" : None, + "TD Serial Number": None, + "DD Version" : None, + "DD FPGA Version" : None, + "DD Serial Number": None, + } + td_version = ( + f"{td_major}.{td_minor}.{td_micro}.{td_build}.{td_compatibility_rev}" + ) + td_fpga_version = ( + f"{td_fpga_id}.{td_fpga_major}.{td_fpga_minor}.{td_fpga_lab}" + ) + dd_version = ( + f"{dd_major}.{dd_minor}.{dd_micro}.{dd_build}.{dd_compatibility_rev}" + ) + dd_fpga_version = ( + f"{dd_fpga_id}.{dd_fpga_major}.{dd_fpga_minor}.{dd_fpga_lab}" + ) + version_details["TD Version"] = td_version + version_details["TD FPGA Version"] = td_fpga_version + version_details["TD Serial Number"] = td_serial + version_details["DD Version"] = dd_version + version_details["DD FPGA Version"] = dd_fpga_version + version_details["DD Serial Number"] = dd_serial + + column = waitForObject(names.o_versionColumn) + + # Get a list of the children to use with zip() + children = object.children(column) + + # 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") + if value: + test.compare(str(value.text), expected_value, + " Comparison of Information Parameter '" + key + "'", + ) + + test.endSection() + + +def main(): + utils.tstStart(__file__) + # Set OS version + application_init.setup_post_log_successful_start() + + startApplication(config.AUT_NAME + '-q') + + verify_parameters_under_information() + + test.startSection("Set and Compare Information Parameters values") + verify_td_and_dd_versions( + td_major = 10, + td_minor = 20, + td_micro = 30, + td_build = 4000, + td_fpga_id = 50, + td_fpga_major = 60, + td_fpga_minor = 70, + td_fpga_lab = 80, + td_compatibility_rev = 9999, + td_serial = "TD1234567890123", + dd_major = 100, + dd_minor = 95, + dd_micro = 105, + dd_build = 1000, + dd_fpga_id = 124, + dd_fpga_major = 75, + dd_fpga_minor = 65, + dd_fpga_lab = 125, + dd_compatibility_rev = 4000, + dd_serial = "DD1234567890123" + ) + + test.startSection( + "Set and Compare Information Parameters at their Maximum values") + verify_td_and_dd_versions( + td_major = 99, + td_minor = 99, + td_micro = 99, + td_build = 99, + td_fpga_id = 99, + td_fpga_major = 99, + td_fpga_minor = 99, + td_fpga_lab = 99, + td_compatibility_rev = 99, + td_serial = "TD9876543210123", + dd_major = 99, + dd_minor = 99, + dd_micro = 99, + dd_build = 99, + dd_fpga_id = 99, + dd_fpga_major = 99, + dd_fpga_minor = 99, + dd_fpga_lab = 99, + dd_compatibility_rev = 99, + dd_serial = "DD9876543210123" + ) + + test.startSection( + "Set and Compare Information Parameters at their Minimum values") + verify_td_and_dd_versions( + td_major = 1, + td_minor = 1, + td_micro = 1, + td_build = 1, + td_fpga_id = 1, + td_fpga_major = 1, + td_fpga_minor = 1, + td_fpga_lab = 1, + td_compatibility_rev = 1, + td_serial = "TD1", + dd_major = 1, + dd_minor = 1, + dd_micro = 1, + dd_build = 1, + dd_fpga_id = 1, + dd_fpga_major = 1, + dd_fpga_minor = 1, + dd_fpga_lab = 1, + dd_compatibility_rev = 1, + dd_serial = "DD1" + ) + + test.startSection( + "Set and Compare Information Parameters at their values Beyond the Maximum Allowed" + ) + verify_td_and_dd_versions( + td_major = 102, + td_minor = 102, + td_micro = 102, + td_build = 102, + td_fpga_id = 102, + td_fpga_major = 102, + td_fpga_minor = 102, + td_fpga_lab = 102, + td_compatibility_rev = 102, + td_serial = "TD9876543210123", + dd_major = 102, + dd_minor = 102, + dd_micro = 102, + dd_build = 102, + dd_fpga_id = 102, + dd_fpga_major = 102, + dd_fpga_minor = 102, + dd_fpga_lab = 102, + dd_compatibility_rev = 102, + dd_serial = "DD9876543210123" + ) + + test.startSection( + "Set and Compare Information Parameters at their values Below the Minimum Allowed" + ) + verify_td_and_dd_versions( + td_major = 0, + td_minor = 0, + td_micro = 0, + td_build = 0, + td_fpga_id = 0, + td_fpga_major = 0, + td_fpga_minor = 0, + td_fpga_lab = 0, + td_compatibility_rev = 0, + td_serial = "0", + dd_major = 0, + dd_minor = 0, + dd_micro = 0, + dd_build = 0, + dd_fpga_id = 0, + dd_fpga_major = 0, + dd_fpga_minor = 0, + dd_fpga_lab = 0, + dd_compatibility_rev = 0, + dd_serial = "0" + ) + + utils.tstDone()