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
7 changes: 5 additions & 2 deletions locators/exercises_ru_words_page_locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ class ExercisesRuWordsPageLocators:
PAGE_FIFTH_LEVEL_ELEMENTS = (By.XPATH, "//main/*/*/*/*/*")
PAGE_SIXTH_LEVEL_ELEMENTS = (By.XPATH, "//main/*/*/*/*/*/*")
PAGE_SEVENTH_LEVEL_ELEMENTS = (By.XPATH, "//main/*/*/*/*/*/*/*")
PAGE_LIST1 = (By.TAG_NAME, "ul")
PAGE_LIST2 = (By.XPATH, "//main//div/a")
PAGE_LIST1 = (By.XPATH, '//ul[@aria-label="Breadcrumbs"]/li')
# PAGE_LIST1 = (By.XPATH, "//main//div/li")
PAGE_LIST2 = (By.XPATH, "//aside//li")
PAGE_LIST3 = (By.XPATH, '//div[contains(@class, "series-page")]//a')
# PAGE_LIST3 = (By.XPATH, "//main//div/a")


class HeaderLocators:
Expand Down
38 changes: 28 additions & 10 deletions pages/exercises_ru_words_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def check_visibility_of_page_content(self):
def get_structure_of_1st_level(self):
elements = self.elements_are_present(self.locators.PAGE_FIRST_LEVEL_ELEMENTS)
tags = [element.tag_name for element in elements]
# print(tags)
print(tags)
return elements

@allure.step("Check if elements of the 1st level of nesting are visible")
Expand All @@ -44,7 +44,7 @@ def check_elements_visibility_on_2nd_level(self):
def get_structure_of_3rd_level(self):
elements = self.elements_are_present(self.locators.PAGE_THIRD_LEVEL_ELEMENTS)
tags = [element.tag_name for element in elements]
# print(tags)
print(tags)
return elements

@allure.step("Check if elements of the 3rd level of nesting are visible")
Expand All @@ -66,7 +66,7 @@ def check_elements_visibility_on_4th_level(self):
def get_structure_of_5th_level(self):
elements = self.elements_are_present(self.locators.PAGE_FIFTH_LEVEL_ELEMENTS)
tags = [element.tag_name for element in elements]
# print(tags)
print(tags)
return elements

@allure.step("Check if elements of the 5th level of nesting are visible")
Expand All @@ -77,7 +77,7 @@ def check_elements_visibility_on_5th_level(self):
def get_structure_of_6th_level(self):
elements = self.elements_are_present(self.locators.PAGE_SIXTH_LEVEL_ELEMENTS)
tags = [element.tag_name for element in elements]
# print(tags)
print(tags)
return elements

@allure.step("Check if elements of the 6th level of nesting are visible")
Expand All @@ -88,22 +88,27 @@ def check_elements_visibility_on_6th_level(self):
def get_structure_of_7th_level(self):
elements = self.elements_are_present(self.locators.PAGE_SEVENTH_LEVEL_ELEMENTS)
tags = [element.tag_name for element in elements]
# print(tags)
print(tags)
return elements

@allure.step("Check if elements of the 7th level of nesting are visible")
def check_elements_visibility_on_7th_level(self):
return all(element.is_displayed() for element in self.get_structure_of_7th_level())

@allure.step("Check the list1 on the 3rd level of nesting is present on the page")
@allure.step("Check the list1 on the 4th level of nesting is present on the page")
def check_list1_presence(self):
return self.element_is_present(self.locators.PAGE_LIST1)
elements = self.elements_are_present(self.locators.PAGE_LIST1)
# tags = [element.tag_name for element in elements]
tags = [element.text for element in elements]
print(tags)
print(len(tags))
return elements

@allure.step("Check the list1 on the 3rd level level of nesting is visible")
@allure.step("Check the list1 is visible")
def check_list1_visibility(self):
return self.element_is_visible(self.locators.PAGE_LIST1)

@allure.step("Check the list2 on the 5th level of nesting is present on the page")
@allure.step("Check the list2 on the 4th level of nesting is present on the page")
def check_list2_presence(self):
elements = self.elements_are_present(self.locators.PAGE_LIST2)
# tags = [element.tag_name for element in elements]
Expand All @@ -112,10 +117,23 @@ def check_list2_presence(self):
print(len(tags))
return elements

@allure.step("Check the list2 on the 5th level level of nesting is visible")
@allure.step("Check the list2 is visible")
def check_list2_visibility(self):
return self.element_is_visible(self.locators.PAGE_LIST2)

@allure.step("Check the list3 on the 5th level of nesting is present on the page")
def check_list3_presence(self):
elements = self.elements_are_present(self.locators.PAGE_LIST3)
# tags = [element.tag_name for element in elements]
tags = [element.text for element in elements]
print(tags)
print(len(tags))
return elements

@allure.step("Check the list3 is visible")
def check_list3_visibility(self):
return self.element_is_visible(self.locators.PAGE_LIST3)

# Checking text on the tab&page
@allure.step("Get value of the title of the tab")
def get_value_of_tab_title(self):
Expand Down
8 changes: 0 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@ def description_page_open(driver):
driver.get(MainPageLinks.URL_DESCRIPTION_PAGE)


@pytest.fixture()
@allure.step(f'Open page: {ExercisesUrls.URL_EXERCISES_RU_WORDS_PAGE}')
def exercises_ru_words_page_open1(driver, auto_test_user_authorized):
page = BasePage(driver)
page.element_is_present_and_clickable(HeaderUnauthorizedLocators.RU_BUTTON).click()
page.element_is_present_and_clickable(GroupsPageLocators.PAGE_LINK2).click()
time.sleep(3)

@pytest.fixture()
@allure.step(f'Open page: {ExercisesUrls.URL_EXERCISES_RU_WORDS_PAGE}')
def exercises_ru_words_page_open(driver, main_page_open):
Expand Down
16 changes: 10 additions & 6 deletions tests/exercises_ru_words_page_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,18 @@ def test_erw_01_02_verify_page_structure_and_visibility(self, driver, exercises_
@allure.title("Verify presence, visibility of lists on the page")
def test_erw_01_03_verify_page_structural_elements(self, driver, exercises_ru_words_page_open):
page = ExercisesRuWordsPage(driver)
list1_on_3rd_level = page.check_list1_presence()
list1_on_4th_level = page.check_list1_presence()
list1_visibility = page.check_list1_visibility()
list2_on_5th_level = page.check_list2_presence()
list2_on_4th_level = page.check_list2_presence()
list2_visibility = page.check_list2_visibility()
assert list1_on_3rd_level, "The list1 on the 3rd level is absent on the page"
assert list1_visibility, "The list1 on the 3rd level is invisible"
assert list2_on_5th_level, "The list2 on the 5th level is absent on the page"
assert list2_visibility, "The list2 on the 5th level is invisible"
list3_on_5th_level = page.check_list3_presence()
list3_visibility = page.check_list3_visibility()
assert list1_on_4th_level, "The list1 on the 4th level is absent on the page"
assert list1_visibility, "The list1 on the 4th level is invisible"
assert list2_on_4th_level, "The list2 on the 4th level is absent on the page"
assert list2_visibility, "The list2 on the 4th level is invisible"
assert list3_on_5th_level, "The list3 on the 5th level is absent on the page"
assert list3_visibility, "The list3 on the 5th level is invisible"

class TestGroupsPageText:
@allure.title("Verify value of the title of the tab")
Expand Down
Loading