summaryrefslogtreecommitdiff
path: root/service/test/functional/features/steps/common.py
diff options
context:
space:
mode:
authorDuda Dornelles <ddornell@thoughtworks.com>2014-10-27 16:38:28 +0100
committerDuda Dornelles <ddornell@thoughtworks.com>2014-10-27 16:38:35 +0100
commit4919c62e298e934771a436606c48daff08fc1381 (patch)
tree846f1c3ee5a3b0708cddbf6c11ca8dfceb85607d /service/test/functional/features/steps/common.py
parente73adb674be3e24d73986fc087a7b98304891884 (diff)
Attempt to fix functional tests: adding more wait_untils on the core of our selectors (like capybara), disabling mail list autoRefresh (only for functional tests) and adding some ridiculos timeout in a specific step
Diffstat (limited to 'service/test/functional/features/steps/common.py')
-rw-r--r--service/test/functional/features/steps/common.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/service/test/functional/features/steps/common.py b/service/test/functional/features/steps/common.py
index 26d049aa..b7aee7d6 100644
--- a/service/test/functional/features/steps/common.py
+++ b/service/test/functional/features/steps/common.py
@@ -16,7 +16,7 @@
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
-from selenium.common.exceptions import NoSuchElementException
+from selenium.common.exceptions import NoSuchElementException, TimeoutException
from hamcrest import *
@@ -25,8 +25,8 @@ def wait_until_element_is_invisible_by_locator(context, locator_tuple):
wait.until(EC.invisibility_of_element_located(locator_tuple))
-def wait_until_element_is_deleted(context, locator_tuple):
- wait = WebDriverWait(context.browser, 10)
+def wait_until_element_is_deleted(context, locator_tuple, timeout=10):
+ wait = WebDriverWait(context.browser, timeout)
wait.until(lambda s: len(s.find_elements(locator_tuple[0], locator_tuple[1])) == 0)
@@ -64,28 +64,28 @@ def page_has_css(context, css):
try:
find_element_by_css_selector(context, css)
return True
- except NoSuchElementException:
+ except TimeoutException:
return False
def find_element_by_xpath(context, xpath):
- return context.browser.find_element_by_xpath(xpath)
+ return wait_until_element_is_visible_by_locator(context, (By.XPATH, xpath))
def find_element_by_id(context, id):
- return context.browser.find_element_by_id(id)
+ return wait_until_element_is_visible_by_locator(context, (By.ID, id))
def find_element_by_css_selector(context, css_selector):
- return context.browser.find_element_by_css_selector(css_selector)
+ return wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, css_selector))
def find_elements_by_css_selector(context, css_selector):
- return context.browser.find_elements_by_css_selector(css_selector)
+ return wait_until_elements_are_visible_by_locator(context, (By.CSS_SELECTOR, css_selector))
def find_element_containing_text(context, text, element_type='*'):
- return context.browser.find_element_by_xpath("//%s[contains(.,'%s')]" % (element_type, text))
+ return find_element_by_xpath(context, "//%s[contains(.,'%s')]" % (element_type, text))
def element_should_have_content(context, css_selector, content):