Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions locators/exercises_ru_words_page_locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ class ExercisesRuWordsPageLocators:
PAGE_SIXTH_LEVEL_ELEMENTS = (By.XPATH, "//main/*/*/*/*/*/*")
PAGE_SEVENTH_LEVEL_ELEMENTS = (By.XPATH, "//main/*/*/*/*/*/*/*")
PAGE_LIST1 = (By.XPATH, '//ul[@aria-label="Breadcrumbs"]//a')
PAGE_LIST1_1 = (By.XPATH, '(//ul[@aria-label="Breadcrumbs"]//a)[1]')
PAGE_LIST1_2 = (By.XPATH, '(//ul[@aria-label="Breadcrumbs"]//a)[2]')
PAGE_LIST1_3 = (By.XPATH, '(//ul[@aria-label="Breadcrumbs"]//a)[3]')
PAGE_LIST2 = (By.XPATH, "//aside//button")
PAGE_LIST3 = (By.XPATH, '//div[contains(@class, "series-page")]//a')
# PAGE_LIST3 = (By.XPATH, "//main//div/a")
Expand Down
18 changes: 18 additions & 0 deletions pages/exercises_ru_words_page.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Methods for verifying web elements on the 'Exercises "Words"' page on the 'ru' local"""
import time
import allure
import requests
from pages.base_page import BasePage
Expand Down Expand Up @@ -206,3 +207,20 @@ def get_subgroup_links_href(self):
@allure.step("Get status code of subgroup links")
def get_subgroup_link_status_codes(self):
return [requests.head(link_href).status_code for link_href in self.get_subgroup_links_href()]

@allure.step("Click on breadcrumbs links and thereby open corresponding web pages in the same tab")
def click_on_breadcrumbs_links(self):
opened_pages = []
self.element_is_present_and_clickable(self.locators.PAGE_LIST1_1).click()
time.sleep(1)
opened_pages.append(self.get_current_tab_url())
self.driver.back()
self.element_is_present_and_clickable(self.locators.PAGE_LIST1_2).click()
opened_pages.append(self.get_current_tab_url())
self.driver.back()
self.element_is_present_and_clickable(self.locators.PAGE_LIST1_3).click()
opened_pages.append(self.get_current_tab_url())
print(*opened_pages, sep='\n')
return opened_pages


6 changes: 6 additions & 0 deletions tests/exercises_ru_words_page_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,9 @@ def test_erw_03_03_verify_subgroup_links(self, driver, exercises_ru_words_page_o
"Attributes 'href' of subgroup links mismatch valid values"
assert all(element == ExRuWoPaData.links_status_code for element in subgroup_links_status_codes), \
"Status codes of subgroup links mismatch valid values"

@allure.title("Verify if breadcrumbs links lead to correct pages after clicking")
def test_erw_03_04_verify_breadcrumbs_links_lead_to_correct_pages(self, driver, exercises_ru_words_page_open):
page = ExercisesRuWordsPage(driver)
opened_pages = page.click_on_breadcrumbs_links()
assert opened_pages, "Transitions to pages have not performed"
Loading