def test_open_unclassified_failure_log(self, base_url, selenium): # Open the job log and verify there is content treeherder_page = TreeherderPage(base_url, selenium).open() assert treeherder_page.unclassified_failure_count > 0 treeherder_page.open_next_unclassified_failure() logviewer_page = treeherder_page.open_logviewer() assert logviewer_page.is_job_status_visible
def test_set_as_top_of_range(base_url, selenium): page = TreeherderPage(selenium, base_url).open() current_top_of_range = page.result_sets[0].datestamp page.result_sets[1].set_as_top_of_range() page.wait_for_page_to_load() new_top_of_range = page.result_sets[0].datestamp assert not new_top_of_range == current_top_of_range
def test_unclassified_failure(base_url, selenium): """Open resultset page and search for next unclassified failure""" page = TreeherderPage(selenium, base_url).open() assert page.unclassified_failure_count > 0 page.open_next_unclassified_failure() teststatus = page.info_panel.job_details.job_result_status assert teststatus in ['busted', 'testfailed', 'exception']
def test_open_unclassified_failure_log(base_url, selenium): """Open the job log and verify there is content""" treeherder_page = TreeherderPage(selenium, base_url).open() assert treeherder_page.unclassified_failure_count > 0 treeherder_page.open_next_unclassified_failure() logviewer_page = treeherder_page.info_panel.job_details.open_logviewer() assert logviewer_page.is_job_status_visible
def test_status_results_in_progress(base_url, selenium): """Open resultset page and verify job status in progress filter displays correctly.""" page = TreeherderPage(selenium, base_url).open() page.filter_job_failures() page.filter_job_successes() page.filter_job_retries() page.filter_job_usercancel() assert 0 < len(page.all_jobs) == len(page.all_in_progress_jobs)
def test_filter_jobs(base_url, selenium): """Open resultset page and filter for platform""" page = TreeherderPage(selenium, base_url).open() # select the first result set with linux and windows platforms result_set = next(r for r in page.result_sets if linux_and_windows(r)) assert {'linux', 'windows'}.issubset(platforms(result_set)) page.filter_by('linux') assert 'linux' in platforms(result_set) assert 'windows' not in platforms(result_set)
def test_clear_pinboard(base_url, selenium): """Open treeherder page, pin a job and then clear the pinboard""" page = TreeherderPage(selenium, base_url).open() random.choice(page.all_jobs).click() page.pin_using_spacebar() assert 1 == len(page.pinboard.jobs) page.pinboard.clear_pinboard() assert page.pinboard.is_pinboard_open assert 0 == len(page.pinboard.jobs)
def test_status_results_retry(base_url, selenium): """Open resultset page and verify job status retry filter displays correctly.""" page = TreeherderPage(selenium, base_url).open() page.filter_job_failures() page.filter_job_successes() page.filter_job_usercancel() page.filter_job_in_progress() page.wait.until( lambda _: 0 < len(page.all_jobs) == len(page.all_restarted_jobs))
def test_pin_job(base_url, selenium): """Open treeherder page, select first job and pin it""" page = TreeherderPage(selenium, base_url).open() job = random.choice(page.all_jobs) job.click() assert 0 == len(page.pinboard.jobs) page.pin_using_spacebar() assert 1 == len(page.pinboard.jobs) assert job.symbol == page.pinboard.selected_job.symbol
def test_status_results_retry(base_url, selenium): """Open resultset page and verify job status retry filter displays correctly.""" page = TreeherderPage(selenium, base_url).open() page.filter_job_failures() page.filter_job_successes() page.filter_job_usercancel() page.filter_job_in_progress() assert all(map(lambda job: 'retry' in job.title, page.all_jobs))
def test_filter_jobs(base_url, selenium): """Open resultset page and filter for platform""" page = TreeherderPage(selenium, base_url).open() assert any(r.contains_platform('linux') for r in page.pushes) assert any(r.contains_platform('windows') for r in page.pushes) page.filter_by('linux') assert any(r.contains_platform('linux') for r in page.pushes) assert not any(r.contains_platform('windows') for r in page.pushes)
def test_filter_by_email(base_url, selenium): """Open Treeherder page, select and filter by random email, verify if filtered emails have the same email address""" page = TreeherderPage(selenium, base_url).open() page.select_random_email() filtered_emails_name = page.result_sets[0].email_name random_email_name = page.random_email_name assert filtered_emails_name == random_email_name
def test_close_open_panels(base_url, selenium): """Open Treeherder, verify shortcut: 'Esc' closes job panel. Open Treeherder page, select random job, close all panels using 'esc' button, verify if all panels are closed. """ page = TreeherderPage(selenium, base_url).open() page.select_random_job() assert page.info_panel.is_open page.close_all_panels() assert not page.info_panel.is_open
def test_treeherder_dropdown(base_url, selenium): """Switch between Treeherder and Perfherder using header dropdown""" treeherder_page = TreeherderPage(selenium, base_url).open() # Switch to Perfherder page perfherder_page = treeherder_page.open_perfherder_page() assert perfherder_page.is_graph_chooser_displayed # Return to Treeherder page treeherder_page = perfherder_page.open_treeherder_page()
def test_remove_email_address_filter(base_url, selenium): """Open Treeherder page, select and filter by random email, remove email address filter, verify that job list display all authors""" page = TreeherderPage(selenium, base_url).open() page.select_random_email() page.click_on_active_watched_repo() all_emails = [email.get_name for email in page.all_emails] assert len(set(all_emails)) > 1
def test_enter_quick_filter_shortcut(base_url, selenium): """Open Treeherder, verify shortcut: 'f' moves cursor to filter search box. Open Treeherder page, verify if search box is empty, enter search box filter using 'f' shortcut, type 'debug', verify if filter box contains word 'debug'. """ page = TreeherderPage(selenium, base_url).open() assert page.search_term == '' page.filter_by('debug', method='keyboard') assert page.search_term == 'debug'
def test_view_unclassified_jobs(base_url, selenium): page = TreeherderPage(selenium, base_url).open() all_jobs = page.all_jobs page.filter_unclassified_jobs() filtered_jobs = page.all_jobs assert not all_jobs == filtered_jobs job = random.choice(filtered_jobs) unclassified = ['testfailed', 'busted', 'exception'] assert any(status in job.title for status in unclassified)
def test_filter_by_job_keyword(base_url, selenium): """Open Treeherder page, select random job, click on the job keyword, verify if filtered jobs have the same platform name""" page = TreeherderPage(selenium, base_url).open() page.select_random_job() page.info_panel.job_details.filter_by_job_keyword() keyword = page.info_panel.job_details.job_keyword_name page.select_random_job() assert keyword in page.info_panel.job_details.job_keyword_name
def test_status_results_in_progress(base_url, selenium): """Open resultset page and verify job status in progress filter displays correctly.""" page = TreeherderPage(selenium, base_url).open() page.filter_job_failures() page.filter_job_successes() page.filter_job_retries() page.filter_job_usercancel() page.wait.until(lambda _: 0 < len(page.all_jobs) == len(page.all_in_progress_jobs))
def test_status_results_failures(base_url, selenium): """Open resultset page and verify job failure filter displays correctly.""" page = TreeherderPage(selenium, base_url).open() page.filter_job_successes() page.filter_job_retries() page.filter_job_usercancel() page.filter_job_in_progress() all_jobs = page.all_jobs job = random.choice(all_jobs) unclassified = ['testfailed', 'exception', 'busted'] assert any(status in job.title for status in unclassified)
def test_status_results_in_progress(base_url, selenium): """Open resultset page and verify job status in progress filter displays correctly.""" page = TreeherderPage(selenium, base_url).open() page.filter_job_failures() page.filter_job_successes() page.filter_job_retries() page.filter_job_usercancel() all_jobs = page.all_jobs job = random.choice(all_jobs) runnable = ['running', 'pending'] assert any(status in job.title for status in runnable)
def test_clear_the_quick_filter_shortcut(base_url, selenium): """Open Treeherder, verify shortcut: CTRL + SHIFT + 'f' clears the filter search box. Open Treeherder page, filter by 'debug', verify if filter box contains the word 'debug', clear the quick filter using CTRL + SHIFT + f shortcut, verify if search box is empty. """ page = TreeherderPage(selenium, base_url).open() page.filter_by('debug') page.clear_filter(method='keyboard') assert page.search_term == ''
def test_load_next_results(base_url, selenium): page = TreeherderPage(selenium, base_url).open() assert len(page.result_sets) == 10 page.get_next_ten_results() assert len(page.result_sets) == 20 page.get_next_twenty_results() page.wait_for_page_to_load() assert len(page.result_sets) == 40 page.get_next_fifty_results() assert len(page.result_sets) == 90
def test_treeherder_dropdown(base_url, selenium): # Switch between Treeherder and Perfherder using header dropdown treeherder_page = TreeherderPage(base_url, selenium).open() # Verify Treeherder loads assert treeherder_page.unclassified_failure_count > 0 # Switch to Perfherder page perfherder_page = treeherder_page.open_perfherder_page() assert perfherder_page.is_graph_chooser_displayed # Return to Treeherder page treeherder_page = perfherder_page.open_treeherder_page() assert treeherder_page.unclassified_failure_count > 0
def test_load_next_results(base_url, selenium): page = TreeherderPage(selenium, base_url).open() assert len(page.pushes) == 10 page.get_next_10() assert len(page.pushes) == 20 page.get_next_20() page.wait_for_page_to_load() assert len(page.pushes) == 40 page.get_next_50() assert len(page.pushes) == 90
def test_treeherder_dropdown(base_url, selenium): """Switch between Treeherder and Perfherder using header dropdown""" treeherder_page = TreeherderPage(selenium, base_url).open() # Verify Treeherder loads assert treeherder_page.unclassified_failure_count > 0 # Switch to Perfherder page perfherder_page = treeherder_page.open_perfherder_page() assert perfherder_page.is_graph_chooser_displayed # Return to Treeherder page treeherder_page = perfherder_page.open_treeherder_page() assert treeherder_page.unclassified_failure_count > 0
def test_expanding_group_count(base_url, selenium): page = TreeherderPage(selenium, base_url).open() assert len(page.result_sets) > 1 assert not page.result_sets[0].find_expanded_group_content page.result_sets[0].expand_group_count() assert page.result_sets[0].find_expanded_group_content
def test_open_single_result(base_url, selenium): page = TreeherderPage(selenium, base_url).open() assert len(page.result_sets) > 1 datestamp = page.result_sets[0].datestamp page.result_sets[0].view() assert 1 == len(page.result_sets) assert datestamp == page.result_sets[0].datestamp
def test_open_single_result(base_url, selenium): page = TreeherderPage(selenium, base_url).open() assert len(page.result_sets) > 1 result_set = random.choice([r for r in page.result_sets if r.jobs]) datestamp = result_set.datestamp result_set.view() assert 1 == len(page.result_sets) assert datestamp == page.result_sets[0].datestamp
def test_pin_a_bug(base_url, selenium, new_user): """Open treeherder, log in, select unclassified job, pin job, add a bug, save and verify""" page = TreeherderPage(selenium, base_url).open() page.header.login(new_user['email'], new_user['password']) assert page.header.is_user_logged_in page.open_next_unclassified_failure() assert not page.job_details.is_job_bug_visible page.pin_using_spacebar() bug_id = 1164485 page.pinboard.add_bug_to_pinned_job(bug_id) page.pinboard.save_bug_to_pinboard() message = page.notification_text # Removed assert that Job Details displays bug number as it often requires a page refresh to display assert "Bug association" in message
def test_expanding_group_count(base_url, selenium): page = TreeherderPage(selenium, base_url).open() all_groups = list( itertools.chain.from_iterable(r.job_groups for r in page.result_sets)) group = next(g for g in all_groups if not g.expanded) jobs = group.jobs group.expand() assert len(group.jobs) > len(jobs)
def test_get_next_results(base_url, selenium): page = TreeherderPage(selenium, base_url).open() assert len(page.result_sets) == 10 page.get_next_ten_results() assert len(page.result_sets) == 20 page = TreeherderPage(selenium, base_url).open() page.get_next_twenty_results() assert len(page.result_sets) == 30 page = TreeherderPage(selenium, base_url).open() page.get_next_fifty_results() assert len(page.result_sets) == 60
def test_pin_job_from_job_details(base_url, selenium): """Open treeherder page, select first job, pin it by the pin icon""" page = TreeherderPage(selenium, base_url).open() job = page.result_sets[0].jobs[0] job.click() assert 0 == len(page.pinboard.jobs) page.job_details.pin_job() assert 1 == len(page.pinboard.jobs) assert job.symbol == page.pinboard.selected_job.symbol
def test_pin_job_from_job_details(base_url, selenium): """Open treeherder page, select first job, pin it by the pin icon""" page = TreeherderPage(selenium, base_url).open() job = random.choice(page.all_jobs) job.click() assert 0 == len(page.pinboard.jobs) page.info_panel.job_details.pin_job() assert 1 == len(page.pinboard.jobs) assert job.symbol == page.pinboard.selected_job.symbol
def test_default_status(base_url, selenium): """Open resultset page and verify default job status buttons in the nav.""" page = TreeherderPage(selenium, base_url).open() assert page.nav_filter_failures_is_selected assert page.nav_filter_success_is_selected assert page.nav_filter_retry_is_selected assert page.nav_filter_usercancel_is_selected assert not page.nav_filter_superseded_is_selected assert page.nav_filter_in_progress_is_selected
def test_filter_panel_reset_button(base_url, selenium): """Open Treeherder page, hide jobs in progress, reset filters button and verify in progress jobs are displayed""" page = TreeherderPage(selenium, base_url).open() assert page.all_in_progress_jobs page.filter_job_in_progress() assert not page.nav_filter_in_progress_is_selected assert not page.all_in_progress_jobs page.click_on_filters_panel() page.reset_filters() assert page.nav_filter_in_progress_is_selected assert page.all_in_progress_jobs
def test_filter_jobs(base_url, selenium): """Open resultset page and filter for platform""" page = TreeherderPage(selenium, base_url).open() platform = u'Linux' page.filter_by(platform) assert platform in page.result_sets[0].builds[0].platform_name page.clear_filter() platform2 = u'Windows' page.filter_by(platform2) assert platform not in page.result_sets[0].builds[0].platform_name
def test_previous_job_shortcut(base_url, selenium): """Open Treeherder, verify shortcut: 'Left Arrow' opens previous job. Open Treeherder page, select random job and get the keyword name, select previous job using Left Arrow shortcut, verify job keywords match.""" page = TreeherderPage(selenium, base_url).open() all_jobs = page.all_jobs[:-1] # Check number of jobs random_index = random.randint(0, len(all_jobs)) jobs = all_jobs[random_index:(random_index + 2)] # Select random job and previous job jobs[1].click() assert jobs[1].selected assert not jobs[0].selected page.select_previous_job() assert jobs[0].selected assert not jobs[1].selected
def test_close_open_panels(base_url, selenium): """Open Treeherder, verify shortcut: 'Esc' closes filter and job panel. Open Treeherder page, open Filters panel, select random job, close all panels using 'esc' button, verify if all panels are closed. """ page = TreeherderPage(selenium, base_url).open() page.click_on_filters_panel() page.select_random_job() assert page.filter_panel_is_open assert page.info_panel.is_open page.close_all_panels() assert not page.filter_panel_is_open assert not page.info_panel.is_open
def test_filter_panel_reset_button(base_url, selenium): """Open Treeherder page, open Filters Panel, disable all failures, check that all checkboxes are not selected, check that there are no failures, click reset button and verify that default checkboxes are selected""" page = TreeherderPage(selenium, base_url).open() all_jobs = len(page.all_jobs) page.click_on_filters_panel() page.deselect_all_failures() assert not page.checkbox_testfailed_is_selected assert not page.checkbox_busted_is_selected assert not page.checkbox_exception_is_selected filtered_jobs = len(page.all_jobs) assert not all_jobs == filtered_jobs page.reset_filters() assert page.checkbox_testfailed_is_selected assert page.checkbox_busted_is_selected assert page.checkbox_exception_is_selected
def test_switch_repo(base_url, selenium): """Switch to new active watched repo""" page = TreeherderPage(selenium, base_url).open() assert 'mozilla-inbound' == page.active_watched_repo page.select_mozilla_central_repo() assert 'mozilla-central' == page.active_watched_repo
def test_filter_by_test_status(base_url, selenium): """Open Treeherder page, open Filters Panel, select one filter, verify results""" page = TreeherderPage(selenium, base_url).open() page.filter_unclassified_jobs() page.click_on_filters_panel() # Test 'testfailed' unclassified failures page.deselect_busted_failures() page.deselect_exception_failures() if len(page.all_jobs) > 0: page.open_next_unclassified_failure() assert 'testfailed' == page.info_panel.job_details.job_result_status # Test 'busted' unclassified failures page.select_busted_failures() page.deselect_testfailed_failures() if len(page.all_jobs) > 0: page.close_the_job_panel() page.open_next_unclassified_failure() assert 'busted' == page.info_panel.job_details.job_result_status # Test 'exception' unclassified failures page.select_exception_failures() page.deselect_busted_failures() if len(page.all_jobs) > 0: page.close_the_job_panel() page.open_next_unclassified_failure() assert 'exception' == page.info_panel.job_details.job_result_status