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')
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')
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')
def test(data): actions.navigate(data.env.url+'elements/') element = ('id', 'input-one') actions.send_keys(element, 'test text') b = browser.get_browser() assert b.find(element).get_attribute('value') == 'test text' actions.clear_element(element) assert b.find(element).get_attribute('value') == ''
def test(data): actions.navigate(data.env.url + 'tabs/') actions.send_keys('#title', 'foo') actions.click('#goButtonCustom') actions.clear_element('#title') actions.send_keys('#title', 'bar') actions.click('#goButtonCustom') actions.assert_amount_of_windows(3) titles = actions.get_window_titles() expected = ['Web Playground - Tabs', 'foo', 'bar'] assert sorted(titles) == sorted(expected)
def test(data): test_builder.open_run_configurations_modal() actions.assert_element_attribute(test_run_config_modal.browser_input, 'value', 'chrome, ') actions.clear_element(test_run_config_modal.browser_input) test_run_config_modal.select_browser('chrome') test_run_config_modal.select_browser('firefox') actions.assert_element_attribute(test_run_config_modal.browser_input, 'value', 'chrome, firefox, ') actions.click(test_run_config_modal.run_button) test_run_modal.wait_for_test_to_run() test_run_modal.assert_amount_of_sets(2)
def test(data): test_builder_common.add_variable_to_datatable('foo', ['1', '2']) test_builder.save_test() test_builder.open_run_configurations_modal() actions.clear_element(test_run_config_modal.browser_input) test_run_config_modal.select_browser('chrome') test_run_config_modal.select_browser('firefox') test_run_config_modal.select_env('foo') test_run_config_modal.select_env('bar') actions.click(test_run_config_modal.run_button) test_run_modal.wait_for_test_to_run() test_run_modal.assert_amount_of_sets(8)
def test(data): users.click_edit_button(data.username) new_username = actions.random_str() new_email = '*****@*****.**' actions.clear_element(create_user.username) actions.send_keys(create_user.username, new_username) actions.clear_element(create_user.email) actions.send_keys(create_user.email, new_email) actions.click(create_user.update_user_button) users.wait_for_table_to_load() assert not users.user_in_table(data.username) assert users.user_in_table(new_username) users.assert_user_values(new_username, email=new_email)
def test(data): actions.navigate(data.env.url + 'elements/') input = '#input-one' text_area = '#textarea-1' # clear input actions.send_keys(input, 'foo') actions.assert_element_attribute(input, 'value', 'foo') actions.clear_element(input) golem_steps.assert_last_step_message('Clear element {}'.format(input)) actions.assert_element_attribute(input, 'value', '') # clear text area actions.send_keys(text_area, 'bar') actions.assert_element_attribute(text_area, 'value', 'bar') actions.clear_element(text_area) actions.assert_element_attribute(text_area, 'value', '')
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')
def test(data): actions.wait(1) actions.check_element(suite_builder.all_tests_checkbox) actions.send_keys(suite_builder.processes_input, 3) actions.refresh_page() actions.wait(1) actions.assert_alert_present() actions.accept_alert() actions.assert_element_value(suite_builder.processes_input, '1') actions.clear_element(suite_builder.processes_input) actions.send_keys(suite_builder.processes_input, 3) actions.refresh_page() actions.assert_alert_present() actions.dismiss_alert() suite_builder.save_suite() common.navigate_menu('Suites') actions.assert_title_contains(': Suites')
def test(data): actions.navigate(data.env.url + 'tabs/') actions.send_keys('#title', 'SECOND TAB') actions.click('#goButtonCustom') actions.clear_element('#title') actions.send_keys('#title', 'THIRD TAB') actions.click('#goButtonCustom') actions.wait_for_window_present_by_title('SECOND TAB', timeout=10) actions.wait_for_window_present_by_title('THIRD TAB', timeout=10) actions.get_browser().switch_to_window_by_index(2) assert actions.get_window_index() == 2 actions.navigate(data.env.url) actions.switch_to_first_window() actions.verify_title('Web Playground - Tabs') actions.get_browser().switch_to_last_window() assert actions.get_window_index() == 2 actions.verify_title('Web Playground')
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) actions.get_browser().switch_to_next_window() actions.verify_title(second_title) actions.get_browser().switch_to_next_window() actions.verify_title(third_title) actions.get_browser().switch_to_next_window() actions.verify_title(first_title)
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(0) # close third window by index actions.get_browser().close_window_by_index(2) actions.verify_amount_of_windows(2) actions.verify_title(first_title) # close first window by index, from the first window actions.get_browser().close_window_by_index(0) actions.verify_amount_of_windows(1) # second window is now index 0 actions.verify_title(second_title)
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(2) actions.verify_title(third_title) actions.switch_to_previous_window() golem_steps.assert_last_step_message('Switch to previous window') actions.verify_title(second_title) actions.switch_to_previous_window() actions.verify_title(first_title) actions.switch_to_previous_window() actions.verify_title(third_title)
def test(data): actions.navigate(data.env.url + 'tabs/') # open two more tabs actions.send_keys('#title', 'SECOND TAB') actions.click('#goButtonCustom') actions.clear_element('#title') actions.send_keys('#title', 'THIRD TAB') actions.click('#goButtonCustom') # wait for the new tabs to load actions.wait_for_window_present_by_title('SECOND TAB', timeout=5) actions.wait_for_window_present_by_title('THIRD TAB', timeout=5) # switch to last tab and navigate to index actions.switch_to_window_by_index(2) assert actions.get_window_index() == 2 actions.navigate(data.env.url) # switch to first tab actions.switch_to_first_window() actions.assert_title('Web Playground - Tabs') # switch to last tab actions.switch_to_last_window() golem_steps.assert_last_step_message('Switch to last window') assert actions.get_window_index() == 2 actions.assert_title('Web Playground')
def test(data): actions.clear_element(suite_builder.processes_input) actions.send_keys(suite_builder.processes_input, 3) suite_builder.save_suite() actions.refresh_page() suite_builder.assert_processes_value(3)
def test(data): users.click_edit_button(data.username1) actions.clear_element(create_user.username) actions.send_keys(create_user.username, data.username2) actions.click(create_user.update_user_button) common.assert_toast_message_is_displayed('Username {} already exists'.format(data.username2))
def test_rename_test_inline_blank(data): actions.click(test_builder.test_name) actions.clear_element(test_builder.test_name_input) common.assert_toast_message_is_displayed('File name cannot be empty') actions.refresh_page() actions.assert_element_text(test_builder.test_name, data.test)