########################################################################### # # Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. # # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN # WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # @file utils.py # @author (last) LTTS # @date (last) 15-Jan-2022 # ############################################################################ import object import names import sys import squish import time import test from builtins import str as pyStr from builtins import int as pyInt from configuration import config from dialin.ui import utils from datetime import datetime from dialin.ui import utils def convert_seconds_into_min_and_sec(seconds): min = time.strftime("%M", time.gmtime(seconds)) sec = time.strftime("%S", time.gmtime(seconds)) return min,sec def get_indicators(screen_obj, txt): """ Verifying the busy indicators for BiCarb Pump Check and Acid Pump Check. indicator object of expected text @param step - (str) expected text @return indicators - (obj) list of busy and check indicator """ parent_obj = object.parent(squish.waitForObjectExists(get_text_object(screen_obj,txt))) children_obj = object.children(parent_obj) indicator_parent = children_obj[2] indicators = object.children(indicator_parent) return indicators squish.testSettings.objectNotFoundDebugging = True def verify_missing_object(object_to_check): """ Method to verify the given object is invisible or is not present on the screen @param object_to_check: the object whose invisibility must be verified """ try: squish.testSettings.objectNotFoundDebugging = False squish.waitForObject(object_to_check,3000) test.fail("Given object should not be present initially") except LookupError as _: test.passes("object is not present as expected") squish.testSettings.objectNotFoundDebugging = True def get_bullet_object(screen_obj, num): """ To obtain a bullet object based on occurrence provided. @param screen_obj: provides the container on which the bullet must be present @param num: provides the occurrence value @returns a real name object """ names.o_bullet_object["container"] = screen_obj names.o_bullet_object["occurrence"] = num + 1 return names.o_bullet_object def recirculate_rejection_msg(text): names.o_recirculate_rejection_msg["text"] = text return names.o_recirculate_rejection_msg