示例#1
0
def add_action(action_name, where='test'):
    """adds an action using the autocomplete list"""
    if where == 'test':
        steps_section = element('div#testSteps')
    elif where == 'setup':
        steps_section = element('#setupSteps')
        if not steps_section.is_displayed():
            actions.click('#showSetupLink>a')
            actions.wait(0.5)
    elif where == 'teardown':
        steps_section = element('#teardownSteps')
        if not steps_section.is_displayed():
            actions.click('#showTeardownLink>a')
            actions.wait(0.5)


    # get last input in steps section
    inputs = steps_section.find_all('input.form-control.step-first-input')
    last_input = inputs[-1]

    # use the last empty input or add a new one if it's not empty
    new_action_input = None
    if not len(last_input.get_attribute('value')):
        new_action_input = last_input
    else:
        steps_section.find('button.add-step').click()
        inputs = steps_section.find_all('input.form-control.step-first-input')
        new_action_input = inputs[-1]

    # actions.click('#testSteps button.add-step')
    # action_inputs = elements("#testSteps .step-first-input")
    # last_input = action_inputs[-1]
    actions.send_keys(new_action_input, action_name)
    actions.press_key(new_action_input, 'DOWN')
    actions.press_key(new_action_input, 'ENTER')
示例#2
0
def select_env(env_name):
    input_ = element(environments_input)
    for i in range(len(env_name)):
        actions.send_keys(input_, env_name[i])
        actions.wait(0.1)
    actions.press_key(input_, 'DOWN')
    actions.press_key(input_, 'ENTER')
def test_rename_test_inline_invalid_chars(data):
    actions.refresh_page()
    actions.click(test_builder.test_name)
    actions.send_keys(test_builder.test_name_input, '??')
    actions.press_key(test_builder.test_name_input, 'TAB')
    common.assert_toast_message_is_displayed('Only letters, numbers and underscores are allowed')
    actions.refresh_page()
    actions.assert_element_text(test_builder.test_name, data.test)
def test_rename_test_inline_too_long(data):
    actions.refresh_page()
    actions.click(test_builder.test_name)
    actions.send_keys(test_builder.test_name_input, 'abcdefghij' * 14 + 'a')
    actions.press_key(test_builder.test_name_input, 'TAB')
    common.assert_toast_message_is_displayed('Maximum name length is 150 characters')
    actions.refresh_page()
    actions.assert_element_text(test_builder.test_name, data.test)
示例#5
0
def test(data):
    actions.wait(2)
    actions.press_key(suite_builder.browsers_input, 'SPACE')
    suite_builder.assert_browser_suggestions([
        'chrome', 'chrome-remote', 'chrome-headless', 'chrome-remote-headless',
        'edge', 'edge-remote', 'firefox', 'firefox-headless', 'firefox-remote',
        'firefox-remote-headless', 'ie', 'ie-remote', 'opera', 'opera-remote',
        'browser001'
    ])
示例#6
0
def test(data):
    actions.navigate(data.env.url + 'elements/')
    actions.press_key(('id', 'input-one'), 'NUMPAD2')
    actions.verify_text_in_element(('id', 'input-one-input-result'),
                                   'Welcome 2')
    try:
        actions.press_key(('id', 'input-one'), 'UNDEFINED_KEY')
    except Exception as e:
        assert 'Key UNDEFINED_KEY is invalid' in e.args[0]
示例#7
0
def test(data):
    actions.click(test_builder.test_name)
    actions.assert_element_displayed(test_builder.test_name_input)
    actions.assert_element_value(test_builder.test_name_input, data.test_name)
    actions.send_keys(test_builder.test_name_input, 'new')
    actions.press_key(test_builder.test_name_input, 'TAB')
    common.assert_toast_message_is_displayed('File was renamed')
    actions.wait_for_element_displayed(test_builder.test_name, 5)
    actions.assert_element_text(test_builder.test_name, data.test_name + 'new')
    actions.refresh_page()
    actions.assert_element_text(test_builder.test_name, data.test_name + 'new')
示例#8
0
def test(data):
    actions.navigate(data.env.url + 'elements/')
    actions.press_key(('id', 'input-one'), 'NUMPAD2')
    golem_steps.assert_last_step_message(
        "Press key: 'NUMPAD2' in element input-one")
    actions.assert_element_text(('id', 'input-one-input-result'), 'Welcome 2')
    try:
        actions.press_key(('id', 'input-one'), 'UNDEFINED_KEY')
    except Exception as e:
        assert 'Key UNDEFINED_KEY is invalid' in e.args[0]
    else:
        raise AssertionError('expected an exception')
示例#9
0
def add_element(element_def):
    actions.click(add_element_button)
    elemement_rows = elements('#elements>div.element')
    last_element_row = elemement_rows[-1]
    element_name_input = last_element_row.find('input.element-name')
    element_selector_input = last_element_row.find('input.element-selector')
    element_value_input = last_element_row.find('input.element-value')
    element_display_name_input = last_element_row.find(
        'input.element-display-name')
    actions.send_keys(element_name_input, element_def[0])
    actions.send_keys(element_selector_input, element_def[1])
    actions.send_keys(element_value_input, element_def[2])
    actions.clear_element(element_display_name_input)
    actions.send_keys(element_display_name_input, element_def[3])
    actions.press_key(element_display_name_input, 'TAB')
示例#10
0
def _add_directory(elem_type, fullpath):
    if elem_type == 'test':
        tree_ul = element(id='testCasesTree')
    elif elem_type == 'page':
        tree_ul = element(id='pagesTree')
    else:
        raise('Error: elem_type must be in {}'.format(['test', 'page']))
    split_path = fullpath.split('/')
    elem_name = split_path.pop()
    if split_path:
        _expand_tree_path(tree_ul, list(split_path))
    dot_path = '.'.join(split_path) if '.'.join(split_path) else '.' 
    form_container = tree_ul.find("li.form-container[fullpath='{}']".format(dot_path))
    form_container.find('a.new-directory-link').click()
    add_elem_input = form_container.find('input.new-element-input')
    actions.send_keys(add_elem_input, elem_name)
    actions.press_key(add_elem_input, 'ENTER')
示例#11
0
def add_new_page(name, path=''):
    split_path = []
    if len(path):
        split_path = path.split('.')
    selector = '#pagesTree >'
    for i in range(len(split_path)):
        branch = split_path[i]
        this_branch_selector += 'li[data-branch-name=\'{}\'] > a'.format(
            branch)
        element(css=this_branch_selector).click()
        selector = selector + 'li[data-branch-name=\'{}\'] ul '.format(branch)
    add_link_selector = selector + ' li > span > a'
    element(css=add_link_selector).click()
    add_input_selector = selector + 'li > span > input.new-element-input'
    add_page_input = ('css', add_input_selector, 'add input')
    actions.send_keys(add_page_input, name)
    actions.press_key(add_page_input, 'ENTER')
示例#12
0
def select_browser(env_name):
    input_ = element(browser_input)
    for i in range(len(env_name)):
        actions.send_keys(input_, env_name[i])
        actions.wait(0.1)
    actions.press_key(input_, 'DOWN')
    actions.press_key(input_, 'ENTER')
    actions.press_key(input_, 'TAB')
示例#13
0
def add_action(action_name, params=[], where='test'):
    """adds an action using the autocomplete list"""
    if where == 'test':
        steps_section = element('div#testSteps')
    elif where == 'setup':
        steps_section = element('#setupSteps', wait_displayed=False)
        if not steps_section.is_displayed():
            actions.click('#showSetupLink>a')
            actions.wait(0.5)
    elif where == 'teardown':
        steps_section = element('#teardownSteps', wait_displayed=False)
        if not steps_section.is_displayed():
            actions.click('#showTeardownLink>a')
            actions.wait(0.5)

    # get last step
    steps = steps_section.find_all('div.step')
    step = steps[-1]

    # if the last action input is not empty, add a new one
    if step.find('input.step-first-input').value:
        steps_section.find('button.add-step').click()
        steps = steps_section.find_all('div.step')
        step = steps[-1]

    action_input = step.find('input.step-first-input')
    for i in range(len(action_name)):
        action_input.send_keys(action_name[i])
        actions.wait(0.1)
    actions.press_key(action_input, 'DOWN')
    actions.press_key(action_input, 'ENTER')

    # fill in each param
    if params:
        param_inputs = step.find_all('input.parameter-input')
        for i, param in enumerate(params):
            param_inputs[i].send_keys(param)
示例#14
0
def add_step_to_test(test_name, action_name, params=None):
    """adds an action using the autocomplete list"""
    # get last step
    test_container = test_function_section(test_name)
    steps = test_container.find_all('div.step')
    last_step = steps[-1]
    # if the last action input is not empty, add a new one
    if last_step.find('input.step-first-input').value:
        test_container.find('button.add-step').click()
        steps = test_container.find_all('div.step')
        last_step = steps[-1]

    action_input = last_step.find('input.step-first-input')
    for i in range(len(action_name)):
        action_input.send_keys(action_name[i])
        actions.wait(0.1)
    actions.press_key(action_input, 'DOWN')
    actions.press_key(action_input, 'ENTER')

    # fill in each param
    if params:
        param_inputs = last_step.find_all('input.parameter-input')
        for i, param in enumerate(params):
            param_inputs[i].send_keys(param)