def create_seed_testcycle_testcases_testrun(step):
    '''
        Bug in lettuce prevents me from using this technique

    '''

    step.behave_as("""
        Given I create the seed company and product with these names:
            | company name    | product name  |
            | Massive Dynamic | Cortexiphan   |
        When I create a new user with name "Capn Admin"
        and I activate the user with that name
        And I create a new role with name "Approvationalist" with the following permissions:
            | permissionCode               |
            | PERMISSION_TEST_CASE_EDIT    |
            | PERMISSION_TEST_CASE_APPROVE |
        And I add the role with name "Approvationalist" to the user with that name
        when the user with that name creates a new testcase with name "Check the Gizmo"
        and when I add these steps to the testcase with that name:
            | name      | stepNumber | estimatedTimeInMin | instruction    | expectedResult        |
            | Mockery   | 1          | 5                  | Go this way    | They went this way    |
            | Flockery  | 2          | 2                  | Go that way    | They went that way    |
            | Chockery  | 3          | 4                  | Go my way      | They went my way      |
            | Trockery  | 4          | 1                  | Go the highway | They went the highway |
            | Blockery  | 5          | 25                 | Just go away   | They went away        |
        Then when I create a new user with name "Joe Approver"
        and I activate the user with that name
        And I add the role with name "Approvationalist" to the user with that name
        and when the user with name "Joe Approver" approves the testcase with that name
        And when I create the following new testcycles:
            | name          | description               | product name | startDate  | endDate    | communityAuthoringAllowed | communityAccessAllowed |
            | Baroque Cycle | Ahh, the cycle of life... | Cortexiphan  | 2011/02/02 | 2012/02/02 | true                      | true                   |
        and when I create a new testrun with name "Running Man" with testcycle "Baroque Cycle"
    """)
示例#2
0
def do_all_checks_to_verify_nova_enviroment(step):
    step.behave_as("""
        Check user "osth-user-admin" exist
        Check project "osth-test-project" exist for user "osth-user-admin"
        Check network "10.222.0.0/24" exist
        Check novarc function for project "osth-test-project", user "osth-user-admin"
        """)
示例#3
0
def go_to_module(step, module):
    
    step.behave_as("""
    Given I go to the desk
        And I click on the element with the css selector "{}"
        And I wait for ajax
    """.format(selector))
def multiply_X_and_Y_into_the_calculator(step, x, y):
    step.behave_as('''
    Given I multiply these numbers:
      | number |
      | 55     |
      | 2      |
    '''.format(x, y))
示例#5
0
def select_frappe_field(step, option, selector):
    step.behave_as("""
        Given I scroll to "{selector}"
            And I click on the element with the xpath "{option}"
            And I hit the ESCAPE key
    """.format(selector="select[data-fieldname='{}']".format(selector), 
                option="//option[@value='{}']".format(option)))
def multiply_X_and_Y_into_the_calculator(step, x, y):
    step.behave_as('''
    Given I multiply these numbers:
      | number |
      | 55     |
      | 2      |
    '''.format(x, y))
示例#7
0
def given_i_am_a_plan_user(step, plan):
    plan = plan.replace(' ', '').lower()
    step.behave_as("""
    Given user "test" with password "pass" is logged in
    And I have the "Self Service Vaults" feature enabled
    And I am on the "%s" plan
    """ % plan)
示例#8
0
 def two_subordinate_steps(step):
     step.behave_as(
         """
         When I run the first sub-step
         And I run the second sub-step
     """
     )
def and_i_create_a_scraper(step):
    step.behave_as("""
        And I am on the home page
        And I click the "New Scraper" link
        And I choose to write my scraper in "Python"
        Then I should be on the python scraper code editing page
    """)
示例#10
0
def do_all_to_set_up_nova(step):
    step.behave_as("""
        Create admin user "osth-user-admin"
        Create project "osth-test-project" for user "osth-user-admin"
        Create network "10.222.0.0/24" with "1" nets, "256" ips per network
        Check novarc function for project "osth-test-project", user "osth-user-admin"
        """)
def user_no_scrapers(step):
    # Not logged in.
    world.browser.visit(django_url('/profiles/subject/'))
    assert world.browser.is_text_present('no scrapers')
    # As of 2012-04-16 user 'subject' has no scrapers.
    step.behave_as("""
    Given user "subject" with password "pass" is logged in
    """)
示例#12
0
def create_and_login(step, username, password):
    step.behave_as("""
    Given there is a username "%(username)s" with password "%(password)s"
    """ % locals())
    world.browser.visit(django_url('/docs/'))
    l = world.FakeLogin()
    cookie_data = l.login(username, password) 
    world.browser.driver.add_cookie(cookie_data)
def profile_page(step):
    step.behave_as("""
        And I am on the contact page
        """)
    # find URL to profile page
    el = world.browser.find_by_xpath(
      "//a[contains(@href, '/profiles/')]").first
    world.browser.visit(el['href'])
示例#14
0
def create_and_login(step, username, password):
    step.behave_as("""
    Given there is a username "%(username)s" with password "%(password)s"
    """ % locals())
    world.browser.visit(django_url('/contact/'))
    l = world.FakeLogin()
    cookie_data = l.login(username, password) 
    world.browser.driver.add_cookie(cookie_data)
示例#15
0
def profile_page(step):
    step.behave_as("""
        And I am on the contact page
        """)
    # find URL to profile page
    el = world.browser.find_by_xpath(
        "//a[contains(@href, '/profiles/')]").first
    world.browser.visit(el['href'])
示例#16
0
def user_no_scrapers(step):
    # Not logged in.
    world.browser.visit(django_url('/profiles/subject/'))
    assert world.browser.is_text_present('no scrapers')
    # As of 2012-04-16 user 'subject' has no scrapers.
    step.behave_as("""
    Given user "subject" with password "pass" is logged in
    """)
示例#17
0
def add_child(step, table):
    step.behave_as(
        """
        Given I scrool to "{selector}
            And I click on the element with the css selector "{selector}"
    """.format(
            selector="[data-fieldname='{}'] .grid-row-open .btn-success".format(table)
        )
    )
def and_i_create_a_scraper(step):
    step.behave_as(
        """
        And I am on the home page
        And I click the "New Scraper" link
        And I choose to write my scraper in "Python"
        Then I should be on the python scraper code editing page
    """
    )
示例#19
0
def having_new_package(step, pkg_type):
    if pkg_type == 'new':
        patched = ''
    else:
        patched = ' with patched script'
    step.behave_as("""
        Given I have a copy of the branch{patched}
        Then I wait for new package was built
    """.format(patched=patched))
示例#20
0
def having_new_package(step, pkg_type):
    if pkg_type == 'new':
        patched = ''
    else:
        patched = ' with patched script'
    step.behave_as("""
        Given I have a copy of the branch{patched}
        Then I wait for new package was built
    """.format(patched=patched))
def multiply_X_and_Y_into_the_calculator(step, x, y):
    step.behave_as(
        """
    Given I have entered {0} into the calculator
    And I have entered {1} into the calculator
    And I press multiply
    """.format(
            x, y
        )
    )
示例#22
0
def send_mail(step, mail_title):
    step.behave_as("""
        首先 用户使用正确的用户名[email protected]密码xxxxxxxxxxxx登陆
        当 用户点击写信按钮
        并且 输入当前用户的邮箱地址,作为收件人地址
        并且 输入邮件主题为{0}
        并且 输入邮件正文 这是脚本发送的邮件,可以删除
        并且 点击发送按钮
        那么 页面提示发送成功
    """.format(mail_title))
示例#23
0
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')
示例#24
0
def fill_frappe_field(step, selector, value):
    step.behave_as(
        """
        Given I scroll to "{selector}" 
            And I click on the field with the css selector "{selector}"
            And I fill in the field with the css selector "{selector}" with "{value}"
    """.format(
            selector="input[data-fieldname='{}']".format(selector), value=value
        )
    )
示例#25
0
def select_frappe_field(step, option, selector):
    step.behave_as(
        """
        Given I scroll to "{selector}"
            And I click on the element with the xpath "{option}"
            And I hit the ESCAPE key
    """.format(
            selector="select[data-fieldname='{}']".format(selector), option="//option[@value='{}']".format(option)
        )
    )
示例#26
0
def i_have_entered_my_payment_details(step):
    # Using Credit Card details for the recurly test gateway:
    # http://docs.recurly.com/payment-gateways/test-gateway
    step.behave_as("""
      When I enter my contact information
      And I enter "Test Testinator" as the billing name
      And I enter "02/13" as the expiry month and year
      And I enter "4111-1111-1111-1111" as the credit card number
      And I enter "666" as the CVV
      And I enter the billing address
      """)
示例#27
0
def i_have_entered_my_payment_details(step):
    # Using Credit Card details for the recurly test gateway:
    # http://docs.recurly.com/payment-gateways/test-gateway
    step.behave_as("""
      When I enter my contact information
      And I enter "Test Testinator" as the billing name
      And I enter "02/13" as the expiry month and year
      And I enter "4111-1111-1111-1111" as the credit card number
      And I enter "666" as the CVV
      And I enter the billing address
      """)
示例#28
0
def go_to_module(step, module):

    step.behave_as(
        """
    Given I go to the desk
        And I click on the element with the css selector "{}"
        And I wait for ajax
    """.format(
            selector
        )
    )
示例#29
0
def is_logged_in(step, user, pwd):
    step.behave_as(
        """
        Given I go to the home page
            And I click on the link with the text "Login"
            And I wait 1 second
            And I click on the field with the id "login_email"
            And I fill in the field with id "login_email" with "{user}"
            And I click on the field with the id "login_password"
            And I fill in the field with id "login_password" with "{pwd}"
            And I click the button with the css selector ".btn-login"
            And I wait 2 seconds
        """.format(user=user, pwd=pwd)
    )
示例#30
0
def i_have_logged_in_a_participant(step):
    if world.using_selenium:
        step.behave_as("""
        When I access the url "/"
        When I click the "Let's get started!" link
        When I click the "Counsel" link
        When I fill in "test" in the "name" form field
        When I fill in "test" in the "id_number" form field
        When I submit the "login-participant-form" form
        Then I am on the Intervention page
    """)
    else:
        response = world.client.post(django_url('/set_participant/'), {'name': 'test', 'id_number': 'test'})
        world.participant = Participant.objects.filter(name='test')[0]
示例#31
0
def i_m_logged_in(step, name):
    if ':' in name:
        login, password = name.split(':',1)
    else:
        login, password = name, name

    step.behave_as("""
    Given I connect to /login
    Then I expect HTML
    When I select login_form form
    When I set login_name = %(login)s
    When I set login_password = %(passwd)s
    When I submit
    Then I expect HTML
    """.format({'login': login, 'passwd': password}))
示例#32
0
def is_logged_in(step, user, pwd):
    step.behave_as(
        """
        Given I go to the home page
            And I click on the link with the text "Login"
            And I wait 1 second
            And I click on the field with the id "login_email"
            And I fill in the field with id "login_email" with "{user}"
            And I click on the field with the id "login_password"
            And I fill in the field with id "login_password" with "{pwd}"
            And I click the button with the css selector ".btn-login"
            And I wait 2 seconds
        """.format(
            user=user, pwd=pwd
        )
    )
示例#33
0
def havinng_installed_scalarizr(step, version=None, serv_as=None):
    version = (version or '').replace("'", '')
    setattr(world, serv_as, None)
    if version:
        setattr(world, 'default_agent', version.strip())
    step.behave_as("""
        Given I have a clean image
        And I add image to the new role
        When I have a an empty running farm
        Then I add created role to the farm
        And I see pending server {serv_as}
        When I install scalarizr {version} to the server {serv_as}{manually}
        Then I forbid {pkg_type}scalarizr update at startup and run it on {serv_as}
        And I wait and see running server {serv_as}""".format(
            version=version,
            serv_as=serv_as,
            pkg_type='legacy ' if version.strip() == '3.8.5' else 'msi ',
            manually='' if version else ' manually'))
示例#34
0
def havinng_installed_scalarizr(step, version=None, serv_as=None):
    version = (version or '').replace("'", '')
    setattr(world, serv_as, None)
    if version:
        setattr(world, 'default_agent', version.strip())
    step.behave_as("""
        Given I have a clean image
        And I add image to the new role
        When I have a an empty running farm
        Then I add created role to the farm
        And I see pending server {serv_as}
        When I install scalarizr {version} to the server {serv_as}{manually}
        Then I forbid {pkg_type}scalarizr update at startup and run it on {serv_as}
        And I wait and see running server {serv_as}""".format(
            version=version,
            serv_as=serv_as,
            pkg_type='legacy ' if version.strip() == '3.8.5' else 'msi ',
            manually='' if version else ' manually'))
示例#35
0
def configure_roles_in_testenv(step):
    index = 0
    for role_opts in step.hashes:
        step.behave_as("""
            And I have configured revizor environment:
                | name           | value       |
                | platform       | {platform}  |
                | dist           | {dist}      |
                | branch         | {branch}    |
                | ci_repo        | {ci_repo}   |
            And I add role to this farm""".format(
                platform=role_opts['platform'],
                dist=role_opts['dist'],
                branch=role_opts['branch'],
                ci_repo=role_opts['ci_repo']))
        role = world.farm.roles[index]
        state = 'pending'
        timeout = 1400
        server = world.wait_server_bootstrapping(role, state, timeout)
        setattr(world, role_opts['server_index'], server)
        LOG.info('Server %s (%s) successfully in %s state' % (server.id, role_opts['server_index'], state))
        index += 1
def create_seed_testcycle_testcases_testrun(step):
    '''
        Bug in lettuce prevents me from using this technique

    '''



    step.behave_as("""
        Given I create the seed company and product with these names:
            | company name    | product name  |
            | Massive Dynamic | Cortexiphan   |
        When I create a new user with name "Capn Admin"
        and I activate the user with that name
        And I create a new role with name "Approvationalist" with the following permissions:
            | permissionCode               |
            | PERMISSION_TEST_CASE_EDIT    |
            | PERMISSION_TEST_CASE_APPROVE |
        And I add the role with name "Approvationalist" to the user with that name
        when the user with that name creates a new testcase with name "Check the Gizmo"
        and when I add these steps to the testcase with that name:
            | name      | stepNumber | estimatedTimeInMin | instruction    | expectedResult        |
            | Mockery   | 1          | 5                  | Go this way    | They went this way    |
            | Flockery  | 2          | 2                  | Go that way    | They went that way    |
            | Chockery  | 3          | 4                  | Go my way      | They went my way      |
            | Trockery  | 4          | 1                  | Go the highway | They went the highway |
            | Blockery  | 5          | 25                 | Just go away   | They went away        |
        Then when I create a new user with name "Joe Approver"
        and I activate the user with that name
        And I add the role with name "Approvationalist" to the user with that name
        and when the user with name "Joe Approver" approves the testcase with that name
        And when I create the following new testcycles:
            | name          | description               | product name | startDate  | endDate    | communityAuthoringAllowed | communityAccessAllowed |
            | Baroque Cycle | Ahh, the cycle of life... | Cortexiphan  | 2011/02/02 | 2012/02/02 | true                      | true                   |
        and when I create a new testrun with name "Running Man" with testcycle "Baroque Cycle"
    """)
示例#37
0
def i_have_chosen_a_plan(step, plan):
    username = '******' % time.strftime('%Y%m%dT%H%M%S')
    step.behave_as('Given user "%s" with password "pass" is logged in' %
                   username)
    world.browser.visit(django_url('/subscribe/%s' % plan.lower()))
    world.wait_for_element_by_css('.card_number')
示例#38
0
def i_m_logged_out(step):
    step.behave_as("""
    Given I connect to /logout
    Then I expect HTML
    """)
示例#39
0
文件: setup.py 项目: Corvusoft/restq
def i_have_started_a_message_exchange( step ):
    step.behave_as(
    """
        When I perform a HTTP "OPTIONS" request to "/*" with headers "Accept: application/json, Host: localhost:1984"
        Then I should see a response status code of "204" "No Content"
    """ )
示例#40
0
def prompt_to_contact_opinew(step):
    response = """<form method="post" action="/contacts/create" id="contact-form"""
    step.behave_as('I see the response contains "{response}"'.format(response=response))
示例#41
0
def given_i_am_a_plan_user(step, plan):
    plan = plan.replace(' ', '').lower()
    step.behave_as("""
    Given user "test" with password "pass" is logged in
    And I am on the "%s" plan
    """ % plan)
示例#42
0
def then_the_scraper_should_be_set_to_schedule(step, schedule):
    step.behave_as('Then I should see "%s"' % schedule)
示例#43
0
def add_child(step, table):
    step.behave_as("""
        Given I scrool to "{selector}
            And I click on the element with the css selector "{selector}"
    """.format(selector="[data-fieldname='{}'] .grid-row-open .btn-success".format(table)))
示例#44
0
def rebundle_server(step, serv_as):
    step.behave_as("""
        When I create server snapshot for {serv_as}
        Then Bundle task created for {serv_as}
        And Bundle task becomes completed for {serv_as}
        """.format(serv_as=serv_as))
示例#45
0
文件: setup.py 项目: an-ky/restq
def i_have_started_a_message_exchange(step):
    step.behave_as("""
        When I perform a HTTP "OPTIONS" request to "/*" with headers "Accept: application/json, Host: localhost:1984"
        Then I should see a response status code of "204" "No Content"
    """)
def multiply_X_and_Y_into_the_calculator(step, x, y):
    step.behave_as('''
    I have entered {0} into the calculator
    And I have entered {1} into the calculator
    And I press multiply
    '''.format(x, y))
示例#47
0
 def runs_some_other_step_with_behave_as(step, something_else):
     step.behave_as("When %(i_do_something_else)s" %
                    {'i_do_something_else': something_else})
示例#48
0
 def runs_some_other_step_with_behave_as(step, something_else):
     step.behave_as("When %(i_do_something_else)s" % {"i_do_something_else": something_else})
示例#49
0
def fill_frappe_field(step, selector, value):
    step.behave_as("""
        Given I scroll to "{selector}" 
            And I click on the field with the css selector "{selector}"
            And I fill in the field with the css selector "{selector}" with "{value}"
    """.format(selector="input[data-fieldname='{}']".format(selector), value=value))
示例#50
0
def then_the_scraper_should_be_set_to_schedule(step, schedule):
    step.behave_as('Then I should see "%s"' % schedule)
示例#51
0
 def two_subordinate_steps(step):
     step.behave_as("""
         When I run the first sub-step
         And I run the second sub-step
     """)
示例#52
0
def turn_to_frappe(step, turn_to, selector):
    step.behave_as()
def given_i_am_a_plan_user(step, plan):
    plan = plan.replace(' ', '').lower()
    step.behave_as("""
    Given user "test" with password "pass" is logged in
    And I am on the "%s" plan
    """ % plan)
示例#54
0
def completing_setup(step):
    step.behave_as("""Given I click on the last element with the css selector "a.complete-btn.btn.btn-primary.btn-sm"
        And I wait 30 seconds""")
示例#55
0
def i_see_the_name(step, name):
    step.behave_as('I see the response contains "{response}"'.format(response=name))
示例#56
0
def and_i_add_a_new_blog_entry(step, title):
    step.behave_as("""
        Given I am on the "New blog entry" page
        And I fill out the details with "{title}"
        And I click on the "Post" button
    """.format(title=title))