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: