signup.py 1.15 KB
Newer Older
1 2
#pylint: disable=C0111
#pylint: disable=W0621
3

4
from lettuce import world, step
Calen Pennington committed
5

6

7 8
@step('I fill in "([^"]*)" on the registration form with "([^"]*)"$')
def when_i_fill_in_field_on_the_registration_form_with_value(step, field, value):
9 10 11 12 13
    def fill_in_registration():
        register_form = world.browser.find_by_css('form#register-form')
        form_field = register_form.find_by_name(field)
        form_field.fill(value)
    world.retry_on_exception(fill_in_registration)
14

Calen Pennington committed
15

16 17
@step('I submit the registration form$')
def i_press_the_button_on_the_registration_form(step):
18 19 20 21
    def submit_registration():
        register_form = world.browser.find_by_css('form#register-form')
        register_form.find_by_name('submit').click()
    world.retry_on_exception(submit_registration)
22

Calen Pennington committed
23

24 25
@step('I check the checkbox named "([^"]*)"$')
def i_check_checkbox(step, checkbox):
26 27
    css_selector = 'input[name={}]'.format(checkbox)
    world.css_check(css_selector)
28

Calen Pennington committed
29

30 31 32
@step('I should see "([^"]*)" in the dashboard banner$')
def i_should_see_text_in_the_dashboard_banner_section(step, text):
    css_selector = "section.dashboard-banner h2"
33
    assert (text in world.css_text(css_selector))