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,12 +1,17 @@
import time
import configs.timeouts
import driver
def waitFor(condition, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC) -> bool:
started_at = time.monotonic()
while not condition():
time.sleep(1)
if time.monotonic() - started_at > timeout_msec/1000:
if time.monotonic() - started_at > timeout_msec / 1000:
return False
return True
def isFrozen(timeout_msec):
return driver.currentApplicationContext().isFrozen(timeout_msec)

View File

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