summaryrefslogtreecommitdiff
path: root/service/test/functional
diff options
context:
space:
mode:
authorFolker Bernitt <fbernitt@thoughtworks.com>2014-10-15 10:39:04 +0200
committerFolker Bernitt <fbernitt@thoughtworks.com>2014-10-16 09:57:28 +0200
commit693957054255b1807ae9c09478a06e191114b7fb (patch)
tree5afdbb556dccc69f2727c87a14fbd826a4fcc2ad /service/test/functional
parentb23df828897bb6c0a52804914c35873ea4b09e9d (diff)
Added some wait until visible to functional tests to make them more stable.
Diffstat (limited to 'service/test/functional')
-rw-r--r--service/test/functional/features/steps/common.py6
-rw-r--r--service/test/functional/features/steps/mail_list.py2
-rw-r--r--service/test/functional/features/steps/mail_view.py1
3 files changed, 8 insertions, 1 deletions
diff --git a/service/test/functional/features/steps/common.py b/service/test/functional/features/steps/common.py
index 015c24ef..26d049aa 100644
--- a/service/test/functional/features/steps/common.py
+++ b/service/test/functional/features/steps/common.py
@@ -34,6 +34,12 @@ def wait_for_user_alert_to_disapear(context):
wait_until_element_is_invisible_by_locator(context, (By.ID, 'user-alerts'))
+def wait_until_elements_are_visible_by_locator(context, locator_tuple):
+ wait = WebDriverWait(context.browser, 10)
+ 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)
wait.until(EC.visibility_of_element_located(locator_tuple))
diff --git a/service/test/functional/features/steps/mail_list.py b/service/test/functional/features/steps/mail_list.py
index a1c83848..6a764568 100644
--- a/service/test/functional/features/steps/mail_list.py
+++ b/service/test/functional/features/steps/mail_list.py
@@ -42,7 +42,7 @@ def impl(context):
@when('I open the first mail in the mail list')
def impl(context):
- elements = context.browser.find_elements_by_xpath('//*[@id="mail-list"]//a')
+ elements = wait_until_elements_are_visible_by_locator(context, (By.XPATH, '//*[@id="mail-list"]//a'))
context.current_mail_id = elements[0].get_attribute('href').split('/')[-1]
elements[0].click()
diff --git a/service/test/functional/features/steps/mail_view.py b/service/test/functional/features/steps/mail_view.py
index a127b62c..a7586931 100644
--- a/service/test/functional/features/steps/mail_view.py
+++ b/service/test/functional/features/steps/mail_view.py
@@ -32,6 +32,7 @@ def impl(context, expected_body):
@then('that email has the \'{tag}\' tag')
def impl(context, tag):
+ wait_until_element_is_visible_by_locator(context, (By.CSS, '#mail-view .tagsArea .tag'))
elements = find_elements_by_css_selector(context, '#mail-view .tagsArea .tag')
tags = [e.text for e in elements]
assert_that(tags, has_item(tag.upper()))