summaryrefslogtreecommitdiff
path: root/service/test/functional/features/steps/common.py
diff options
context:
space:
mode:
authorFolker Bernitt <fbernitt@thoughtworks.com>2015-09-10 14:54:45 +0200
committerFolker Bernitt <fbernitt@thoughtworks.com>2015-09-10 14:54:45 +0200
commitd411d38b8160e48540ee13e36fdfd6d06b8709c8 (patch)
tree04130fa2398736e4d277ebbde42e2e2269a0937a /service/test/functional/features/steps/common.py
parentf9ac80e67e0a6d27a41316bee52e554d67fe3cbd (diff)
Add 'with ImplicitWait' to allow shorter timeouts
- necessary if elements do not exist, selenium seems to wait the entire explict timeout in this case
Diffstat (limited to 'service/test/functional/features/steps/common.py')
-rw-r--r--service/test/functional/features/steps/common.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/service/test/functional/features/steps/common.py b/service/test/functional/features/steps/common.py
index b45f86db..d9db92b0 100644
--- a/service/test/functional/features/steps/common.py
+++ b/service/test/functional/features/steps/common.py
@@ -28,9 +28,22 @@ LOADING = 'loading'
TIMEOUT_IN_S = 20
+DEFAULT_IMPLICIT_WAIT_TIMEOUT_IN_S = 10.0
+
+
+class ImplicitWait(object):
+ def __init__(self, context, timeout=5.0):
+ self._context = context
+ self._timeout = timeout
+
+ def __enter__(self):
+ self._context.browser.implicitly_wait(self._timeout)
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ self._context.browser.implicitly_wait(DEFAULT_IMPLICIT_WAIT_TIMEOUT_IN_S)
+
def wait_until_element_is_invisible_by_locator(context, locator_tuple, timeout=TIMEOUT_IN_S):
- spend_time_in_reactor()
wait = WebDriverWait(context.browser, timeout)
wait.until(EC.invisibility_of_element_located(locator_tuple))