summaryrefslogtreecommitdiff
path: root/service/test
diff options
context:
space:
mode:
authorFolker Bernitt <fbernitt@thoughtworks.com>2015-09-11 10:33:30 +0200
committerFolker Bernitt <fbernitt@thoughtworks.com>2015-09-11 10:47:40 +0200
commit8361de4a35bd6ca118e9ec3fa0bffc847eaffd3c (patch)
tree5240e0257a2d9e16cea83006d37a510ae233be55 /service/test
parent4e55ebefb0792c3d40db60f2d246d35e2df5fd00 (diff)
Wait for content to become available before checking class attribute
- Issue #456 - Added new find_element_by_class_name method
Diffstat (limited to 'service/test')
-rw-r--r--service/test/functional/features/steps/common.py4
-rw-r--r--service/test/functional/features/steps/tag_list.py12
2 files changed, 10 insertions, 6 deletions
diff --git a/service/test/functional/features/steps/common.py b/service/test/functional/features/steps/common.py
index d9db92b0..b53359dc 100644
--- a/service/test/functional/features/steps/common.py
+++ b/service/test/functional/features/steps/common.py
@@ -122,6 +122,10 @@ def find_element_by_css_selector(context, css_selector):
return wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, css_selector))
+def find_element_by_class_name(context, class_name):
+ return wait_until_element_is_visible_by_locator(context, (By.CLASS_NAME, class_name))
+
+
def find_elements_by_css_selector(context, css_selector):
return wait_until_elements_are_visible_by_locator(context, (By.CSS_SELECTOR, css_selector))
diff --git a/service/test/functional/features/steps/tag_list.py b/service/test/functional/features/steps/tag_list.py
index 443c5173..35b03513 100644
--- a/service/test/functional/features/steps/tag_list.py
+++ b/service/test/functional/features/steps/tag_list.py
@@ -17,20 +17,20 @@ from common import *
def click_first_element_with_class(context, classname):
- elements = context.browser.find_elements_by_class_name(classname)
- elements[0].click()
+ element = find_element_by_class_name(context, classname)
+ element.click()
def is_side_nav_expanded(context):
- e = context.browser.find_elements_by_class_name('content')[0].get_attribute('class').count(u'move-right') == 1
- return e
+ e = find_element_by_class_name(context, 'content')
+ return u'move-right' in e.get_attribute("class")
def expand_side_nav(context):
if is_side_nav_expanded(context):
return
- toggle = context.browser.find_elements_by_class_name('side-nav-toggle')[0]
+ toggle = find_element_by_class_name(context, 'side-nav-toggle')
toggle.click()
@@ -39,7 +39,7 @@ def impl(context, tag):
wait_for_user_alert_to_disapear(context)
expand_side_nav(context)
- wait_until_element_is_visible_by_locator(context, (By.ID, 'tag-%s' % tag), 20)
+ wait_until_element_is_visible_by_locator(context, (By.ID, 'tag-%s' % tag), timeout=20)
e = find_element_by_id(context, 'tag-%s' % tag)
e.click()