Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions pages/header_page.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Methods for verifying web elements in the Header of the site"""
import time
import allure
import requests
from selenium.webdriver.support import expected_conditions as EC
Expand Down Expand Up @@ -99,8 +98,10 @@ def get_list_of_direct_links_unauth(self):
def get_list_of_direct_links_auth(self):
links = self.get_list_of_links_auth()
direct_links = []
for i in [1, 2, 3, 4, 11, 0]:
# for i in [1, 2, 3, 4, 11, 0]:
for i in [1, 2, 3, 4, 17, 0]:
direct_links.append(links[i])
# print(*direct_links)
return direct_links

@allure.step("Check the 'About', 'Telegram', 'Registration', 'Logo' links are visible for an unauthorized user")
Expand Down Expand Up @@ -279,16 +280,22 @@ def check_user_name_visibility(self):
def get_text_in_direct_links_unauth(self):
return [link.text for link in self.get_list_of_direct_links_unauth()[:3]]

@allure.step("""Get text in the 'Groups', 'Statistics', 'About', 'Telegram', 'Profile' links in the Header
@allure.step("""Get text in the 'Groups', 'Statistics', 'About', 'Telegram' links in the Header
for an authorized user""")
def get_text_in_direct_links_auth(self):
return [link.text for link in self.get_list_of_direct_links_auth()[:5]]
direct_links_text = [link.text for link in self.get_list_of_direct_links_auth()[:4]]
print(*direct_links_text, len(direct_links_text), sep='\n')
return direct_links_text
# return [link.text for link in self.get_list_of_direct_links_auth()[:5]]

@allure.step("""Get text in the 'Donate', 'GitHub', 'Contacts', 'Specialists', 'Contributors', 'Used Resources'
links in the Header""")
def get_text_of_links_in_more(self):
self.click_more_button()
return [link.text for link in self.get_list_of_links_in_more()]
more_links_text = [link.text for link in self.get_list_of_links_in_more()]
print(*more_links_text, len(more_links_text), sep='\n')
return more_links_text
# return [link.text for link in self.get_list_of_links_in_more()]

@allure.step("Get text in buttons in the Header for an unauthorized user")
def get_text_in_buttons_unauth(self):
Expand Down
11 changes: 6 additions & 5 deletions test_data/header_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ class HeaderData:
"Используемые ресурсы", "Used Resources",
"Регистрация", "Registration")

links_text_auth = ("УПРАЖНЕНИЯ", "GROUPS",
"СТАТИСТИКА", "STATISTICS",
"ОПИСАНИЕ", "ABOUT",
"TELEGRAM",
links_text_auth = ("УПРАЖНЕНИЯ", "Упражнения", "GROUPS",
"СТАТИСТИКА", "Статистика", "STATISTICS",
"ОПИСАНИЕ", "Описание", "ABOUT",
"TELEGRAM", "Telegram",
"Пожертвовать", "Donate",
"GitHub",
"Контакты", "Contacts",
"Специалисты", "Specialists",
"Наша команда", "Contributors",
"Используемые ресурсы", "Used Resources")
"Используемые ресурсы", "Used Resources",
"Аудиометрия", "Audiometry")

buttons_text = ('RU', 'EN', 'ЕЩЕ...', 'MORE...')

Expand Down
2 changes: 1 addition & 1 deletion tests/header_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def test_hpa_02_01_verify_auth_text_in_links_and_buttons(self, driver, auto_test
ru_en_buttons_text = page.get_text_in_ru_en_buttons()
assert all(element in hPD.links_text_auth for element in direct_links_text[:4]), \
"Text in links in section 2 mismatches valid values"
assert direct_links_text[4], "Text in the 'Profile' link is absent"
assert direct_links_text, "Text in direct links is absent"
assert all(element in hPD.links_text_auth for element in links_in_more_text), \
"Text in links in section 3 mismatches valid values"
assert all(element in hPD.buttons_text for element in buttons_text), \
Expand Down
Loading