diff options
author | Alexandre Pretto Nunes <anunes@thoughtworks.com> | 2015-02-27 12:07:23 -0300 |
---|---|---|
committer | Alexandre Pretto Nunes <anunes@thoughtworks.com> | 2015-02-27 12:07:33 -0300 |
commit | 169e848b298baff4386ef6ecb63615fa8a347e24 (patch) | |
tree | 813c0d26454a7107bde1e3f1e4268dc0ed5ab447 /service/test/functional/features/steps | |
parent | a40bf0d0c6b4aae84b1c7d3e36a589d75828f0fe (diff) |
Make tests involving adding and selecting tags more robust
Diffstat (limited to 'service/test/functional/features/steps')
-rw-r--r-- | service/test/functional/features/steps/mail_view.py | 1 | ||||
-rw-r--r-- | service/test/functional/features/steps/tag_list.py | 22 |
2 files changed, 21 insertions, 2 deletions
diff --git a/service/test/functional/features/steps/mail_view.py b/service/test/functional/features/steps/mail_view.py index ca0d68dc..46e01515 100644 --- a/service/test/functional/features/steps/mail_view.py +++ b/service/test/functional/features/steps/mail_view.py @@ -46,6 +46,7 @@ def impl(context, tag): e = wait_until_element_is_visible_by_locator(context, (By.ID, 'new-tag-input')) e.send_keys(tag) e.send_keys(Keys.ENTER) + wait_until_element_is_visible_by_locator(context, (By.XPATH, '//li[@data-tag="%s"]' % tag)) @then('I reply to it') diff --git a/service/test/functional/features/steps/tag_list.py b/service/test/functional/features/steps/tag_list.py index 64749c8e..c50387f0 100644 --- a/service/test/functional/features/steps/tag_list.py +++ b/service/test/functional/features/steps/tag_list.py @@ -21,10 +21,28 @@ def click_first_element_with_class(context, classname): elements[0].click() +def is_side_nax_expanded(context): + return context.browser.find_elements_by_class_name('content')[0].get_attribute('class').count(u'move-right') == 1 + + +def ensure_side_nav_is_expanded(context): + if is_side_nax_expanded(context): + return + + toggle = context.browser.find_elements_by_class_name('side-nav-toggle')[0] + toggle.click() + + wait = WebDriverWait(context, 5) + wait.until(is_side_nax_expanded) + + @when('I select the tag \'{tag}\'') def impl(context, tag): wait_for_user_alert_to_disapear(context) - click_first_element_with_class(context, 'side-nav-toggle') - context.browser.execute_script("window.scrollBy(0, -200)") + + ensure_side_nav_is_expanded(context) + + wait_until_element_is_visible_by_locator(context, (By.ID, 'tag-%s' % tag.lower()), 20) + e = find_element_by_id(context, 'tag-%s' % tag.lower()) e.click() |