From 56527b5753f20a548e5094a1b02b28d3c3bda1f4 Mon Sep 17 00:00:00 2001 From: Alena Krauch Date: Thu, 9 Jul 2026 14:20:00 +0300 Subject: [PATCH] ref test_hpa_03.02.01_verify_auth_direct_internal_links_navigation update header_test.py, header_page.py, header_page_locators.py #268 --- locators/header_page_locators.py | 3 ++- pages/header_page.py | 15 +++++++++++---- tests/header_test.py | 4 +--- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/locators/header_page_locators.py b/locators/header_page_locators.py index 4f53c8951d..96c8ed6f71 100644 --- a/locators/header_page_locators.py +++ b/locators/header_page_locators.py @@ -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]") diff --git a/pages/header_page.py b/pages/header_page.py index d248a862a4..b39843f2c5 100644 --- a/pages/header_page.py +++ b/pages/header_page.py @@ -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()] @@ -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 @@ -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) @@ -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 diff --git a/tests/header_test.py b/tests/header_test.py index 1a34dd033c..8e7b64ce1e 100644 --- a/tests/header_test.py +++ b/tests/header_test.py @@ -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" @@ -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)