diff --git a/locators/header_page_locators.py b/locators/header_page_locators.py index fd33922eec..de49aed23c 100644 --- a/locators/header_page_locators.py +++ b/locators/header_page_locators.py @@ -46,6 +46,7 @@ class HeaderUnauthorizedLocators: class HeaderAuthorizedLocators: + DROPDOWN_LINKS_AUTH = (By.XPATH, "//div[contains(@class, 'bottom')]/a") HEADER_LINKS_AUTH = (By.XPATH, "//nav//a") HEADER_ICONS = (By.XPATH, "//nav//*[name()='svg']") HEADPHONE_ICON = (By.XPATH, "(//nav//*[name()='svg'])[2]") diff --git a/pages/header_page.py b/pages/header_page.py index 32aa60f867..7863af9be2 100644 --- a/pages/header_page.py +++ b/pages/header_page.py @@ -76,10 +76,6 @@ def check_elements_invisibility_on_6th_level_in_header(self): def get_list_of_links_unauth(self): return self.elements_are_present(self.locators.HEADER_LINKS_UNAUTH) - @allure.step("Get the list of links on different levels of nesting in the Header for an authorized user -- ACTUAL") - def get_links_auth_list(self): - return self.elements_are_present(self.locators1.HEADER_LINKS_AUTH) - @allure.step("""Get the list of the 'About', 'Telegram', 'Registration', 'Logo' links (direct links) in the Header for an unauthorized user""") def get_list_of_direct_links_unauth(self): @@ -89,6 +85,13 @@ def get_list_of_direct_links_unauth(self): direct_links.append(links[i]) return direct_links + + # Lists of links for an AUTHORIZED user + + @allure.step("Get the list of links on different levels of nesting in the Header for an authorized user -- ACTUAL") + def get_links_auth_list(self): + return self.elements_are_present(self.locators1.HEADER_LINKS_AUTH) + @allure.step("""Get the list of the 'Groups', 'Statistics' (x2), 'About', 'Telegram', 'Profile', 'Logo' links (direct links) in the Header for an AUTHORIZED user -- ACTUAL""") def get_direct_links_auth_list(self): @@ -111,6 +114,13 @@ def get_direct_internal_links_auth_list(self): 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') + return dropdown_auth_links + @allure.step("Check the 'About', 'Telegram', 'Registration', 'Logo' links are visible for an unauthorized user") def check_direct_links_visibility_unauth(self): diff --git a/tests/header_test.py b/tests/header_test.py index ec9e49cee9..b29646094c 100644 --- a/tests/header_test.py +++ b/tests/header_test.py @@ -334,14 +334,6 @@ 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.skip - @allure.title("""test_hpa.03.02 Verify the list of internal links in the Header - for an authorized user""") - def test_hpa_03_02_verify_auth_internal_links_in_more(self, driver, auto_test_user_authorized): - page = hPage(driver) - internal_links_in_more = page.get_list_of_internal_links_in_more() - assert internal_links_in_more, "Internal 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): @@ -378,9 +370,16 @@ def test_hpa_03_02_04_verify_auth_about_link2_navigation(self, driver, auto_test opened_page2 = page.click_on_About_link_auth2() assert opened_page2 in hPD.set_auth, "The About link #2 leads to an incorrect page after clicking" - @allure.title("""test_hpa.03.03 Verify the list of external links in the Header's dropdown + @allure.title("""test_hpa.03.03 Verify the list of links in the Header's dropdown + for an authorized user""") + def test_hpa_03_03_verify_auth_dropdown_links_list(self, driver, auto_test_user_authorized): + page = hPage(driver) + links_in_dropdown = page.get_dropdown_links_auth_list() + assert links_in_dropdown, "Links in the Header's dropdown are not collected in the list" + + @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_verify_auth_external_links_in_dropdown(self, driver, auto_test_user_authorized): + def test_hpa_03_03_00_verify_auth_external_links_in_dropdown(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"