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/tag_list.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/tag_list.py')
-rw-r--r-- | service/test/functional/features/steps/tag_list.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/service/test/functional/features/steps/tag_list.py b/service/test/functional/features/steps/tag_list.py index b9adea0a..daea416d 100644 --- a/service/test/functional/features/steps/tag_list.py +++ b/service/test/functional/features/steps/tag_list.py @@ -15,13 +15,12 @@ # along with Pixelated. If not, see <http://www.gnu.org/licenses/>. from behave import when from selenium.common.exceptions import TimeoutException -from selenium.webdriver.common.by import By from common import ( find_element_by_class_name, find_element_by_id, - wait_for_user_alert_to_disapear, - wait_until_element_is_visible_by_locator) + find_element_by_css_selector, + wait_for_user_alert_to_disapear) def click_first_element_with_class(context, classname): @@ -52,12 +51,12 @@ def impl(context, tag): success = False while (not success) and (try_again > 0): try: - wait_until_element_is_visible_by_locator(context, (By.ID, 'tag-%s' % tag), timeout=20) + find_element_by_css_selector(context, '#tag-%s' % tag) e = find_element_by_id(context, 'tag-%s' % tag) e.click() - wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, ".mail-list-entry__item[href*='%s']" % tag), timeout=20) + find_element_by_css_selector(context, ".mail-list-entry__item[href*='%s']" % tag) success = True except TimeoutException: pass @@ -71,6 +70,6 @@ def impl(context, tag): def impl(context, tag): expand_side_nav(context) - wait_until_element_is_visible_by_locator(context, (By.ID, 'tag-%s' % tag), 20) + find_element_by_css_selector(context, '#tag-%s' % tag) e = find_element_by_id(context, 'tag-%s' % tag) assert "selected" in e.get_attribute("class") |