simplify tests
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
from screenshot_tests.utils.screenshots import TestCase
|
||||
|
||||
|
||||
class TestExample(TestCase):
|
||||
"""Tests for https://go.mail.ru"""
|
||||
|
||||
def test_main_page(self):
|
||||
self.driver.get("https://go.mail.ru/")
|
||||
|
||||
def action():
|
||||
# Убираем фокус с инпута, чтобы тест не флакал из-за курсора
|
||||
self.driver.find_element_by_xpath("//*[text()='найти']").click()
|
||||
|
||||
self.check_by_screenshot(None, action=action, full_page=True)
|
||||
|
||||
def test_main_page_flaky(self):
|
||||
self.driver.get("https://go.mail.ru/")
|
||||
# Чтобы посмотреть как выглядит сломанный тест в отчетеы
|
||||
self.driver.find_element_by_xpath("//input[not(@type='hidden')]").send_keys("foo")
|
||||
self.check_by_screenshot(None, full_page=True)
|
||||
@@ -1,21 +0,0 @@
|
||||
from screenshot_tests.utils.screenshots import TestCase
|
||||
from screenshot_tests.page_objects.pages.yandex_main_page import YandexMainPage
|
||||
import random
|
||||
|
||||
|
||||
class TestYandexMainPage(TestCase):
|
||||
"""Tests for https://yandex.ru"""
|
||||
|
||||
def test_news_widget(self):
|
||||
"""Test for news widget."""
|
||||
page = self.get_page(YandexMainPage)
|
||||
self.check_by_screenshot(page.news_header)
|
||||
|
||||
def test_search_field(self):
|
||||
words = ["foo", "bar", "lol", "kek", "cheburek", "otus", "yandex", "google"]
|
||||
page = self.get_page(YandexMainPage)
|
||||
|
||||
def action():
|
||||
page.search_input.send_keys(random.choice(words))
|
||||
|
||||
self.check_by_screenshot(page.search_field, action)
|
||||
Reference in New Issue
Block a user