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/compose.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/compose.py')
-rw-r--r-- | service/test/functional/features/steps/compose.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/service/test/functional/features/steps/compose.py b/service/test/functional/features/steps/compose.py index c72b25e2..1dab1b6d 100644 --- a/service/test/functional/features/steps/compose.py +++ b/service/test/functional/features/steps/compose.py @@ -16,17 +16,15 @@ from time import sleep from behave import when -from selenium.webdriver.common.by import By from common import ( fill_by_css_selector, - wait_until_element_is_visible_by_locator, find_element_by_css_selector) @when('I compose a message with') def impl(context): - toggle = context.browser.find_element_by_id('compose-mails-trigger') + toggle = find_element_by_css_selector(context, '#compose-mails-trigger') toggle.click() for row in context.table: @@ -48,18 +46,17 @@ def choose_impl(context, recipients_field, to_type): @when('I send it') def send_impl(context): - send_button = wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, '#send-button:enabled')) + send_button = find_element_by_css_selector(context, '#send-button:enabled') send_button.click() @when(u'I toggle the cc and bcc fields') def collapse_cc_bcc_fields(context): - cc_and_bcc_chevron = wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, '#cc-bcc-collapse')) + cc_and_bcc_chevron = find_element_by_css_selector(context, '#cc-bcc-collapse') cc_and_bcc_chevron.click() def _enter_recipient(context, recipients_field, to_type): recipients_field = recipients_field.lower() - browser = context.browser - field = browser.find_element_by_css_selector('#recipients-%s-area .tt-input' % recipients_field) + field = find_element_by_css_selector(context, '#recipients-%s-area .tt-input' % recipients_field) field.send_keys(to_type) |