chore: isFrozen verification added to method click

This commit is contained in:
Valentina Novgorodtceva 2024-03-20 19:20:56 +07:00 committed by Anastasiya
parent aba501f025
commit 7482a8f8d9
2 changed files with 12 additions and 3 deletions

View File

@ -1,6 +1,7 @@
import time import time
import configs.timeouts import configs.timeouts
import driver
def waitFor(condition, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC) -> bool: def waitFor(condition, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC) -> bool:
@ -10,3 +11,7 @@ def waitFor(condition, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC
if time.monotonic() - started_at > timeout_msec / 1000: if time.monotonic() - started_at > timeout_msec / 1000:
return False return False
return True return True
def isFrozen(timeout_msec):
return driver.currentApplicationContext().isFrozen(timeout_msec)

View File

@ -6,7 +6,7 @@ import allure
import configs import configs
import driver import driver
from gui.objects_map import names from driver import isFrozen
from scripts.tools.image import Image from scripts.tools.image import Image
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -92,8 +92,12 @@ class QObject:
self, self,
x: int = None, x: int = None,
y: int = None, y: int = None,
button=None button=None,
): ):
if isFrozen(500) is False:
pass
else:
time.sleep(2000)
driver.mouseClick( driver.mouseClick(
self.object, self.object,
x or int(self.object.width * 0.1), x or int(self.object.width * 0.1),