diff --git a/test/ui-test/src/common/Common.py b/test/ui-test/src/common/Common.py index cc34a6fcd1..8943c0e93c 100644 --- a/test/ui-test/src/common/Common.py +++ b/test/ui-test/src/common/Common.py @@ -4,13 +4,13 @@ from drivers.SquishDriverVerification import * -def click_on_an_object(obj): - click_obj_by_name(obj) +def click_on_an_object(objName: str): + click_obj_by_name(objName) -def input_text(text, obj): - type(obj, text) +def input_text(text: str, objName: str): + type(objName, text) -def object_not_enabled(obj): - verify_object_enabled(obj, 500, False) +def object_not_enabled(objName: str): + verify_object_enabled(objName, 500, False) diff --git a/test/ui-test/src/data/StatusAccount.py b/test/ui-test/src/data/StatusAccount.py index 85c3facce7..dd1f1bf618 100755 --- a/test/ui-test/src/data/StatusAccount.py +++ b/test/ui-test/src/data/StatusAccount.py @@ -9,16 +9,19 @@ # *****************************************************************************/ #It defines a basic status account object. + +from typing import Optional + class StatusAccount(): - __name = None + __name = "" __password = None - def __init__(self, name, password = None): + def __init__(self, name: str, password: Optional[str] = None): self.__name = name self.__password = password - def get_name(self): + def get_name(self) -> str: return self.__name - def get_password(self): + def get_password(self) -> Optional[str]: return self.__password \ No newline at end of file diff --git a/test/ui-test/src/drivers/SDKeyboardCommands.py b/test/ui-test/src/drivers/SDKeyboardCommands.py index 35ba06fe85..cc20b42201 100644 --- a/test/ui-test/src/drivers/SDKeyboardCommands.py +++ b/test/ui-test/src/drivers/SDKeyboardCommands.py @@ -1,9 +1,9 @@ from drivers.SquishDriver import * -def press_enter(objName): +def press_enter(objName: str): type(objName, "") -def press_backspace(objName): +def press_backspace(objName: str): type(objName, "") diff --git a/test/ui-test/src/drivers/SquishDriver.py b/test/ui-test/src/drivers/SquishDriver.py index a9c3e9de3c..5055da43e2 100755 --- a/test/ui-test/src/drivers/SquishDriver.py +++ b/test/ui-test/src/drivers/SquishDriver.py @@ -25,7 +25,7 @@ _MIN_WAIT_OBJ_TIMEOUT = 500 # Waits for the given object is loaded, visible and enabled. # It returns a tuple: True in case it is found. Otherwise, false. And the object itself. -def is_loaded_visible_and_enabled(objName, timeout=_MAX_WAIT_OBJ_TIMEOUT): +def is_loaded_visible_and_enabled(objName: str, timeout: int=_MAX_WAIT_OBJ_TIMEOUT): obj = None try: obj = squish.waitForObject(getattr(names, objName), timeout) @@ -36,7 +36,7 @@ def is_loaded_visible_and_enabled(objName, timeout=_MAX_WAIT_OBJ_TIMEOUT): # Waits for the given object is loaded and might be not visible and/or not enabled: # It returns a tuple: True in case it is found. Otherwise, false. And the object itself. -def is_loaded(objName): +def is_loaded(objName: str): obj = None try: obj = squish.findObject(getattr(names, objName)) @@ -68,7 +68,7 @@ def click_obj(obj): # It executes the click action into object with given object name: -def click_obj_by_name(objName): +def click_obj_by_name(objName: str): try: obj = squish.waitForObject(getattr(names, objName)) squish.mouseClick(obj, squish.Qt.LeftButton) @@ -77,7 +77,7 @@ def click_obj_by_name(objName): return False -def check_obj_by_name(objName): +def check_obj_by_name(objName: str): try: obj = squish.waitForObject(getattr(names, objName)) obj.checked = True @@ -86,7 +86,7 @@ def check_obj_by_name(objName): return False -def is_text_matching(objName, text): +def is_text_matching(objName: str, text: str): try: obj = squish.waitForObject(getattr(names, objName)) test.compare(obj.text, text, "Found the following text " + text) @@ -96,7 +96,7 @@ def is_text_matching(objName, text): # It types the specified text into the given object (as if the user had used the keyboard): -def type(objName, text): +def type(objName: str, text: str): try: obj = squish.findObject(getattr(names, objName)) squish.type(obj, text) diff --git a/test/ui-test/src/drivers/SquishDriverVerification.py b/test/ui-test/src/drivers/SquishDriverVerification.py index a6d9168b7a..e38472b7ab 100644 --- a/test/ui-test/src/drivers/SquishDriverVerification.py +++ b/test/ui-test/src/drivers/SquishDriverVerification.py @@ -7,10 +7,10 @@ _MAX_WAIT_OBJ_TIMEOUT = 5000 _MIN_WAIT_OBJ_TIMEOUT = 500 -def verify_screen(objName, timeout=_MAX_WAIT_OBJ_TIMEOUT): +def verify_screen(objName: str, timeout: int=_MAX_WAIT_OBJ_TIMEOUT): result = is_loaded_visible_and_enabled(objName, timeout) test.verify(result, True) -def verify_object_enabled(objName, timeout=_MIN_WAIT_OBJ_TIMEOUT, condition=True): +def verify_object_enabled(objName: str, timeout: int=_MIN_WAIT_OBJ_TIMEOUT, condition: bool=True): result = is_loaded_visible_and_enabled(objName, timeout) test.verify(result, condition) diff --git a/test/ui-test/src/processes/StatusProcess.py b/test/ui-test/src/processes/StatusProcess.py index 6c98dd7aeb..a5b3556153 100755 --- a/test/ui-test/src/processes/StatusProcess.py +++ b/test/ui-test/src/processes/StatusProcess.py @@ -11,7 +11,7 @@ class StatusProcess: __context = None # Variable used to determine if it is needed to verify the process success or the process failure behavior - __verify_success = True + __verify_success: bool = True def __init__(self, context): self.__context = context @@ -26,7 +26,7 @@ class StatusProcess: # It is used to execute the specific status process steps. #@abstractmethod - def execute_process(self, verify_success = True): + def execute_process(self, verify_success: bool = True): self.__verify_success = verify_success print("TODO: Invoke navigations") # *** diff --git a/test/ui-test/src/utils/FileManager.py b/test/ui-test/src/utils/FileManager.py index 19686eb88f..1308643b9f 100644 --- a/test/ui-test/src/utils/FileManager.py +++ b/test/ui-test/src/utils/FileManager.py @@ -2,7 +2,7 @@ import os, shutil import os.path as path -def erase_directory(dir): +def erase_directory(dir: str): directory = path.abspath(path.join(__file__ , dir)) if (os.path.isdir(directory)): print(directory)