summaryrefslogtreecommitdiff
path: root/service/test/functional/features/steps/compose.py
diff options
context:
space:
mode:
authorTiago Ferraz <tiago.ferraz@gmail.com>2015-03-09 16:14:50 -0300
committerTiago Ferraz <tiago.ferraz@gmail.com>2015-03-09 16:14:50 -0300
commit6b5de66fc5adc3c62a92738e9f317c4b1335f838 (patch)
tree09ad2b63806e9f72f10fee0c7e6825578ff4cd69 /service/test/functional/features/steps/compose.py
parenta9a8a7330756d2fe9b6607dc670841b0ecfa64c5 (diff)
Refactoring of fuctional tests
The scenarios were updated to follow the conventions of gherkin steps. Removal of duplicated code.
Diffstat (limited to 'service/test/functional/features/steps/compose.py')
-rw-r--r--service/test/functional/features/steps/compose.py20
1 files changed, 4 insertions, 16 deletions
diff --git a/service/test/functional/features/steps/compose.py b/service/test/functional/features/steps/compose.py
index cf75979e..aeef11c4 100644
--- a/service/test/functional/features/steps/compose.py
+++ b/service/test/functional/features/steps/compose.py
@@ -20,7 +20,7 @@ from common import *
from hamcrest import *
-@given('I compose a message with')
+@when('I compose a message with')
def impl(context):
take_screenshot(context, '/tmp/screenshot.jpeg')
toggle = context.browser.find_element_by_id('compose-mails-trigger')
@@ -31,31 +31,19 @@ def impl(context):
fill_by_xpath(context, '//*[@id="text-box"]', row['body'])
-@given("for the '{recipients_field}' field I type '{to_type}' and chose the first contact that shows")
-def choose_impl(context, recipients_field, to_type):
- browser = context.browser
- browser.find_element_by_css_selector('#recipients-to-area span input.tt-input').click()
- recipients_field = recipients_field.lower()
- css_selector = '#recipients-%s-area' % recipients_field
- recipients_element = browser.find_element_by_css_selector(css_selector)
- recipients_element.find_element_by_css_selector('.tt-input').send_keys(to_type)
- wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, '.tt-dropdown-menu div div'))
- browser.find_element_by_css_selector('.tt-dropdown-menu div div').click()
-
-
-@given("for the '{recipients_field}' field I enter '{to_type}'")
+@when("for the '{recipients_field}' field I enter '{to_type}'")
def enter_address_impl(context, recipients_field, to_type):
_enter_recipient(context, recipients_field, to_type + "\n")
-@then("for the '{recipients_field}' field I type '{to_type}' and chose the first contact that shows")
+@when("for the '{recipients_field}' field I type '{to_type}' and chose the first contact that shows")
def choose_impl(context, recipients_field, to_type):
_enter_recipient(context, recipients_field, to_type)
sleep(1)
find_element_by_css_selector(context, '.tt-dropdown-menu div div').click()
-@given('I save the draft')
+@when('I save the draft')
def save_impl(context):
context.browser.find_element_by_id('draft-button').click()