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
1 change: 1 addition & 0 deletions locators/header_page_locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class HeaderAuthorizedLocators:
HEADER_LINKS_AUTH = (By.XPATH, "//nav//a")
HEADER_ICONS = (By.XPATH, "//nav//*[name()='svg']")
HEADPHONE_ICON = (By.XPATH, "(//nav//*[name()='svg'])[2]")
LINK_GROUPS_AUTH = (By.XPATH, "(//nav//a)[2]")
LINK_PROFILE = (By.XPATH, "(//nav//a)[12]")
LINK_TELEGRAM_AUTH = (By.XPATH, "(//nav//a)[5]")
LOGO_IMAGE_AUTH = (By.XPATH, "(//nav//*[name()='svg'])[1]")
Expand Down
16 changes: 15 additions & 1 deletion pages/header_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def click_on_internal_links_in_header_unauth(self):

@allure.step("""Click on internal links in the Header and thereby open corresponding web pages in the same tab
for an authorized user""")
def click_on_internal_links_in_header_auth(self):
def click_on_internal_links_in_header_auth1(self):
opened_pages = []
# Click on the 'Statistics', 'Groups', 'About', 'Profile', 'Logo' links
for link in self.get_list_of_direct_internal_links_auth():
Expand All @@ -380,6 +380,20 @@ def click_on_internal_links_in_header_auth(self):
opened_pages.append(self.get_current_tab_url())
return opened_pages

@allure.step("""Click on direct internal links in the Header
and thereby open corresponding web pages in the same tab for an authorized user""")
def click_on_direct_internal_links_in_header_auth(self):
opened_pages = []
current_url = self.get_current_tab_url()

# Click on the 'Groups' link
self.element_is_present_and_clickable(self.locators1.LINK_GROUPS_AUTH).click()
Wait(self.driver, 10).until(EC.url_changes(current_url))
opened_pages.append(self.get_current_tab_url()) # to be continued
print(opened_pages)

return opened_pages

@allure.step("""Click on external links in the Header and thereby open corresponding web pages on new tabs
for every user""")
def click_on_external_links_in_header(self):
Expand Down
13 changes: 12 additions & 1 deletion tests/header_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Auto tests for verifying web elements in the Header of the site"""
import allure
import pytest

from pages.header_page import HeaderPage as hPage
from test_data.header_data import HeaderData as hPD

Expand Down Expand Up @@ -305,16 +307,25 @@ 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"

@pytest.mark.xfail
@allure.title("""Verify if internal links in the Header for an authorized user
lead to correct pages after click""")
def test_hpa_03_02_verify_auth_internal_links_lead_to_proper_pages(self, driver, auto_test_user_authorized):
page = hPage(driver)
internal_links_in_more = page.get_list_of_internal_links_in_more()
opened_pages = page.click_on_internal_links_in_header_auth()
opened_pages = page.click_on_internal_links_in_header_auth1()
assert internal_links_in_more, "Internal links are not collected in the list"
assert all(element in hPD.set_auth for element in opened_pages), \
"Some of internal links lead to incorrect pages after clicking"

@allure.title("""Verify if direct internal links in the Header for an authorized user
lead to correct pages after click""")
def test_hpa_03_02_1_verify_auth_direct_internal_links_navigation(self, driver, auto_test_user_authorized):
page = hPage(driver)
opened_pages = page.click_on_direct_internal_links_in_header_auth()
assert all(element in hPD.set_auth for element in opened_pages), \
"Some of direct internal links lead to incorrect pages after clicking"

@allure.title("""Verify if external links in the Header for an authorized user
lead to correct pages after click""")
def test_hpa_03_03_verify_auth_external_links_lead_to_proper_pages(self, driver, auto_test_user_authorized):
Expand Down
Loading