def i_follow_the_link(step, link): '''Follow a link using part of the text written as the linked text. If if the link exist multiple times, the first link will be followed.''' world.etree = ElementTree.fromstring(world.responce.content) for node in world.etree.findall('.//a'): if node.text in link: address = node.attrib['href'] step.then(u'I go to the address "{0}"'.format(address))
def i_am_logged_in(step): step.given('I am in the login page') step.behave_as(''' And I fill the form with the next info: | name | value | | username | admin | | password | admin | ''') step.then('submit the form') step.then('see the logged in home page')
def opened_a_story(step): step.then('I am logged in') step.then('see the logged in home page') step.then('click on the link "Projects"') step.then('click on a project') stories = world.wait_for_many_elements('.story a', 5, 0.5) world.browser.visit('http://localhost:8000/project/1/story/4') tags = world.wait_for_many_elements('#tags', 5, 0.5) assert tags, 'This is not the story details'
def then_it_should_have_at_least_valid_result(step, num, name): step.then('it should have a list "%s"' % (name)) step.then('the list should have at least %d items' % (int(num)))
def i_should_have_as_html(step, html_output): # different step descriptions for intention-revealing purposes step.then('I should see "%s"' % html_output)
def i_go_to_the_sailing(step, sailing): """Go to a specified sailing.""" step.then('I go to the address "{0}/"'.format(sailing))
def i_go_to_the_homepage(step): """Go to the main homepage.""" step.then('I go to the address "/"')
def then_the_loan_request_is_moved_to_the_account_account_number_historic( step, account_number): step.then(u'And the loan_request is moved to the account (.+) historic')
def test_changes_not_shown_on_refresh(step): step.then('Then I see the set dates on refresh')
def see_the_logged_out_home_page(step): assert that(world.browser.title).equals('Home - AgileDjango'), 'This is no the home page.' step.then('see the link "Home"') step.then('see the link "Login"') step.then('see the link "Signup"')
def see_the_logged_in_home_page(step): assert that(world.browser.title).equals('Home - AgileDjango'), 'This is no the home page.' step.then('see the link "Home"') step.then('see the link "Projects"') step.then('see the link "Profile"') step.then('see the link "Logout"')
def see_the_login_form(step): assert that(world.browser.title).equals('Login - AgileDjango'), 'This is not the login page.' step.then('see the form field "username"') step.then('see the form field "password"')
def complex_things(step): step.then("I do something simple")
def complex_things(step): step.then('I do something simple')
def then_the_loan_request_is_moved_to_the_account_account_number_historic(step, account_number): step.then(u'And the loan_request is moved to the account (.+) historic')