From c24f62d439bbcbe2e2e064fad37713d5711bc327 Mon Sep 17 00:00:00 2001 From: Dave Hunt Date: Mon, 8 Jan 2018 13:29:40 +0000 Subject: [PATCH] Migrate test_reset_filters to Travis suite --- tests/jenkins/pages/treeherder.py | 9 --------- tests/jenkins/tests/test_filter_panel.py | 18 ------------------ tests/selenium/pages/treeherder.py | 12 ++++++++++++ tests/selenium/test_reset_filters.py | 10 ++++++++++ 4 files changed, 22 insertions(+), 27 deletions(-) delete mode 100644 tests/jenkins/tests/test_filter_panel.py create mode 100644 tests/selenium/test_reset_filters.py diff --git a/tests/jenkins/pages/treeherder.py b/tests/jenkins/pages/treeherder.py index 42b97ce61..64a0a4ee8 100644 --- a/tests/jenkins/pages/treeherder.py +++ b/tests/jenkins/pages/treeherder.py @@ -11,8 +11,6 @@ class TreeherderPage(Page): _active_watched_repo_locator = (By.CSS_SELECTOR, '#watched-repo-navbar button.active') _clear_filter_locator = (By.ID, 'quick-filter-clear-button') - _filter_panel_locator = (By.CSS_SELECTOR, 'span.navbar-right > span:nth-child(4)') - _filter_panel_reset_locator = (By.CSS_SELECTOR, '#filter-dropdown > li:last-child') _info_panel_content_locator = (By.ID, 'info-panel-content') _nav_filter_superseded_locator = (By.CSS_SELECTOR, '.btn-nav-filter[title=superseded]') _nav_filter_failures_locator = (By.CSS_SELECTOR, '.btn-nav-filter[title=failures]') @@ -140,9 +138,6 @@ class TreeherderPage(Page): else: raise Exception('Unsupported method: {}'.format(method)) - def click_on_filters_panel(self): - self.find_element(*self._filter_panel_locator).click() - def click_on_active_watched_repo(self): # FIXME workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1411264 el = self.find_element(By.CSS_SELECTOR, 'body') @@ -209,10 +204,6 @@ class TreeherderPage(Page): self.find_element(By.CSS_SELECTOR, 'body').send_keys(Keys.SPACE) self.wait.until(lambda _: self.pinboard.is_pinboard_open) - def reset_filters(self): - """Filters Panel must be opened""" - self.find_element(*self._filter_panel_reset_locator).click() - def select_next_job(self): self.find_element(By.CSS_SELECTOR, 'body').send_keys(Keys.ARROW_RIGHT) diff --git a/tests/jenkins/tests/test_filter_panel.py b/tests/jenkins/tests/test_filter_panel.py deleted file mode 100644 index 478577b48..000000000 --- a/tests/jenkins/tests/test_filter_panel.py +++ /dev/null @@ -1,18 +0,0 @@ -import pytest - -from pages.treeherder import TreeherderPage - - -@pytest.mark.nondestructive -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 diff --git a/tests/selenium/pages/treeherder.py b/tests/selenium/pages/treeherder.py index 36b565cdc..5b899a1e2 100644 --- a/tests/selenium/pages/treeherder.py +++ b/tests/selenium/pages/treeherder.py @@ -54,6 +54,10 @@ class Treeherder(Base): el = self.find_element(*self._quick_filter_locator) return el.get_attribute('value') + def reset_filters(self): + self.find_element(*self._filters_menu_locator).click() + self.FiltersMenu(self).reset() + def select_repository(self, name): self.find_element(*self._repo_menu_locator).click() # FIXME workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1411264 @@ -73,14 +77,22 @@ class Treeherder(Base): _root_locator = (By.ID, 'filter-dropdown') _busted_locator = (By.ID, 'busted') _exception_locator = (By.ID, 'exception') + _reset_locator = (By.CSS_SELECTOR, 'li[title="Reset to default status filters"]') + _success_locator = (By.ID, 'success') _testfailed_locator = (By.ID, 'testfailed') + def reset(self): + self.find_element(*self._reset_locator).click() + def toggle_busted_jobs(self): self.find_element(*self._busted_locator).click() def toggle_exception_jobs(self): self.find_element(*self._exception_locator).click() + def toggle_success_jobs(self): + self.find_element(*self._success_locator).click() + def toggle_testfailed_jobs(self): self.find_element(*self._testfailed_locator).click() diff --git a/tests/selenium/test_reset_filters.py b/tests/selenium/test_reset_filters.py new file mode 100644 index 000000000..01d707164 --- /dev/null +++ b/tests/selenium/test_reset_filters.py @@ -0,0 +1,10 @@ +from pages.treeherder import Treeherder + + +def test_reset_filters(base_url, selenium, test_job): + page = Treeherder(selenium, base_url).open() + with page.filters_menu() as filters: + getattr(filters, 'toggle_{}_jobs'.format(test_job.result))() + assert len(page.all_jobs) == 0 + page.reset_filters() + assert len(page.all_jobs) == 1