Bug 1453588 - Improve Selenium tests by adding explicit waits

This commit is contained in:
Dave Hunt 2018-04-12 11:08:17 +01:00
Родитель a6391664fa
Коммит c6eb87308d
4 изменённых файлов: 6 добавлений и 1 удалений

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

@ -12,7 +12,7 @@ def commits(create_push, create_commit, test_repository):
def test_filter_jobs_by_author(base_url, selenium, commits):
page = Treeherder(selenium, base_url).open()
assert len(page.pushes) == 2
page.wait.until(lambda _: len(page.pushes) == 2)
# check authors are distinct
assert len(set(push.author for push in page.pushes)) == 2
author = page.pushes[-1].author
@ -26,6 +26,7 @@ def test_filter_jobs_by_author(base_url, selenium, commits):
def test_clear_filter_jobs_by_author(base_url, selenium, commits):
page = Treeherder(selenium, base_url).open()
page.wait.until(lambda _: len(page.pushes) == 2)
page.pushes[0].filter_by_author()
page.wait.until(lambda _: len(page.pushes) == 1)
page.active_filters.filters[0].clear()

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

@ -15,6 +15,7 @@ def test_jobs(eleven_job_blobs, create_jobs):
@pytest.mark.parametrize('result', RESULTS)
def test_filter_jobs_by_failure_result(base_url, selenium, test_jobs, result):
page = Treeherder(selenium, base_url).open()
page.wait.until(lambda _: len(page.all_jobs) == len(test_jobs))
assert len(page.all_jobs) == len(RESULTS)
with page.filters_menu() as filters:
for result in RESULTS:

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

@ -3,6 +3,7 @@ from pages.treeherder import Treeherder
def test_set_as_top_of_range(base_url, selenium, test_job):
page = Treeherder(selenium, base_url).open()
page.wait.until(lambda _: page.all_jobs)
pushes = page.pushes
datestamp = pushes[1].datestamp
assert pushes[0].datestamp != datestamp
@ -12,6 +13,7 @@ def test_set_as_top_of_range(base_url, selenium, test_job):
def test_set_as_bottom_of_range(base_url, selenium, test_job):
page = Treeherder(selenium, base_url).open()
page.wait.until(lambda _: page.all_jobs)
pushes = page.pushes
datestamp = pushes[-2].datestamp
assert pushes[-1].datestamp != datestamp

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

@ -3,6 +3,7 @@ from pages.treeherder import Treeherder
def test_reset_filters(base_url, selenium, test_job):
page = Treeherder(selenium, base_url).open()
page.wait.until(lambda _: page.all_jobs)
with page.filters_menu() as filters:
getattr(filters, 'toggle_{}_jobs'.format(test_job.result))()
assert len(page.all_jobs) == 0