diff --git a/pages/header_page.py b/pages/header_page.py index 3c1a1b3f36..7fdf47a42e 100644 --- a/pages/header_page.py +++ b/pages/header_page.py @@ -415,8 +415,8 @@ def click_on_direct_internal_links_in_header_auth(self): 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): + for authorized user""") + def click_on_auth_external_links_in_header(self): opened_pages = [] # Click on the 'Telegram' link self.element_is_present_and_clickable(self.locators.LINK_TELEGRAM).click() @@ -434,6 +434,26 @@ def click_on_external_links_in_header(self): print(*opened_pages) return opened_pages + @allure.step("Click on the 'More' button for every user") + def click_more_button(self): + return self.element_is_present_and_clickable(self.locators.MORE_BUTTON).click() + + @allure.step("Click on the 'Telegram' link for unauthorized user") + def click_on_Telegram_link(self): + self.element_is_present_and_clickable(self.locators.LINK_TELEGRAM).click() + self.driver.switch_to.window(self.driver.window_handles[1]) + return self.get_current_tab_url() + + @allure.step("""Click on external links in the Header and thereby open corresponding web pages on new tabs + for unauthorized user""") + def click_on_unauth_external_links_in_header(self): + opened_pages = [] + # Click on the 'Telegram' link + opened_pages.append(self.click_on_Telegram_link()) # to be continued + + print(*opened_pages) + return opened_pages + @allure.step("Click on the 'Logo' link for every user") def click_on_logo_link(self): diff --git a/tests/header_test.py b/tests/header_test.py index 7468de4473..63002ce559 100644 --- a/tests/header_test.py +++ b/tests/header_test.py @@ -134,7 +134,7 @@ def test_hpu_03_02_verify_unauth_internal_links_lead_to_correct_pages(self, driv def test_hpu_03_03_verify_unauth_external_links_lead_to_correct_pages(self, driver, main_page_open): page = hPage(driver) external_links_in_more = page.get_list_of_external_links_in_more() - opened_pages = page.click_on_external_links_in_header() + opened_pages = page.click_on_unauth_external_links_in_header() assert external_links_in_more, "External links are not collected in the list" assert all(element in hPD.set_unauth for element in opened_pages), \ "Some of external links lead to incorrect pages after clicking" @@ -333,7 +333,7 @@ def test_hpa_03_02_1_verify_auth_direct_internal_links_navigation(self, driver, def test_hpa_03_03_verify_auth_external_links_lead_to_proper_pages(self, driver, auto_test_user_authorized): page = hPage(driver) external_links_in_more = page.get_list_of_external_links_in_more_auth() - opened_pages = page.click_on_external_links_in_header() + opened_pages = page.click_on_auth_external_links_in_header() assert external_links_in_more, "External links are not collected in the list" assert all(element in hPD.set_auth for element in opened_pages), \ "Some of external links lead to incorrect pages after clicking"