summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorDuda Dornelles <ddornell@thoughtworks.com>2014-10-27 16:38:28 +0100
committerDuda Dornelles <ddornell@thoughtworks.com>2014-10-27 16:38:35 +0100
commit4919c62e298e934771a436606c48daff08fc1381 (patch)
tree846f1c3ee5a3b0708cddbf6c11ca8dfceb85607d /service
parente73adb674be3e24d73986fc087a7b98304891884 (diff)
Attempt to fix functional tests: adding more wait_untils on the core of our selectors (like capybara), disabling mail list autoRefresh (only for functional tests) and adding some ridiculos timeout in a specific step
Diffstat (limited to 'service')
-rw-r--r--service/test/functional/features/environment.py2
-rw-r--r--service/test/functional/features/steps/common.py18
-rw-r--r--service/test/functional/features/steps/compose.py2
3 files changed, 12 insertions, 10 deletions
diff --git a/service/test/functional/features/environment.py b/service/test/functional/features/environment.py
index fa4bb308..8cfdcbbc 100644
--- a/service/test/functional/features/environment.py
+++ b/service/test/functional/features/environment.py
@@ -20,6 +20,7 @@ from selenium import webdriver
from test.support.integration_helper import SoledadTestBase
import pixelated.runserver
import logging
+import pixelated.controllers.features_controller
def before_all(context):
@@ -29,6 +30,7 @@ def before_all(context):
context.mailboxes = context.soledad_test_base.mailboxes
context.app = pixelated.runserver.app
context.app.mail_service = context.soledad_test_base.mail_service
+ pixelated.controllers.features_controller.FeaturesController.DISABLED_FEATURES.append('autoRefresh')
logging.disable('INFO')
worker = lambda app, port: pixelated.runserver.app.run(port=4567, use_reloader=False)
diff --git a/service/test/functional/features/steps/common.py b/service/test/functional/features/steps/common.py
index 26d049aa..b7aee7d6 100644
--- a/service/test/functional/features/steps/common.py
+++ b/service/test/functional/features/steps/common.py
@@ -16,7 +16,7 @@
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
-from selenium.common.exceptions import NoSuchElementException
+from selenium.common.exceptions import NoSuchElementException, TimeoutException
from hamcrest import *
@@ -25,8 +25,8 @@ def wait_until_element_is_invisible_by_locator(context, locator_tuple):
wait.until(EC.invisibility_of_element_located(locator_tuple))
-def wait_until_element_is_deleted(context, locator_tuple):
- wait = WebDriverWait(context.browser, 10)
+def wait_until_element_is_deleted(context, locator_tuple, timeout=10):
+ wait = WebDriverWait(context.browser, timeout)
wait.until(lambda s: len(s.find_elements(locator_tuple[0], locator_tuple[1])) == 0)
@@ -64,28 +64,28 @@ def page_has_css(context, css):
try:
find_element_by_css_selector(context, css)
return True
- except NoSuchElementException:
+ except TimeoutException:
return False
def find_element_by_xpath(context, xpath):
- return context.browser.find_element_by_xpath(xpath)
+ return wait_until_element_is_visible_by_locator(context, (By.XPATH, xpath))
def find_element_by_id(context, id):
- return context.browser.find_element_by_id(id)
+ return wait_until_element_is_visible_by_locator(context, (By.ID, id))
def find_element_by_css_selector(context, css_selector):
- return context.browser.find_element_by_css_selector(css_selector)
+ return wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, css_selector))
def find_elements_by_css_selector(context, css_selector):
- return context.browser.find_elements_by_css_selector(css_selector)
+ return wait_until_elements_are_visible_by_locator(context, (By.CSS_SELECTOR, css_selector))
def find_element_containing_text(context, text, element_type='*'):
- return context.browser.find_element_by_xpath("//%s[contains(.,'%s')]" % (element_type, text))
+ return find_element_by_xpath(context, "//%s[contains(.,'%s')]" % (element_type, text))
def element_should_have_content(context, css_selector, content):
diff --git a/service/test/functional/features/steps/compose.py b/service/test/functional/features/steps/compose.py
index 95b05914..cf75979e 100644
--- a/service/test/functional/features/steps/compose.py
+++ b/service/test/functional/features/steps/compose.py
@@ -66,7 +66,7 @@ def send_impl(context):
context.execute_steps(u"when I open the first mail in the mail list")
assert_that(is_not(page_has_css(context, '#send-button[disabled]')))
click_button(context, 'Send')
- wait_until_element_is_deleted(context, (By.ID, 'send-button'))
+ wait_until_element_is_deleted(context, (By.ID, 'send-button'), timeout=120)
def _enter_recipient(context, recipients_field, to_type):