From b7352ebbc571800f44860ab2a418530b9081f99a Mon Sep 17 00:00:00 2001 From: Radislav Date: Fri, 29 Aug 2025 14:09:21 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BF=D1=80=D0=BE=D0=BA=D1=80=D1=83=D1=82=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BA=20=D1=8D=D0=BB=D0=B5=D0=BC=D0=B5=D0=BD=D1=82?= =?UTF-8?q?=D1=83=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D0=B8=20=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D0=B5=D0=B4=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=BE=D0=B9=20=D0=B5=D1=91=20=D0=B2=D0=B8=D0=B4=D0=B8=D0=BC?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/toolbar_component.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/components/toolbar_component.py b/components/toolbar_component.py index 06d146d..dc0e4bd 100644 --- a/components/toolbar_component.py +++ b/components/toolbar_component.py @@ -16,13 +16,8 @@ logger = get_logger("TOOLBAR") class ToolbarComponent(BaseComponent): - - """Компонент тулбара. Предоставляет методы для работы с панелью инструментов. - - - Args: page (Page): Экземпляр страницы Playwright title (str): Заголовок тулбара @@ -131,18 +126,21 @@ class ToolbarComponent(BaseComponent): expect(locator).to_be_visible(), message def check_button_presence(self, name: str) -> None: - """Проверяет наличие и видимость кнопки. + """Проверяет наличие и видимость кнопки с предварительной прокруткой к элементу. - Args: - name (str): Имя кнопки + Args: + name (str): Имя кнопки - Raises: - AssertionError: Если кнопка не найдена или не видна - """ + Raises: + AssertionError: Если кнопка не найдена или не видна + """ button = self.get_button_by_name(name) + if button is None: raise AssertionError(f"Unsupported button name {name}") + + button.locator.scroll_into_view_if_needed() button.check_presence(f"Button with name {name} is missing") def check_button_tooltip(self, name: str, tooltip: str) -> None: