2023-11-07 15:05:43 +00:00
|
|
|
import time
|
|
|
|
|
|
|
|
import configs.timeouts
|
2024-03-20 12:20:56 +00:00
|
|
|
import driver
|
2023-11-07 15:05:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
def waitFor(condition, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC) -> bool:
|
|
|
|
started_at = time.monotonic()
|
|
|
|
while not condition():
|
|
|
|
time.sleep(1)
|
2024-03-20 12:20:56 +00:00
|
|
|
if time.monotonic() - started_at > timeout_msec / 1000:
|
2023-11-07 15:05:43 +00:00
|
|
|
return False
|
|
|
|
return True
|
2024-03-20 12:20:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
def isFrozen(timeout_msec):
|
|
|
|
return driver.currentApplicationContext().isFrozen(timeout_msec)
|