Skip to content

Commit 31e5e4e

Browse files
Merge pull request #746 from Brain-up/issue_268
Issue_268_HEADER_links
2 parents fd38e61 + 46720c1 commit 31e5e4e

2 files changed

Lines changed: 25 additions & 14 deletions

File tree

‎pages/header_page.py‎

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,21 @@ def get_structure_of_6th_level(self):
7171
def check_elements_invisibility_on_6th_level_in_header(self):
7272
return all(self.element_is_not_visible(element) for element in self.get_structure_of_6th_level()[:6])
7373

74-
@allure.step("Get the list of links on different levels of nesting in the Header for an unauthorized user")
74+
# Lists of links for an UNAUTHORIZED user
75+
76+
@allure.step("Get the list of links on different levels of nesting in the Header for an unauthorized user - ACTUAL")
7577
def get_list_of_links_unauth(self):
7678
return self.elements_are_present(self.locators.HEADER_LINKS_UNAUTH)
7779

7880
@allure.step("""Get the list of the 'About', 'Telegram', 'Registration', 'Logo' links (direct links) in the Header
79-
for an unauthorized user""")
80-
def get_list_of_direct_links_unauth(self):
81+
for an unauthorized user -- ACTUAL""")
82+
def get_direct_links_unauth_list(self):
8183
links = self.get_list_of_links_unauth()
8284
direct_links = []
8385
for i in [1, 2, 9, 0]:
8486
direct_links.append(links[i])
87+
att1 = [element.get_attribute("href") for element in direct_links]
88+
print(*att1, len(att1), sep='\n')
8589
return direct_links
8690

8791

@@ -99,7 +103,7 @@ def get_direct_links_auth_list(self):
99103
for i in [1, 2, 3, 4, 16, 17, 0]:
100104
direct_links.append(links[i])
101105
att1 = [element.get_attribute("href") for element in direct_links]
102-
print(*att1, len(att1), sep='\n')
106+
# print(*att1, len(att1), sep='\n')
103107
return direct_links
104108

105109
@allure.step("""Get the list of the 'Groups', 'Statistics' (x2), 'About', 'Profile', 'Logo' links
@@ -110,7 +114,7 @@ def get_direct_internal_links_auth_list(self):
110114
for i in [0, 1, 2, 4, 5, 6]:
111115
direct_internal_links.append(direct_links[i])
112116
att2 = [element.get_attribute("href") for element in direct_internal_links]
113-
print(*att2, len(att2), sep='\n')
117+
# print(*att2, len(att2), sep='\n')
114118
return direct_internal_links
115119

116120
@allure.step("""Get the list with the 'Telegram' link #1
@@ -139,21 +143,21 @@ def get_dropdown_internal_links_auth_list(self):
139143
links2 = self.get_dropdown_links_auth_list()[6:]
140144
links = links1 + links2
141145
att = [element.get_attribute("href") for element in links]
142-
print(*att, len(att), sep='\n')
146+
# print(*att, len(att), sep='\n')
143147
return links
144148

145149
@allure.step("""Get the list of the 'Telegram', 'Donate', 'GitHub' links (external links)
146150
in the 'More' dropdown in the Header for AUTHORIZED user -- ACTUAL""")
147151
def get_dropdown_external_links_auth_list(self):
148152
links = self.get_dropdown_links_auth_list()[3:6]
149153
att = [element.get_attribute("href") for element in links]
150-
print(*att, len(att), sep='\n')
154+
# print(*att, len(att), sep='\n')
151155
return links
152156

153157

154158
@allure.step("Check the 'About', 'Telegram', 'Registration', 'Logo' links are visible for an unauthorized user")
155159
def check_direct_links_visibility_unauth(self):
156-
return all(link.is_displayed() for link in self.get_list_of_direct_links_unauth())
160+
return all(link.is_displayed() for link in self.get_direct_links_unauth_list())
157161

158162
@allure.step("""Check the 'Groups', 'Statistics', 'About', 'Telegram', 'Registration', 'Logo' links are visible "
159163
for an authorized user""")
@@ -190,9 +194,9 @@ def check_links_visibility_in_more(self):
190194
(internal links) in the 'More' dropdown for every user -- FOR REVIEW""")
191195
def get_list_of_internal_links_in_more(self):
192196
links = self.get_list_of_links_in_more()[2:]
193-
print(links)
197+
# print(links)
194198
att = [element.get_attribute("href") for element in links]
195-
print(*att, len(att), sep='\n')
199+
# print(*att, len(att), sep='\n')
196200
return links
197201
# return self.get_list_of_links_in_more()[2:]
198202

@@ -327,7 +331,7 @@ def check_user_name_visibility(self):
327331
# Checks of text in the Header
328332
@allure.step("Get text in the 'About', 'Telegram', 'Registration' links in the Header for an unauthorized user")
329333
def get_text_in_direct_links_unauth(self):
330-
return [link.text for link in self.get_list_of_direct_links_unauth()[:3]]
334+
return [link.text for link in self.get_direct_links_unauth_list()[:3]]
331335

332336
@allure.step("""Get text in the 'Groups', 'Statistics', 'About', 'Telegram' links in the Header
333337
for an authorized user""")
@@ -384,13 +388,13 @@ def get_links_href_auth(self):
384388
@allure.step("Get status codes of links in the Header for an unauthorized user")
385389
def get_links_status_codes_unauth(self):
386390
status_codes = [requests.head(link_href).status_code for link_href in self.get_links_href_unauth()]
387-
print(status_codes, len(status_codes), sep='\n')
391+
# print(status_codes, len(status_codes), sep='\n')
388392
return status_codes
389393

390394
@allure.step("Get status codes of links in the Header for an authorized user")
391395
def get_links_status_codes_auth(self):
392396
status_codes = [requests.head(link_href).status_code for link_href in self.get_links_href_auth()]
393-
print(status_codes, len(status_codes), sep='\n')
397+
# print(status_codes, len(status_codes), sep='\n')
394398
return status_codes
395399

396400
# Checks of links navigation

‎tests/header_test.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def test_hpu_02_01_verify_unauth_text_in_links_and_buttons(self, driver, main_pa
101101
"Text in 'ru-en' buttons mismatches valid values"
102102

103103
class TestUnHdPageLinks:
104-
@allure.title("""test_hpa_03.01 Verify clickability, href, status code of links in the Header
104+
@allure.title("""test_hpu_03.01 Verify clickability, href, status code of links in the Header
105105
for an unauthorized user""")
106106
def test_hpu_03_01_verify_unauth_header_links(self, driver, main_page_open):
107107
page = hPage(driver)
@@ -118,6 +118,13 @@ def test_hpu_03_01_verify_unauth_header_links(self, driver, main_page_open):
118118
assert all(element in hPD.link_status_codes for element in link_status_codes), \
119119
"Status codes of links mismatch valid values"
120120

121+
@allure.title("""test_hpu.03.01.00 Verify the list of direct links in the Header
122+
for an unauthorized user""")
123+
def test_hpu_03_01_00_verify_unauth_direct_links_list(self, driver, main_page_open):
124+
page = hPage(driver)
125+
direct_links = page.get_direct_links_unauth_list()
126+
assert direct_links, "Links are not collected in the list"
127+
121128
@allure.title("""Verify if internal links in the Header for an unauthorized user
122129
lead to correct pages after click""")
123130
def test_hpu_03_02_verify_unauth_internal_links_lead_to_correct_pages(self, driver, main_page_open):

0 commit comments

Comments
 (0)