diff options
author | Tiago Ferraz <tiago.ferraz@gmail.com> | 2015-03-23 10:27:39 -0300 |
---|---|---|
committer | Tiago Ferraz <tiago.ferraz@gmail.com> | 2015-03-26 12:12:40 -0300 |
commit | aab5c4e3f721431591f3709cecb2e2e58ab9774e (patch) | |
tree | c9d46bb5378bf77c8b20dcb1adc798e0ce7b5b2c /service/test/functional/features/steps/common.py | |
parent | 68a0f94cd15b661caa2b4ea87eef55972c8bff25 (diff) |
New test that use checkboxes. Removal of hamcrest lib, code refactoring.
A new test was created to use Pixelated checkboxes and the buttons at
the top. Also the lib hamcrest was removed and code refactored to be
more pythonic. A new method after_step will log information in case of
step failures.
Diffstat (limited to 'service/test/functional/features/steps/common.py')
-rw-r--r-- | service/test/functional/features/steps/common.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/service/test/functional/features/steps/common.py b/service/test/functional/features/steps/common.py index 7848089b..ee2a6f9a 100644 --- a/service/test/functional/features/steps/common.py +++ b/service/test/functional/features/steps/common.py @@ -17,7 +17,8 @@ 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 TimeoutException -from hamcrest import * + +from test.support.integration import MailBuilder def wait_until_element_is_invisible_by_locator(context, locator_tuple, timeout=10): @@ -40,6 +41,12 @@ def wait_until_elements_are_visible_by_locator(context, locator_tuple, timeout=1 return context.browser.find_elements(locator_tuple[0], locator_tuple[1]) +def wait_until_elements_are_visible_by_xpath(context, locator_tuple, timeout=10): + wait = WebDriverWait(context.browser, timeout) + wait.until(EC.presence_of_all_elements_located(locator_tuple)) + return context.browser.find_elements(locator_tuple[0], locator_tuple[1]) + + def wait_until_element_is_visible_by_locator(context, locator_tuple, timeout=10): wait = WebDriverWait(context.browser, timeout) wait.until(EC.visibility_of_element_located(locator_tuple)) @@ -84,13 +91,17 @@ def find_elements_by_css_selector(context, css_selector): return wait_until_elements_are_visible_by_locator(context, (By.CSS_SELECTOR, css_selector)) +def find_elements_by_xpath(context, xpath): + return wait_until_elements_are_visible_by_xpath(context, (By.XPATH, xpath)) + + def find_element_containing_text(context, text, element_type='*'): return find_element_by_xpath(context, "//%s[contains(.,'%s')]" % (element_type, text)) def element_should_have_content(context, css_selector, content): e = find_element_by_css_selector(context, css_selector) - assert_that(e.text, equal_to(content)) + assert e.text == content def wait_until_button_is_visible(context, title, timeout=10): @@ -120,3 +131,8 @@ def get_console_log(context): msg = entry['message'] if not (msg.startswith('x off') or msg.startswith('<- on')): print entry['message'] + + +def create_email(context): + input_mail = MailBuilder().build_input_mail() + context.client.add_mail_to_inbox(input_mail)
\ No newline at end of file |