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
3 changes: 2 additions & 1 deletion locators/header_page_locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ class HeaderAuthorizedLocators:
LINK_GITHUB_AUTH = (By.XPATH, "(//nav//a)[11]")
LINK_GROUPS_AUTH = (By.XPATH, "(//nav//a)[2]")
LINK_GROUPS_AUTH2 = (By.XPATH, "(//nav//a)[6]")
LINK_STATISTICS_AUTH = (By.XPATH, "(//nav//a)[3]")
LINK_STATISTICS_AUTH1 = (By.XPATH, "(//nav//a)[3]")
LINK_STATISTICS_AUTH2 = (By.XPATH, "(//nav//a)[7]")
LINK_STATISTICS_AUTH3 = (By.XPATH, "(//nav//a)[17]")
LINK_PROFILE = (By.XPATH, "(//nav//a)[12]")
LINK_TELEGRAM_AUTH = (By.XPATH, "(//nav//a)[5]")
LINK_TELEGRAM_AUTH2 = (By.XPATH, "(//nav//a)[9]")
Expand Down
15 changes: 11 additions & 4 deletions pages/header_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def get_links_href_unauth(self):
@allure.step("Get attribute 'href' of links in the Header for an authorized user")
def get_links_href_auth(self):
att = [element.get_attribute("href") for element in self.get_list_of_links_auth()]
print(*att, len(att), sep='\n')
# print(*att, len(att), sep='\n')
return att
# return [element.get_attribute("href") for element in self.get_list_of_links_auth()]

Expand Down Expand Up @@ -388,6 +388,7 @@ def click_on_internal_links_in_header_auth1(self):
link.click()
Wait(self.driver, 10).until(EC.url_changes(current_url))
opened_pages.append(self.get_current_tab_url())
print(*opened_pages, sep='\n')
return opened_pages

@allure.step("""Click on direct internal links in the Header
Expand All @@ -396,8 +397,8 @@ def click_on_direct_internal_links_in_header_auth(self):
opened_pages = []
current_url = self.get_current_tab_url()

# Click on the 'Statistics' link
self.element_is_present_and_clickable(self.locators1.LINK_STATISTICS_AUTH).click()
# Click on the 'Statistics' link #1
self.element_is_present_and_clickable(self.locators1.LINK_STATISTICS_AUTH1).click()
Wait(self.driver, 10).until(EC.url_changes(current_url))
current_url = self.get_current_tab_url()
opened_pages.append(current_url)
Expand All @@ -412,8 +413,14 @@ def click_on_direct_internal_links_in_header_auth(self):
self.element_is_present_and_clickable(self.locators1.LINK_ABOUT_AUTH).click()
Wait(self.driver, 10).until(EC.url_changes(current_url))
current_url = self.get_current_tab_url()
opened_pages.append(current_url)

# Click on the 'Statistics' link #3
self.element_is_present_and_clickable(self.locators1.LINK_STATISTICS_AUTH3).click()
Wait(self.driver, 10).until(EC.url_changes(current_url))
current_url = self.get_current_tab_url()
opened_pages.append(current_url) # to be continued
# print(opened_pages)
print(*opened_pages, sep='\n')

return opened_pages

Expand Down
4 changes: 1 addition & 3 deletions tests/header_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ def test_hpu_03_01_verify_unauth_header_links(self, driver, main_page_open):
links_clickability = page.check_links_clickability_unauth()
tg_link_title = page.get_tg_link_title()
links_href = page.get_links_href_unauth()
print(*links_href)
link_status_codes = page.get_links_status_codes_unauth()
print(*link_status_codes)
assert links_clickability, "Links are unclickable"
assert tg_link_title, "The link title value is empty"
assert tg_link_title in hPD.link_titles, "The link title mismatches the valid value"
Expand Down Expand Up @@ -342,7 +340,7 @@ def test_hpa_03_02_verify_auth_internal_links_lead_to_proper_pages(self, driver,
assert all(element in hPD.set_auth for element in opened_pages), \
"Some of internal links lead to incorrect pages after clicking"

@allure.title("""test_hpa.03.02.01 Verify if direct internal links in the Header for an authorized user
@allure.title("""test_hpa.03.02.01 Verify if 4 direct internal links in the Header for an authorized user
lead to correct pages after clicking""")
def test_hpa_03_02_01_verify_auth_direct_internal_links_navigation(self, driver, auto_test_user_authorized):
page = hPage(driver)
Expand Down
Loading