Skip to content
This repository was archived by the owner on Aug 13, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion driver/squish_api.py
Original file line number Diff line number Diff line change
@@ -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)
8 changes: 6 additions & 2 deletions gui/elements/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import configs
import driver
from gui.objects_map import names
from driver import isFrozen
from scripts.tools.image import Image

LOG = logging.getLogger(__name__)
Expand Down Expand Up @@ -92,8 +92,12 @@ def click(
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),
Expand Down