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
23 changes: 11 additions & 12 deletions pages/header_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ def get_direct_links_auth_list(self):
direct_links = []
for i in [1, 2, 3, 4, 16, 17, 0]:
direct_links.append(links[i])
att1 = [element.get_attribute("href") for element in direct_links]
print(*att1, len(att1), sep='\n')
return direct_links

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

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


Expand Down Expand Up @@ -178,9 +178,8 @@ def get_list_of_external_links_in_more(self):
def get_list_of_external_links_in_more_auth(self):
links = self.get_list_of_links_in_more()[3:6]
att = [element.get_attribute("href") for element in links]
print(*att, len(att), sep='\n')
# print(*att, len(att), sep='\n')
return links
# return self.get_list_of_links_in_more()[:3]

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

@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()
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')
# 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()]

Expand Down Expand Up @@ -461,7 +460,7 @@ def click_on_Groups_link_auth2(self):
self.click_more_button()
self.element_is_present_and_clickable(self.locators1.LINK_GROUPS_AUTH2).click()
current_tab_url = self.get_current_tab_url()
print(current_tab_url)
# print(current_tab_url)
return current_tab_url

@allure.step("Click on the 'Statistics' link #2 for AUTHORIZED user")
Expand All @@ -477,7 +476,7 @@ def click_on_About_link_auth2(self):
self.click_more_button()
self.element_is_present_and_clickable(self.locators1.LINK_ABOUT_AUTH2).click()
current_tab_url = self.get_current_tab_url()
print(current_tab_url)
# print(current_tab_url)
return current_tab_url

@allure.step("""Click on external links in the Header
Expand Down Expand Up @@ -532,9 +531,9 @@ def click_on_GitHub_link_auth(self):
self.element_is_present_and_clickable(self.locators1.LINK_GITHUB_AUTH).click()
self.driver.switch_to.window(self.driver.window_handles[1])
current_tab_url = self.get_current_tab_url()
print(current_tab_url)
# print(current_tab_url)
self.driver.switch_to.window(self.driver.window_handles[0])
print(self.get_current_tab_url())
# print(self.get_current_tab_url())
return current_tab_url

@allure.step("""Click on external links in the Header
Expand Down
9 changes: 8 additions & 1 deletion tests/header_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,13 @@ def test_hpa_03_01_verify_auth_header_links(self, driver, auto_test_user_authori
assert all(element in hPD.link_status_codes for element in link_status_codes), \
"Status codes of links mismatch valid values"

@allure.title("""test_hpa.03.02 Verify the list of direct links in the Header
for an authorized user """)
def test_hpa_03_02_verify_auth_direct_links_list(self, driver, auto_test_user_authorized):
page = hPage(driver)
direct_links = page.get_direct_links_auth_list()
assert direct_links, "Links are not collected in the list"

@allure.title("""test_hpa.03.02.00 Verify the list of direct internal links in the Header
for an authorized user """)
def test_hpa_03_02_00_verify_auth_direct_internal_links_list(self, driver, auto_test_user_authorized):
Expand Down Expand Up @@ -379,7 +386,7 @@ def test_hpa_03_03_verify_auth_dropdown_links_list(self, driver, auto_test_user_

@allure.title("""test_hpa.03.03.00 Verify the list of external links in the Header's dropdown
for an authorized user""")
def test_hpa_03_03_00_verify_auth_external_links_in_dropdown(self, driver, auto_test_user_authorized):
def test_hpa_03_03_00_verify_auth_external_dropdown_links(self, driver, auto_test_user_authorized):
page = hPage(driver)
external_links_in_dropdown = page.get_list_of_external_links_in_more_auth()
assert external_links_in_dropdown, "External links are not collected in the list"
Expand Down
Loading