Skip to content

Commit b762ae3

Browse files
Merge pull request #718 from Brain-up/issue_268
Issue_268_HEADER_links
2 parents c63bcc1 + 40f591e commit b762ae3

2 files changed

Lines changed: 19 additions & 13 deletions

File tree

pages/header_page.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ def get_direct_links_auth_list(self):
9999
direct_links = []
100100
for i in [1, 2, 3, 4, 16, 17, 0]:
101101
direct_links.append(links[i])
102+
att1 = [element.get_attribute("href") for element in direct_links]
103+
print(*att1, len(att1), sep='\n')
102104
return direct_links
103105

104106
@allure.step("""Get the list of the 'Groups', 'Statistics' (x2), 'About', 'Profile', 'Logo' links
@@ -108,17 +110,15 @@ def get_direct_internal_links_auth_list(self):
108110
direct_internal_links = []
109111
for i in [0, 1, 2, 4, 5, 6]:
110112
direct_internal_links.append(direct_links[i])
111-
att1 = [element.get_attribute("href") for element in direct_links]
112-
print(*att1, len(att1), sep='\n')
113113
att2 = [element.get_attribute("href") for element in direct_internal_links]
114-
print(*att2, len(att2), sep='\n')
114+
# print(*att2, len(att2), sep='\n')
115115
return direct_internal_links
116116

117117
@allure.step("""Get the list of links in the 'More' dropdown in the Header for an AUTHORIZED user""")
118118
def get_dropdown_links_auth_list(self):
119119
dropdown_auth_links = self.elements_are_present(self.locators1.DROPDOWN_LINKS_AUTH)
120120
att1 = [element.get_attribute("href") for element in dropdown_auth_links]
121-
print(*att1, len(att1), sep='\n')
121+
# print(*att1, len(att1), sep='\n')
122122
return dropdown_auth_links
123123

124124

@@ -178,9 +178,8 @@ def get_list_of_external_links_in_more(self):
178178
def get_list_of_external_links_in_more_auth(self):
179179
links = self.get_list_of_links_in_more()[3:6]
180180
att = [element.get_attribute("href") for element in links]
181-
print(*att, len(att), sep='\n')
181+
# print(*att, len(att), sep='\n')
182182
return links
183-
# return self.get_list_of_links_in_more()[:3]
184183

185184
@allure.step("Get the general list of internal links in the Header for an unauthorized user""")
186185
def get_list_of_internal_links(self):
@@ -323,15 +322,15 @@ def get_text_in_direct_links_unauth(self):
323322
for an authorized user""")
324323
def get_text_in_direct_links_auth(self):
325324
direct_links_text = [link.text for link in self.get_direct_links_auth_list()[:4]]
326-
print(*direct_links_text, len(direct_links_text), sep='\n')
325+
# print(*direct_links_text, len(direct_links_text), sep='\n')
327326
return direct_links_text
328327

329328
@allure.step("""Get text in the 'Donate', 'GitHub', 'Contacts', 'Specialists', 'Contributors', 'Used Resources'
330329
links in the Header""")
331330
def get_text_of_links_in_more(self):
332331
self.click_more_button()
333332
more_links_text = [link.text for link in self.get_list_of_links_in_more()]
334-
print(*more_links_text, len(more_links_text), sep='\n')
333+
# print(*more_links_text, len(more_links_text), sep='\n')
335334
return more_links_text
336335
# return [link.text for link in self.get_list_of_links_in_more()]
337336

@@ -461,7 +460,7 @@ def click_on_Groups_link_auth2(self):
461460
self.click_more_button()
462461
self.element_is_present_and_clickable(self.locators1.LINK_GROUPS_AUTH2).click()
463462
current_tab_url = self.get_current_tab_url()
464-
print(current_tab_url)
463+
# print(current_tab_url)
465464
return current_tab_url
466465

467466
@allure.step("Click on the 'Statistics' link #2 for AUTHORIZED user")
@@ -477,7 +476,7 @@ def click_on_About_link_auth2(self):
477476
self.click_more_button()
478477
self.element_is_present_and_clickable(self.locators1.LINK_ABOUT_AUTH2).click()
479478
current_tab_url = self.get_current_tab_url()
480-
print(current_tab_url)
479+
# print(current_tab_url)
481480
return current_tab_url
482481

483482
@allure.step("""Click on external links in the Header
@@ -532,9 +531,9 @@ def click_on_GitHub_link_auth(self):
532531
self.element_is_present_and_clickable(self.locators1.LINK_GITHUB_AUTH).click()
533532
self.driver.switch_to.window(self.driver.window_handles[1])
534533
current_tab_url = self.get_current_tab_url()
535-
print(current_tab_url)
534+
# print(current_tab_url)
536535
self.driver.switch_to.window(self.driver.window_handles[0])
537-
print(self.get_current_tab_url())
536+
# print(self.get_current_tab_url())
538537
return current_tab_url
539538

540539
@allure.step("""Click on external links in the Header

tests/header_test.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,13 @@ def test_hpa_03_01_verify_auth_header_links(self, driver, auto_test_user_authori
334334
assert all(element in hPD.link_status_codes for element in link_status_codes), \
335335
"Status codes of links mismatch valid values"
336336

337+
@allure.title("""test_hpa.03.02 Verify the list of direct links in the Header
338+
for an authorized user """)
339+
def test_hpa_03_02_verify_auth_direct_links_list(self, driver, auto_test_user_authorized):
340+
page = hPage(driver)
341+
direct_links = page.get_direct_links_auth_list()
342+
assert direct_links, "Links are not collected in the list"
343+
337344
@allure.title("""test_hpa.03.02.00 Verify the list of direct internal links in the Header
338345
for an authorized user """)
339346
def test_hpa_03_02_00_verify_auth_direct_internal_links_list(self, driver, auto_test_user_authorized):
@@ -379,7 +386,7 @@ def test_hpa_03_03_verify_auth_dropdown_links_list(self, driver, auto_test_user_
379386

380387
@allure.title("""test_hpa.03.03.00 Verify the list of external links in the Header's dropdown
381388
for an authorized user""")
382-
def test_hpa_03_03_00_verify_auth_external_links_in_dropdown(self, driver, auto_test_user_authorized):
389+
def test_hpa_03_03_00_verify_auth_external_dropdown_links(self, driver, auto_test_user_authorized):
383390
page = hPage(driver)
384391
external_links_in_dropdown = page.get_list_of_external_links_in_more_auth()
385392
assert external_links_in_dropdown, "External links are not collected in the list"

0 commit comments

Comments
 (0)