示例#1
0
def test(data):
    actions.navigate(data.env.url + 'tabs/')
    actions.click('#openTab')
    actions.wait_for_window_present_by_title('Tab')
    assert actions.get_browser().get_window_index() == 0
    actions.switch_to_window_by_index(1)
    assert actions.get_browser().get_window_index() == 1
示例#2
0
def test(data):
    actions.navigate(data.env.url+'tabs/')
    actions.send_keys('#urlInput', '/elements/')
    actions.click("#goButton")
    actions.verify_window_present_by_partial_title('Elem')  # Elements
    golem_steps.assert_last_step_message("Verify window present by partial title 'Elem'")
    actions.verify_window_present_by_partial_title('Tab')  # Tabs
示例#3
0
def test(data):
    actions.navigate(data.env.url)
    actions.click(('link_text', 'Elements'))
    assert actions.get_current_url() == data.env.url + 'elements/'
    actions.go_back()
    golem_steps.assert_last_step_message('Go back')
    assert actions.get_current_url() == data.env.url
def test(data):
    suite_builder.select_test(data.test)
    actions.click(suite_builder.run_suite_button)
    suite_builder.assert_suite_was_run(data.suite)
    suite_builder.access_suite_execution_from_toast()
    report_execution.wait_until_execution_end()
    report_execution.assert_amount_of_tests(1)
示例#5
0
def test(data):
    actions.navigate(data.env.url + 'elements/')
    checkbox = ('id', 'unselected-checkbox')
    actions.click(checkbox)
    actions.verify_is_selected(checkbox)
    actions.refresh_page()
    actions.verify_is_not_selected(checkbox)
def test(data):
    test_builder.add_action('click')
    test_builder.save_test()
    actions.refresh_page()
    actions.click(test_builder.save_button)
    common.assert_toast_message_is_displayed('Test ' + data.test_name +
                                             ' saved')
示例#7
0
def setup(data):
    common.access_golem(data.env.url, data.env.admin)
    index.create_access_project('project_two_envs')
    actions.navigate(urls.environments('project_two_envs'))
    environments.set_value('{"foo": {}, "bar": {}}')
    actions.click(environments.save_button)
    api.test.create_access_random_test('project_two_envs')
def test(data):
    common.navigate_menu('Project Settings')
    settings.set_settings_value('{\n"search_timeout": 10\n}')
    actions.click(settings.save_button)
    common.assert_toast_message_is_displayed('Settings saved')
    actions.refresh_page()
    settings.assert_settings_value('{\n"search_timeout": 10\n}')
示例#9
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')
示例#10
0
def test_dismiss_alert_prompt(data):
    actions.navigate(data.env.url + 'prompt/')
    actions.click('#prompt-button')
    actions.verify_alert_present()
    actions.dismiss_alert()
    actions.verify_alert_not_present()
    actions.verify_element_text('#result', 'DISMISSED')
示例#11
0
def test_submit_prompt_alert(data):
    actions.navigate(data.env.url + 'prompt/')
    actions.click('#prompt-button')
    actions.submit_prompt_alert('hey, some text')
    golem_steps.assert_last_step_message(
        "Submit alert with text 'hey, some text'")
    actions.verify_element_text('#result', 'hey, some text')
示例#12
0
def test_dismiss_alert_confirm(data):
    actions.navigate(data.env.url + 'confirm/')
    actions.click('#confirm-button')
    actions.verify_alert_present()
    actions.dismiss_alert()
    actions.verify_alert_not_present()
    actions.verify_element_text('#result', 'NOT CONFIRMED')
def test(data):
    project = 'project1'
    permission = 'admin'
    create_user.select_project(project)
    create_user.select_permission(permission)
    actions.click(create_user.add_permission_button)
    create_user.assert_project_permission_in_table(project, permission)
示例#14
0
def test(data):
    new_username = actions.random_str()
    actions.send_keys(create_user.username, new_username)
    actions.send_keys(create_user.password, '123456')
    actions.click(create_user.create_user_button)
    users.wait_for_table_to_load()
    users.assert_user_in_table(new_username)
示例#15
0
def setup(data):
    common.access_golem(data.env.url, data.env.admin)
    api.project.create_access_random_project()
    common.navigate_menu('Project Settings')
    settings.set_settings_value('{"remote_browsers": {"browser001": {}}}')
    actions.click(settings.save_button)
    api.suite.create_access_suite(data.project)
示例#16
0
def test(data):
    test_line = "description = 'desc'"
    test_builder_code.set_value(test_line)
    actions.click(test_builder_code.save_button)
    common.assert_toast_message_is_displayed('Test ' + data.test + ' saved')
    actions.refresh_page()
    test_builder_code.assert_value(test_line)
示例#17
0
def test(data):
    actions.send_keys(create_user.username, actions.random_str())
    actions.send_keys(create_user.email, 'test@')
    actions.send_keys(create_user.password, '123456')
    actions.click(create_user.create_user_button)
    common.assert_toast_message_is_displayed(
        'test@ is not a valid email address')
示例#18
0
def test(data):
    actions.navigate(data.env.url+'tabs/')
    actions.send_keys('#urlInput', '/elements/')
    actions.click("#goButton")
    actions.clear_element('#urlInput')
    actions.send_keys('#urlInput', '/alert/')
    actions.click("#goButton")
    actions.switch_to_window_by_index(0)
    first_title = actions.get_window_title()
    actions.switch_to_window_by_index(1)
    second_title = actions.get_window_title()
    actions.switch_to_window_by_index(2)
    third_title = actions.get_window_title()
    actions.switch_to_window_by_index(0)
    # close third window by title
    actions.get_browser().close_window_by_title(third_title)
    actions.verify_amount_of_windows(2)
    actions.verify_title(first_title)
    # close first window by title, from the first window
    actions.get_browser().close_window_by_title(first_title)
    # second window is now active
    actions.verify_amount_of_windows(1)
    actions.verify_title(second_title)
    # try to close a window that is not present
    msg = "a window with title 'Incorrect Title' was not found"
    with expected_exception(Exception, msg):
        actions.get_browser().close_window_by_title('Incorrect Title')
示例#19
0
def test(data):
    actions.navigate(data.env.url)
    actions.click(login.login_button)
    actions.send_keys(login.username_input, 'admin')
    actions.send_keys(login.password_input, 'admin')
    actions.click(login.login_button)
    actions.assert_element_text(index.title, 'Select a Project')
示例#20
0
def test_config_modal_processes_less_than_1(data):
    test_builder.open_run_configurations_modal()
    actions.assert_element_value(test_run_config_modal.processes_input, '1')
    actions.clear_element(test_run_config_modal.processes_input)
    actions.send_keys(test_run_config_modal.processes_input, '0')
    actions.click(test_run_config_modal.run_button)
    common.assert_info_bar_message('Processes must be at least one')
示例#21
0
def test_create_project_with_invalid_name(data):
    actions.navigate(data.env.url)
    actions.click(index.create_project_button)
    actions.send_keys(index.project_name_input, 'project_test_$')
    actions.click(index.create_button)
    common.assert_error_message(
        'Only letters, numbers and underscores are allowed')
示例#22
0
def _rename_elem(elem_type, old_fullpath, new_fullpath):
    if elem_type == 'test':
        tree_ul = element(id='testCasesTree')
    elif elem_type == 'page':
        tree_ul = element(id='pagesTree')
    elif elem_type == 'suite':
        tree_ul = element(id='suitesTree')
    else:
        raise ('Error: elem_type must be in {}'.format(
            ['test', 'page', 'suite']))
    split_path = old_fullpath.split('/')
    elem_name = split_path.pop()
    if split_path:
        _expand_tree_path(tree_ul, list(split_path))
    full_dot_path = old_fullpath.replace('/', '.')
    selector = "li.tree-element[fullpath='{}']".format(full_dot_path)
    tree_elem = tree_ul.find(selector)
    rename_button = tree_elem.find(
        '.tree-element-buttons > button.rename-button')
    actions.click(rename_button)
    actions.wait(0.5)  # TODO
    prompt_input = element('#promptModal #promptModalInput')
    actions.clear(prompt_input)
    actions.send_keys(prompt_input, new_fullpath)
    actions.click('#promptModal #prompSaveButton')
示例#23
0
def test_config_modal_processes_not_integer(data):
    actions.refresh_page()
    test_builder.open_run_configurations_modal()
    actions.clear_element(test_run_config_modal.processes_input)
    actions.send_keys(test_run_config_modal.processes_input, 'abc')
    actions.click(test_run_config_modal.run_button)
    common.assert_info_bar_message('Processes must be an integer')
示例#24
0
def test(data):
    project_name = 'project_test_$'
    actions.click(index.create_project_button)
    actions.send_keys(index.project_name_input, project_name)
    actions.click(index.create_button)
    common.assert_error_message(
        'Only letters, numbers and underscores are allowed')
def test(data):
    actions.navigate(data.env.url+'tabs/')
    actions.click("#openTab")
    actions.wait_for_window_present_by_title('Tab', 5)
    actions.verify_window_present_by_title('Tab')
    golem_steps.assert_last_step_message("Verify window present by title 'Tab'")
    actions.verify_window_present_by_title('Web Playground - Tabs')
示例#26
0
def test_send_text_to_alert(data):
    actions.navigate(data.env.url + 'prompt/')
    actions.click('#prompt-button')
    actions.send_text_to_alert('hey, some text')
    golem_steps.assert_last_step_message("Send 'hey, some text' to alert")
    actions.accept_alert()
    actions.verify_element_text('#result', 'hey, some text')
示例#27
0
def test(data):
    tabs_url = data.env.url + 'tabs/'
    tab_url = data.env.url + 'tab/'
    actions.navigate(tabs_url)
    actions.click('#openTab')
    actions.wait_for_window_present_by_title('Tab')
    window_urls = actions.get_browser().get_window_urls()
    assert window_urls == [tabs_url, tab_url]
示例#28
0
def test_config_modal_env_doesnt_exist(data):
    actions.refresh_page()
    test_builder.open_run_configurations_modal()
    actions.send_keys(test_run_config_modal.environments_input,
                      'not-existent-env')
    actions.click(test_run_config_modal.run_button)
    common.assert_info_bar_message(
        'Environment not-existent-env does not exist for project test')
示例#29
0
def test_verify_alert_present(data):
    actions.navigate(data.env.url + 'alert/')
    actions.verify_alert_present()
    golem_steps.assert_last_step_message('Verify an alert is present')
    golem_steps.assert_last_error('an alert was not present')
    actions.click('#alert-button')
    actions.verify_alert_present()
    actions.dismiss_alert()
示例#30
0
def test(data):
    actions.navigate(data.env.url)
    actions.send_keys(login.username_input, 'admin')
    actions.send_keys(login.password_input, 'incorrect password')
    actions.click(login.login_button)
    actions.take_screenshot('Verify the correct error message is shown')
    actions.assert_element_text(login.error_list,
                                'Username and password do not match')