diff --git a/locators/header_page_locators.py b/locators/header_page_locators.py index de49aed23c..d73730afbb 100644 --- a/locators/header_page_locators.py +++ b/locators/header_page_locators.py @@ -61,7 +61,7 @@ class HeaderAuthorizedLocators: LINK_STATISTICS_AUTH2 = (By.XPATH, "(//nav//a)[7]") LINK_STATISTICS_AUTH3 = (By.XPATH, "(//nav//a)[17]") LINK_PROFILE_AUTH = (By.XPATH, "(//nav//a)[18]") - LINK_TELEGRAM_AUTH = (By.XPATH, "(//nav//a)[5]") + LINK_TELEGRAM_AUTH1 = (By.XPATH, "(//nav//a)[5]") LINK_TELEGRAM_AUTH2 = (By.XPATH, "(//nav//a)[9]") LOGO_IMAGE_AUTH = (By.XPATH, "(//nav//*[name()='svg'])[1]") LOGOUT_BUTTON = (By.XPATH, "//button[@data-test-logout-button]") diff --git a/pages/header_page.py b/pages/header_page.py index 55f7a2fa85..d6829dfb8d 100644 --- a/pages/header_page.py +++ b/pages/header_page.py @@ -419,7 +419,7 @@ def click_on_internal_links_in_header_auth1(self): 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""") + and thereby open corresponding web pages in the same tab for an AUTHORIZED user -- ACTUAL""") def click_on_direct_internal_links_in_header_auth(self): opened_pages = [] current_url = self.get_current_tab_url() @@ -452,17 +452,31 @@ def click_on_direct_internal_links_in_header_auth(self): self.element_is_present_and_clickable(self.locators1.LINK_PROFILE_AUTH).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 + opened_pages.append(current_url) print(*opened_pages, sep='\n') return opened_pages + @allure.step("""Click on direct external links in the Header + and thereby open corresponding web pages in the new tab for an AUTHORIZED user -- ACTUAL""") + def click_on_direct_external_links_in_header_auth(self): + opened_pages = [] + + # Click on the 'Telegram' link #1 + self.element_is_present_and_clickable(self.locators1.LINK_TELEGRAM_AUTH1).click() + self.driver.switch_to.window(self.driver.window_handles[1]) + current_tab_url = self.get_current_tab_url() + opened_pages.append(current_tab_url) + self.driver.switch_to.window(self.driver.window_handles[0]) + print(*opened_pages, sep='\n') + return opened_pages + @allure.step("Click on the 'Groups' link #2 for AUTHORIZED user") 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") @@ -470,7 +484,7 @@ def click_on_Statistics_link_auth2(self): self.click_more_button() self.element_is_present_and_clickable(self.locators1.LINK_STATISTICS_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 'About' link #2 for AUTHORIZED user") @@ -503,7 +517,7 @@ def click_on_auth_external_links_in_header(self): @allure.step("Click on the 'Telegram' link #1 for AUTHORIZED user") def click_on_Telegram_link_auth1(self): - self.element_is_present_and_clickable(self.locators1.LINK_TELEGRAM_AUTH).click() + self.element_is_present_and_clickable(self.locators1.LINK_TELEGRAM_AUTH1).click() self.driver.switch_to.window(self.driver.window_handles[1]) current_tab_url = self.get_current_tab_url() self.driver.switch_to.window(self.driver.window_handles[0]) diff --git a/tests/header_test.py b/tests/header_test.py index 50c5cb4b51..816d0315dc 100644 --- a/tests/header_test.py +++ b/tests/header_test.py @@ -363,10 +363,13 @@ def test_hpa_03_02_02_verify_auth_direct_external_links_list(self, driver, auto_ direct_internal_links = page.get_direct_external_links_auth_list() assert direct_internal_links, "Links are not collected in the list" - @allure.title("""test_hpa.03.02.03 Verify if direct external links in the Header + @allure.title("""test_hpa.03.02.03 Verify if direct external links in the Header ('Telegram') for an authorized user lead to correct pages after clicking""") def test_hpa_03_02_03_verify_auth_direct_external_links_navigation(self, driver, auto_test_user_authorized): - pass + page = hPage(driver) + opened_pages = page.click_on_direct_external_links_in_header_auth() + assert all(element in hPD.set_auth for element in opened_pages), \ + "Some of direct external links lead to incorrect pages after clicking" @allure.title("""test_hpa.03.03 Verify the list of links in the Header's dropdown for an authorized user""") @@ -433,15 +436,12 @@ def test_hpa_03_03_09_verify_auth_dropdown_external_links(self, driver, auto_tes 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" - @allure.title("""test_hpa.03.03.10 Verify if external Telegram links #1,2 in the Header's dropdown + @allure.title("""test_hpa.03.03.10 Verify if external Telegram link #2 in the Header's dropdown for an authorized user lead to the correct page after clicking""") def test_hpa_03_03_10_verify_auth_telegram_links_navigation(self, driver, auto_test_user_authorized): page = hPage(driver) - opened_page1 = page.click_on_Telegram_link_auth1() opened_page2 = page.click_on_Telegram_link_auth2() - assert opened_page1 in hPD.set_auth, "The Telegram link #1 leads to an incorrect page after clicking" assert opened_page2 in hPD.set_auth, "The Telegram link #2 leads to an incorrect page after clicking" - assert opened_page1 == opened_page2, "The Telegram links #1,2 are the same" @allure.title("""test_hpa.03.03.11 Verify if external Donate link in the Header's dropdown for an authorized user leads to the correct page after clicking""")