Skip to content

Commit 3e05266

Browse files
Merge pull request #700 from Brain-up/issue_268
Issue_268_HEADER_links
2 parents 4a8ddd5 + 846c6f1 commit 3e05266

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

pages/header_page.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,8 @@ def click_on_direct_internal_links_in_header_auth(self):
415415
return opened_pages
416416

417417
@allure.step("""Click on external links in the Header and thereby open corresponding web pages on new tabs
418-
for every user""")
419-
def click_on_external_links_in_header(self):
418+
for authorized user""")
419+
def click_on_auth_external_links_in_header(self):
420420
opened_pages = []
421421
# Click on the 'Telegram' link
422422
self.element_is_present_and_clickable(self.locators.LINK_TELEGRAM).click()
@@ -434,6 +434,26 @@ def click_on_external_links_in_header(self):
434434
print(*opened_pages)
435435
return opened_pages
436436

437+
@allure.step("Click on the 'More' button for every user")
438+
def click_more_button(self):
439+
return self.element_is_present_and_clickable(self.locators.MORE_BUTTON).click()
440+
441+
@allure.step("Click on the 'Telegram' link for unauthorized user")
442+
def click_on_Telegram_link(self):
443+
self.element_is_present_and_clickable(self.locators.LINK_TELEGRAM).click()
444+
self.driver.switch_to.window(self.driver.window_handles[1])
445+
return self.get_current_tab_url()
446+
447+
@allure.step("""Click on external links in the Header and thereby open corresponding web pages on new tabs
448+
for unauthorized user""")
449+
def click_on_unauth_external_links_in_header(self):
450+
opened_pages = []
451+
# Click on the 'Telegram' link
452+
opened_pages.append(self.click_on_Telegram_link()) # to be continued
453+
454+
print(*opened_pages)
455+
return opened_pages
456+
437457
@allure.step("Click on the 'Logo' link for every user")
438458
def click_on_logo_link(self):
439459

tests/header_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def test_hpu_03_02_verify_unauth_internal_links_lead_to_correct_pages(self, driv
134134
def test_hpu_03_03_verify_unauth_external_links_lead_to_correct_pages(self, driver, main_page_open):
135135
page = hPage(driver)
136136
external_links_in_more = page.get_list_of_external_links_in_more()
137-
opened_pages = page.click_on_external_links_in_header()
137+
opened_pages = page.click_on_unauth_external_links_in_header()
138138
assert external_links_in_more, "External links are not collected in the list"
139139
assert all(element in hPD.set_unauth for element in opened_pages), \
140140
"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,
333333
def test_hpa_03_03_verify_auth_external_links_lead_to_proper_pages(self, driver, auto_test_user_authorized):
334334
page = hPage(driver)
335335
external_links_in_more = page.get_list_of_external_links_in_more_auth()
336-
opened_pages = page.click_on_external_links_in_header()
336+
opened_pages = page.click_on_auth_external_links_in_header()
337337
assert external_links_in_more, "External links are not collected in the list"
338338
assert all(element in hPD.set_auth for element in opened_pages), \
339339
"Some of external links lead to incorrect pages after clicking"

0 commit comments

Comments
 (0)