e-nms_qa_automation/components/card_component.py

46 lines
1.5 KiB
Python
Raw Permalink 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.

"""Модуль компонента карточки пользователя.
Содержит класс для работы с карточкой пользователя через Playwright.
"""
from playwright.sync_api import Page
from tools.logger import get_logger
from elements.button_element import Button
from components.base_component import BaseComponent
logger = get_logger("USER_CARD")
class CardComponent(BaseComponent):
"""Компонент карточки пользователя.
Предоставляет методы для взаимодействия с элементами карточки.
"""
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()
# Проверки:
# (Методы проверок могут быть добавлены здесь в будущем)