Исправлена ошибка подсветки выбранной строки таблицы сервисов вызванная перекрытием элементов
parent
e8f42aa480
commit
9da4097e8d
|
|
@ -327,56 +327,32 @@ class TableComponent(BaseComponent):
|
|||
new_color = hover_element.evaluate("el => window.getComputedStyle(el).backgroundColor")
|
||||
assert initial_color != new_color, "Color of row did not change when hovering the cursor"
|
||||
|
||||
def check_mui_table_row_highlighting(self, locator: str | Locator,
|
||||
row_index: int,
|
||||
offset_x: float,
|
||||
offset_y: float,
|
||||
scale_x: float,
|
||||
scale_y: float) -> None:
|
||||
def check_mui_table_row_highlighting(self, locator: str | Locator, row_index: int) -> None:
|
||||
"""Проверяет изменение цвета строки при наведении.
|
||||
|
||||
Args:
|
||||
locator: Локатор таблицы.
|
||||
row_index: Индекс проверяемой строки.
|
||||
offset_x, offset_y: смещение координат таблицы относительно начала координат
|
||||
scale_x, scale_y: коээфициенты масштабирования (причина: несовпадение масштабов контента страницы и фрейма)
|
||||
"""
|
||||
|
||||
print("row_index: "+str(row_index))
|
||||
table = self.get_locator(locator)
|
||||
row = table.locator("tbody").locator(".MuiTableRow-root").nth(row_index)
|
||||
# print(row)
|
||||
|
||||
# Прокручиваем и ждем
|
||||
# row.scroll_into_view_if_needed()
|
||||
# self.page.wait_for_timeout(5000)
|
||||
|
||||
# Получение "ограничительной рамки" строки
|
||||
bounding_box = row.evaluate("el => el.getBoundingClientRect()")
|
||||
print(bounding_box)
|
||||
assert bounding_box, "Requested row is not visible"
|
||||
|
||||
# Получение текущего цвета фона
|
||||
initial_color = row.evaluate("el => window.getComputedStyle(el).backgroundColor")
|
||||
|
||||
# Вычисление координат целевой строки таблицы и перевод на нее курсора мыши
|
||||
bounding_box = row.evaluate("el => el.getBoundingClientRect()")
|
||||
|
||||
# center_x = (bounding_box["x"] + bounding_box["width"] / 2 + offset_x) * scale_x
|
||||
# center_y = (bounding_box["y"] + bounding_box["height"] / 2 + offset_y) * scale_y
|
||||
|
||||
center_x = (bounding_box["x"] + bounding_box["width"] / 2) * scale_x + offset_x
|
||||
center_y = (bounding_box["y"] + bounding_box["height"] / 2) * scale_y + offset_y
|
||||
|
||||
# Прокручиваем и ждем
|
||||
row.scroll_into_view_if_needed()
|
||||
self.page.wait_for_timeout(3000)
|
||||
|
||||
self.page.wait_for_timeout(1000)
|
||||
|
||||
bounding_box = row.bounding_box()
|
||||
assert bounding_box, "Requested row is not visible"
|
||||
|
||||
center_x = bounding_box["x"] + bounding_box["width"] / 4
|
||||
center_y = bounding_box["y"] + bounding_box["height"] / 2
|
||||
|
||||
self.page.mouse.move(math.ceil(center_x), math.ceil(center_y), steps=5)
|
||||
self.page.wait_for_timeout(3000)
|
||||
# print(math.ceil(center_y))
|
||||
# print(offset_y)
|
||||
# print(scale_y)
|
||||
self.page.wait_for_timeout(1000)
|
||||
|
||||
# Получение текущего цвета фона
|
||||
new_color = row.evaluate("el => window.getComputedStyle(el).backgroundColor")
|
||||
|
|
|
|||
|
|
@ -282,12 +282,7 @@ class ServiceStatusTab(BasePage):
|
|||
|
||||
self.services_table.check_mui_table_row_highlighting(
|
||||
self.table_locator,
|
||||
row_index,
|
||||
offsets_scales["offset_x"],
|
||||
offsets_scales["offset_y"],
|
||||
offsets_scales["scale_x"],
|
||||
offsets_scales["scale_y"]
|
||||
)
|
||||
row_index)
|
||||
|
||||
def should_be_tab_title(self) -> None:
|
||||
"""Проверяет наличие заголовка вкладки.
|
||||
|
|
|
|||
Loading…
Reference in New Issue