Index: shared/scripts/names.py =================================================================== diff -u -r3f7b7879ab3d4328ae636a00c990b0a5cc6036d6 -r28b3a1aa27c7776cdc70f08dfff8a294d419cdff --- shared/scripts/names.py (.../names.py) (revision 3f7b7879ab3d4328ae636a00c990b0a5cc6036d6) +++ shared/scripts/names.py (.../names.py) (revision 28b3a1aa27c7776cdc70f08dfff8a294d419cdff) @@ -1,10 +1,9 @@ # encoding: UTF-8 -AUT_NAME = "denaliSquish" +AUT_NAME = "denaliSquish -q" +AUT_DEBUG = "denali -q" -from objectmaphelper import * - o_Gui_MainView = {"type": "Gui::MainView", "unnamed": 1, "visible": True} o_Overlay = {"container": o_Gui_MainView, "type": "Overlay", "unnamed": 1, "visible": True} o_borderRect_Rectangle = {"container": o_Overlay, "gradient": 0, "id": "_borderRect", "type": "Rectangle", "unnamed": 1, "visible": True} Index: tst_post/test.py =================================================================== diff -u -r57d639af6d8576a87a6e42c659750938c4acdd13 -r28b3a1aa27c7776cdc70f08dfff8a294d419cdff --- tst_post/test.py (.../test.py) (revision 57d639af6d8576a87a6e42c659750938c4acdd13) +++ tst_post/test.py (.../test.py) (revision 28b3a1aa27c7776cdc70f08dfff8a294d419cdff) @@ -14,22 +14,15 @@ import names -# from time import sleep from dialin.ui import utils -# from dialin.ui import unittests - from builtins import int as pyInt -from configuration.config import * from dialin.ui.hd_simulator import HDSimulator -# from dialin.ui.dg_simulator import DGSimulator -# from dialin.ui.hd_simulator_alarms import HDAlarmsSimulator +from dialin.ui.dg_simulator import DGSimulator -MSGS_AND_CONDITIONS = { 5: [True, False], 10: [True, False], 2: [True, False], - 3: [False, False], 18: [True, True], 7: [False, True], - } +POST_ITEMS_COUNT = 20 + 1 # Python not including the last hd = HDSimulator() -#dg = DGSimulator() +dg = DGSimulator() def get_progress(): """ @@ -44,71 +37,68 @@ return progress_bar_val.text.toUtf8().constData() -def verify_the_progress(value, final_msg_posted) -> None: +def verify_the_progress(item) -> None: """ Method to verify the progress - @param value: int single message + @param item: (int) single message post item + @param is_final: (bool) if this is the final post message(True/False) """ - progress = pyInt(get_progress())-1 - if final_msg_posted is True: - test.xcompare(value, progress, f"Final value {value} should " + - "not reflect on the progress bar") - elif final_msg_posted is False: - test.compare(value, progress, f"{value} should reflect "+ - "on progress bar") + progress = pyInt(get_progress()) + test.compare(item, progress, + "Single post message item {item} expected to reflect on progress bar, got {progress}" + .format(item=item, progress=progress)) -def post_a_message_and_verify_progress_and_completion(msgs_and_conditions): +def verify_final_message_posted(is_passed: bool = False, is_final: bool = False) -> None: """ - method to post a message and verify the progress bar and - if final message is posted - """ - for msg, conditions in msgs_and_conditions.items(): - final_msg = conditions[0] - final_msg_posted = conditions[1] - hd.cmd_send_hd_post(msg, final_msg, final_msg_posted) - snooze(2) - verify_the_progress(value=msg, final_msg_posted=final_msg_posted) - verify_final_message_posted(final_msg=final_msg, final_msg_posted=final_msg_posted) - - -def verify_final_message_posted(final_msg=None, final_msg_posted=None) -> None: - """ - method to verify the indication of final - message posted - @param final_msg: bool final message(True/False) - @param final_msg_posted: bool if this is the final post message(True/False) + method to verify the indication of final message posted + @param is_passed: (bool) final message result (passed,failed) + @param is_final: (bool) if this is the final post message(True/False) @return: None """ - test.startSection("Verifying the status") - if final_msg == True and final_msg_posted == True: + if is_final == False: + if object.exists(names.busy_indicator): + busy_indicator = waitForObject(names.busy_indicator) + test.compare(busy_indicator.enabled, True, "Waiting for a value") + if is_final == True and is_passed == True: if object.exists(names.done_indicator): done_indicator = waitForObject(names.done_indicator) test.compare(done_indicator.enabled, True, "Done, Final value passed") - elif (final_msg == False and final_msg_posted == True) : - + if is_final == True and is_passed == False: if object.exists(names.fail_indicator): fail_indicator = waitForObject(names.fail_indicator) test.compare(fail_indicator.enabled, True, "Failed, Final value not passed") - elif (final_msg == True and final_msg_posted == False)\ - or (final_msg == False and final_msg_posted == False): - - if object.exists(names.busy_indicator): - busy_indicator = waitForObject(names.busy_indicator) - test.compare(busy_indicator.enabled, True, "Waiting for a value") - test.endSection() - -def main(): +def post_a_message_and_verify_progress_and_completion(item: int, is_passed: bool, is_final: bool = False): + """ + method to post a message and verify the progress bar and + @param item: (int) single message post item + @param is_passed: (bool) final message result (passed,failed) + @param is_final: (bool) if this is the final post message(True/False) + """ + hd.cmd_send_hd_post(item, is_passed, is_final) + dg.cmd_send_dg_post(item, is_passed, is_final) + if not is_final: + verify_the_progress(item) + verify_final_message_posted(is_passed, is_final) + + +def main(): utils.tstStart(__file__) - startApplication(AUT_NAME) + startApplication(names.AUT_NAME) hd.cmd_send_power_on_self_test_version_request() - post_a_message_and_verify_progress_and_completion(MSGS_AND_CONDITIONS) - snooze(2) - + for item in range(POST_ITEMS_COUNT): + post_a_message_and_verify_progress_and_completion(item, True , False) # single passed + post_a_message_and_verify_progress_and_completion(item, False, False) # single failed + + for item in range(POST_ITEMS_COUNT): + post_a_message_and_verify_progress_and_completion(item, False, True ) # Final passed + post_a_message_and_verify_progress_and_completion(item, True , True ) # Final failed + utils.tstDone() +