Index: shared/scripts/configuration/utility.py =================================================================== diff -u -rbb798f36abcf369278c91d168e16c35003d0b55a -r5900c4bf715431eaa6acb03a6a4963bd8918f987 --- shared/scripts/configuration/utility.py (.../utility.py) (revision bb798f36abcf369278c91d168e16c35003d0b55a) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 5900c4bf715431eaa6acb03a6a4963bd8918f987) @@ -129,3 +129,73 @@ raise LookupError("zone object is not in view to the user after " + \ "trying 100 times") + + +def get_progress(): + """ + Method to obtain progress + @return: Progress value + """ + progress_bar = object.parent(waitForObjectExists(names.progress_bar)) + progress_bar_children = object.children(progress_bar) + progress_bar_val_parent = progress_bar_children[3] + progress_bar_val_parents_children = object.children(progress_bar_val_parent) + progress_bar_val = progress_bar_val_parents_children[1] + return progress_bar_val.text.toUtf8().constData() + + +def verify_the_progress(value) -> None: + """ + Method to verify the progress + @param value: int single message + """ + progress = pyInt(get_progress()) + test.compare(progress-1, value, + f"Single value {value} is updated in Progress bar") + + +def post_a_message_and_verify_progress_and_completion(msgs_and_conditions): + """ + method to post a message and verify the progress bar and + if final message is posted + """ + item = 0 + 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) + if item < (len(msgs_and_conditions)-1): + verify_the_progress(value=msg) + verify_final_message_posted(final_msg=final_msg, final_msg_posted=final_msg_posted) + item += 1 + else: + test.log("final message won't posted on progress bar") + 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) + @return: None + """ + if final_msg == True and final_msg_posted == 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) \ + or (final_msg == False and final_msg_posted == 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): + + if object.exists(names.busy_indicator): + busy_indicator = waitForObject(names.busy_indicator) + test.compare(busy_indicator.enabled, True, "Waiting for a value")