92 lines
4.1 KiB
Python
92 lines
4.1 KiB
Python
import allure
|
|
from selenium.webdriver.common.by import By
|
|
from config.ui_config import UIConfig
|
|
from tests.ui.pages.base_page import BasePage
|
|
|
|
|
|
class HomePage(BasePage):
|
|
# Локаторы
|
|
LOGO = (By.CLASS_NAME, "logo-text")
|
|
TEAM_TITLE = (By.XPATH, "//div[contains(@class, 'team-panel')]//h3")
|
|
ARTICLE_TITLE = (By.XPATH, "//div[contains(@class, 'blog-panel')]//h3")
|
|
TIME = (By.ID, "current-time")
|
|
TEAM_SECTION = (By.CLASS_NAME, "team-carousel")
|
|
ARTICLE_SECTION = (By.CLASS_NAME, "articles-list")
|
|
TEAM_NOT_FOUND = (By.XPATH, "//div[contains(@class, 'team-carousel')]//div[contains(@class, 'empty-state')]/span[not(contains(@class, 'empty-icon'))]")
|
|
ARTICLE_NOT_FOUND = (By.XPATH, "//div[contains(@class, 'articles-list')]//div[contains(@class, 'empty-state')]/span[not(contains(@class, 'empty-icon'))]")
|
|
AUTHOR_CARD = (By.CLASS_NAME, "team-member-card")
|
|
ARTICLE_CARD = (By.CLASS_NAME, "article-preview")
|
|
TEAM_VIEW_ALL = (By.XPATH, "//div[contains(@class, 'team-panel')]//a[contains(@class, 'view-all')]")
|
|
ARTICLE_VIEW_ALL = (By.XPATH, "//div[contains(@class, 'blog-panel')]//a[contains(@class, 'view-all')]")
|
|
|
|
def __init__(self, driver):
|
|
super().__init__(driver)
|
|
|
|
@allure.step("Открытие домашней страницы")
|
|
def open_home_page(self):
|
|
self.open(UIConfig.UI_BASE_URL)
|
|
|
|
@allure.step("Проверка большого лого")
|
|
def check_home_logo(self):
|
|
text = self.get_text(self.LOGO)
|
|
assert text == "Team"
|
|
return text
|
|
|
|
@allure.step("Проверка заголовка списка команды")
|
|
def check_home_team(self):
|
|
text = self.get_text(self.TEAM_TITLE)
|
|
assert text == "MEET THE TEAM"
|
|
return text
|
|
|
|
@allure.step("Проверка заголовка списка постов")
|
|
def check_home_posts(self):
|
|
text = self.get_text(self.ARTICLE_TITLE)
|
|
assert text == "LATEST ARTICLES"
|
|
return text
|
|
|
|
@allure.step("Проверить наличие раздела 'Meet the Team'")
|
|
def is_meet_the_team_section_displayed(self):
|
|
return self.is_visible(self.TEAM_SECTION)
|
|
|
|
@allure.step("Проверить наличие раздела 'Latest Articles'")
|
|
def is_latest_articles_section_displayed(self):
|
|
return self.is_visible(self.ARTICLE_SECTION)
|
|
|
|
@allure.step("Проверить сообщение 'No team members found'")
|
|
def check_no_team_members_message(self):
|
|
message = self.get_text(self.TEAM_NOT_FOUND)
|
|
assert "No team members found" in message, \
|
|
f"Ожидалось сообщение 'No team members found', получено '{message}'"
|
|
return message
|
|
|
|
@allure.step("Проверить сообщение 'No articles found'")
|
|
def check_no_articles_message(self):
|
|
message = self.get_text(self.ARTICLE_NOT_FOUND)
|
|
assert "No articles found" in message, \
|
|
f"Ожидалось сообщение 'No articles found', получено '{message}'"
|
|
return message
|
|
|
|
@allure.step("Проверить наличие карточки автора")
|
|
def is_member_card_displayed(self):
|
|
return self.is_visible(self.AUTHOR_CARD)
|
|
|
|
@allure.step("Проверить наличие карточки статьи")
|
|
def is_article_card_displayed(self):
|
|
return self.is_visible(self.ARTICLE_CARD)
|
|
|
|
@allure.step("Проверить видимость кнопки VIEW ALL TEAM")
|
|
def is_team_view_all_displayed(self):
|
|
return self.is_visible(self.TEAM_VIEW_ALL)
|
|
|
|
@allure.step("Проверить видимость кнопки VIEW ALL TEAM")
|
|
def is_article_view_all_displayed(self):
|
|
return self.is_visible(self.ARTICLE_VIEW_ALL)
|
|
|
|
@allure.step("Проверить кликабельность кнопки VIEW ALL TEAM")
|
|
def click_view_all_team_button(self):
|
|
self.click(self.TEAM_VIEW_ALL)
|
|
|
|
@allure.step("Проверить кликабельность кнопки VIEW ALL TEAM")
|
|
def click_view_all_article_button(self):
|
|
self.click(self.ARTICLE_VIEW_ALL)
|
|
|