chore: add isFrozen function and make the timeout for click a param

This commit is contained in:
Anastasiya Semiankevich 2024-06-25 17:30:43 +03:00 committed by Anastasiya
parent c71d11e990
commit 289d3561bd
2 changed files with 10 additions and 2 deletions

View File

@ -13,5 +13,5 @@ def waitFor(condition, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC
return True return True
def isFrozen(timeout_msec): def isFrozen(timeout_sec):
return driver.currentApplicationContext().isFrozen(timeout_msec) return driver.currentApplicationContext().isFrozen(timeout_sec)

View File

@ -100,6 +100,7 @@ class QObject:
x: int = None, x: int = None,
y: int = None, y: int = None,
button=None, button=None,
timeout=1,
): ):
driver.mouseClick( driver.mouseClick(
self.object, self.object,
@ -108,6 +109,13 @@ class QObject:
button or driver.Qt.LeftButton button or driver.Qt.LeftButton
) )
LOG.info('%s: is clicked with Qt.LeftButton', self) LOG.info('%s: is clicked with Qt.LeftButton', self)
LOG.info("Checking if application context is frozen")
if not isFrozen(timeout):
pass
else:
LOG.info("Application context did not respond after click")
raise Exception(f'Application UI is not responding within {timeout} second(s)')
@allure.step('Native click {0}') @allure.step('Native click {0}')
def native_mouse_click( def native_mouse_click(