diff options
author | Tulio Casagrande <tcasagra@thoughtworks.com> | 2016-12-14 14:49:23 -0200 |
---|---|---|
committer | Tulio Casagrande <tcasagra@thoughtworks.com> | 2016-12-14 14:57:49 -0200 |
commit | 66a01bde2bd8c54fd830ff94443fc860a549bc3c (patch) | |
tree | 83cb8dd4a6f93f50356b8fb7732f1a4a2ae62c93 /service/test/functional/features/steps/attachments.py | |
parent | d14cfaa1f970b623c52f0f892980057c4c81308c (diff) |
Move functional tests to find elements with waits
We were using the Selenium native find_element in a few places, which
could raise a TimeoutException. I changed to use our timed out version
and also renamed the internal methods to prevent misuse
Diffstat (limited to 'service/test/functional/features/steps/attachments.py')
-rw-r--r-- | service/test/functional/features/steps/attachments.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/service/test/functional/features/steps/attachments.py b/service/test/functional/features/steps/attachments.py index 43948016..8852b787 100644 --- a/service/test/functional/features/steps/attachments.py +++ b/service/test/functional/features/steps/attachments.py @@ -20,14 +20,12 @@ from uuid import uuid4 from behave import given, then, when from crochet import wait_for -from selenium.webdriver.common.by import By from common import ( fill_by_css_selector, find_element_by_css_selector, find_elements_by_css_selector, - page_has_css, - wait_until_element_is_visible_by_locator) + page_has_css) @given(u'I have a mail with an attachment in my inbox') @@ -71,7 +69,7 @@ def upload_big_file(context): fname = "over_5mb.data" context.browser.execute_script("$('#fileupload').removeAttr('hidden');") fill_by_css_selector(context, '#fileupload', base_dir + fname) - wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, '#upload-error-message')) + find_element_by_css_selector(context, '#upload-error-message') @then(u'I see an upload error message') @@ -100,17 +98,17 @@ def upload_attachment(context): base_dir = "test/functional/features/files/" fname = "5mb.data" fill_by_css_selector(context, '#fileupload', base_dir + fname) - attachment_list_item = wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, '#attachment-list-item li a')) + attachment_list_item = find_element_by_css_selector(context, '#attachment-list-item li a') assert attachment_list_item.text == "%s (5.00 Mb)" % fname @when(u'remove the file') def click_remove_icon(context): - remove_icon = wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, '#attachment-list-item i.remove-icon')) + remove_icon = find_element_by_css_selector(context, '#attachment-list-item i.remove-icon') remove_icon.click() @then(u'I should not see it attached') def assert_attachment_removed(context): - attachments_list_li = context.browser.find_elements(By.CSS_SELECTOR, '#attachment-list-item li a') + attachments_list_li = context.browser.find_elements_by_css_selector('#attachment-list-item li a') assert len(attachments_list_li) == 0 |