fix test_search_block
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import pytest
|
import pytest
|
||||||
import logging
|
import logging
|
||||||
import allure
|
import allure
|
||||||
from selenium.webdriver import Chrome, ChromeOptions
|
from selenium.webdriver import Chrome, ChromeOptions, Remote
|
||||||
|
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
|
|||||||
@@ -20,10 +20,11 @@ class TestExample(TestCase):
|
|||||||
self.driver.find_element_by_xpath("//input[not(@type='hidden')]").send_keys("foo")
|
self.driver.find_element_by_xpath("//input[not(@type='hidden')]").send_keys("foo")
|
||||||
self.check_by_screenshot(None, full_page=True)
|
self.check_by_screenshot(None, full_page=True)
|
||||||
|
|
||||||
def test_search_result(self):
|
def test_search_block(self):
|
||||||
self.driver.get("https://go.mail.ru/")
|
self.driver.get("https://go.mail.ru/")
|
||||||
|
|
||||||
def action():
|
def action():
|
||||||
|
# Тестируем подсветку таба после переключения на другую вертикаль
|
||||||
self.driver.find_element_by_xpath("//span[contains(text(), 'Соцсети')]").click()
|
self.driver.find_element_by_xpath("//span[contains(text(), 'Соцсети')]").click()
|
||||||
|
|
||||||
self.check_by_screenshot((By.CSS_SELECTOR, ".MainPage-verticalLinksWrapper"), action=action)
|
self.check_by_screenshot((By.CSS_SELECTOR, ".MainVerticalsNav-listItemActive"), action=action)
|
||||||
|
|||||||
@@ -69,10 +69,7 @@ class TestCase(common.TestCase):
|
|||||||
|
|
||||||
# эта часть последнего скриншота, которая дублирует предпоследний скриншот
|
# эта часть последнего скриншота, которая дублирует предпоследний скриншот
|
||||||
# так просходит потому что не всегда страница делится на целое количество вьюпортов
|
# так просходит потому что не всегда страница делится на целое количество вьюпортов
|
||||||
if total_height >= offset:
|
over_height = offset - total_height
|
||||||
over_height = offset - total_height
|
|
||||||
else:
|
|
||||||
over_height = 0
|
|
||||||
logging.info(f"offset: {offset}, total height: {total_height}, over height: {over_height}, pixel density: {self.pixel_ratio}")
|
logging.info(f"offset: {offset}, total height: {total_height}, over height: {over_height}, pixel density: {self.pixel_ratio}")
|
||||||
return self.image_processor.paste(screenshots, over_height * self.pixel_ratio)
|
return self.image_processor.paste(screenshots, over_height * self.pixel_ratio)
|
||||||
|
|
||||||
@@ -96,6 +93,7 @@ class TestCase(common.TestCase):
|
|||||||
y = location["y"]
|
y = location["y"]
|
||||||
width = location["x"] + size['width']
|
width = location["x"] + size['width']
|
||||||
height = location["y"] + size['height']
|
height = location["y"] + size['height']
|
||||||
|
# (312, 691, 1112, 691)
|
||||||
return x, y, width, height
|
return x, y, width, height
|
||||||
|
|
||||||
def _get_coords_by_locator(self, locator_type, query_string) -> Tuple[int, int, int, int]:
|
def _get_coords_by_locator(self, locator_type, query_string) -> Tuple[int, int, int, int]:
|
||||||
|
|||||||
Reference in New Issue
Block a user