Migrate test_reset_filters to Travis suite

This commit is contained in:
Dave Hunt 2018-01-08 13:29:40 +00:00
Родитель 2bc6b38494
Коммит c24f62d439
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: EA962DBFE7ABAD7B
4 изменённых файлов: 22 добавлений и 27 удалений

Просмотреть файл

@ -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)

Просмотреть файл

@ -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

Просмотреть файл

@ -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()

Просмотреть файл

@ -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