diff options
author | Alexandre Pretto Nunes <anunes@thoughtworks.com> | 2015-02-27 12:06:39 -0300 |
---|---|---|
committer | Alexandre Pretto Nunes <anunes@thoughtworks.com> | 2015-02-27 12:07:33 -0300 |
commit | a40bf0d0c6b4aae84b1c7d3e36a589d75828f0fe (patch) | |
tree | f1ba0e20d933bfff43fcaa0ac568463c8a5b7440 /service | |
parent | e90f304002cb48e2a7a44aafdd11b79a58c8cdd2 (diff) |
Allow to pass a different timeout to wait_until_* methods
Diffstat (limited to 'service')
-rw-r--r-- | service/test/functional/features/steps/common.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/service/test/functional/features/steps/common.py b/service/test/functional/features/steps/common.py index 558361d0..7848089b 100644 --- a/service/test/functional/features/steps/common.py +++ b/service/test/functional/features/steps/common.py @@ -20,8 +20,8 @@ from selenium.common.exceptions import TimeoutException from hamcrest import * -def wait_until_element_is_invisible_by_locator(context, locator_tuple): - wait = WebDriverWait(context.browser, 10) +def wait_until_element_is_invisible_by_locator(context, locator_tuple, timeout=10): + wait = WebDriverWait(context.browser, timeout) wait.until(EC.invisibility_of_element_located(locator_tuple)) @@ -30,18 +30,18 @@ def wait_until_element_is_deleted(context, locator_tuple, timeout=10): wait.until(lambda s: len(s.find_elements(locator_tuple[0], locator_tuple[1])) == 0) -def wait_for_user_alert_to_disapear(context): - wait_until_element_is_invisible_by_locator(context, (By.ID, 'user-alerts')) +def wait_for_user_alert_to_disapear(context, timeout=10): + wait_until_element_is_invisible_by_locator(context, (By.ID, 'user-alerts'), timeout) -def wait_until_elements_are_visible_by_locator(context, locator_tuple): - wait = WebDriverWait(context.browser, 10) +def wait_until_elements_are_visible_by_locator(context, locator_tuple, timeout=10): + wait = WebDriverWait(context.browser, timeout) wait.until(EC.presence_of_all_elements_located(locator_tuple)) return context.browser.find_elements(locator_tuple[0], locator_tuple[1]) -def wait_until_element_is_visible_by_locator(context, locator_tuple): - wait = WebDriverWait(context.browser, 10) +def wait_until_element_is_visible_by_locator(context, locator_tuple, timeout=10): + wait = WebDriverWait(context.browser, timeout) wait.until(EC.visibility_of_element_located(locator_tuple)) return context.browser.find_element(locator_tuple[0], locator_tuple[1]) @@ -93,8 +93,8 @@ def element_should_have_content(context, css_selector, content): assert_that(e.text, equal_to(content)) -def wait_until_button_is_visible(context, title): - wait = WebDriverWait(context.browser, 10) +def wait_until_button_is_visible(context, title, timeout=10): + wait = WebDriverWait(context.browser, timeout) locator_tuple = (By.XPATH, ("//%s[contains(.,'%s')]" % ('button', title))) wait.until(EC.visibility_of_element_located(locator_tuple)) |