e-nms_qa_automation/components/card_component.py

44 lines
1.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

from playwright.sync_api import Page
from components.base_component import BaseComponent
from elements.button_element import Button
from tools.logger import get_logger
logger = get_logger("USER_CARD")
class CardComponent(BaseComponent):
"""Компонент карточки пользователя.
Предоставляет методы для взаимодействия с элементами карточки пользователя.
Атрибуты:
page: экземпляр страницы Playwright
logout_button: кнопка выхода из системы
"""
def __init__(self, page: Page):
"""Инициализация компонента карточки пользователя.
Args:
page: экземпляр страницы Playwright
"""
super().__init__(page)
self.logout_button = Button(
page,
page.get_by_role("button", name="Выйти"),
"logout button"
)
# Действия:
def click_logout_button(self):
"""Нажатие кнопки выхода из системы.
Выполняет клик по кнопке 'Выйти' в карточке пользователя.
"""
self.logout_button.click()
# Проверки:
# (Методы проверок могут быть добавлены здесь в будущем)