From 9da4097e8dbef9ef5f7bf41ebf1a4c98510d4860 Mon Sep 17 00:00:00 2001 From: nsubbot Date: Tue, 20 Jan 2026 13:16:50 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=B4=D1=81=D0=B2=D0=B5=D1=82=D0=BA=D0=B8=20=D0=B2?= =?UTF-8?q?=D1=8B=D0=B1=D1=80=D0=B0=D0=BD=D0=BD=D0=BE=D0=B9=20=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=BE=D0=BA=D0=B8=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86?= =?UTF-8?q?=D1=8B=20=D1=81=D0=B5=D1=80=D0=B2=D0=B8=D1=81=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=B2=D1=8B=D0=B7=D0=B2=D0=B0=D0=BD=D0=BD=D0=B0=D1=8F=20=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D0=B5=D0=BA=D1=80=D1=8B=D1=82=D0=B8=D0=B5=D0=BC=20?= =?UTF-8?q?=D1=8D=D0=BB=D0=B5=D0=BC=D0=B5=D0=BD=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/table_component.py | 44 ++++++++--------------------------- pages/service_status_tab.py | 7 +----- 2 files changed, 11 insertions(+), 40 deletions(-) diff --git a/components/table_component.py b/components/table_component.py index a07c5da..e50b059 100644 --- a/components/table_component.py +++ b/components/table_component.py @@ -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") diff --git a/pages/service_status_tab.py b/pages/service_status_tab.py index b3a7994..b628523 100644 --- a/pages/service_status_tab.py +++ b/pages/service_status_tab.py @@ -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: """Проверяет наличие заголовка вкладки.