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
1 change: 1 addition & 0 deletions locators/exercises_ru_similar_phrases_page_locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ class ExercisesRuSimilarPhrasesPageLocators:
PAGE_FIFTH_LEVEL_ELEMENTS = (By.XPATH, "//main/*/*/*/*/*")
PAGE_SIXTH_LEVEL_ELEMENTS = (By.XPATH, "//main/*/*/*/*/*/*")
PAGE_SEVENTH_LEVEL_ELEMENTS = (By.XPATH, "//main/*/*/*/*/*/*/*")
PAGE_LIST1 = (By.XPATH, '//ul[@aria-label="Breadcrumbs"]//a')
11 changes: 11 additions & 0 deletions pages/exercises_ru_similar_phrases_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,14 @@ def get_structure_of_7th_level(self):
@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 5th level of nesting is present on the page")
def get_list1_of_breadcrumbs_links(self):
elements = self.elements_are_present(self.locators.PAGE_LIST1)
tags = [element.tag_name for element in elements]
print(*tags)
return elements

@allure.step("Check the list1 is visible")
def check_list1_visibility(self):
return self.element_is_visible(self.locators.PAGE_LIST1)
37 changes: 24 additions & 13 deletions pages/exercises_ru_words_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def check_visibility_of_page_content(self):
@allure.step("Get structure of the 1st level of nesting on the page")
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]
tags = [element.tag_name for element in elements]
# print(*tags)
return elements

@allure.step("Check if elements of the 1st level of nesting are visible")
Expand All @@ -32,7 +33,8 @@ def check_elements_visibility_on_1st_level(self):
@allure.step("Get structure of the 2nd level of nesting on the page")
def get_structure_of_2nd_level(self):
elements = self.elements_are_present(self.locators.PAGE_SECOND_LEVEL_ELEMENTS)
# tags = [element.tag_name for element in elements] #
tags = [element.tag_name for element in elements]
# print(*tags)
return elements

@allure.step("Check if elements of the 2nd level of nesting are visible")
Expand All @@ -42,7 +44,8 @@ def check_elements_visibility_on_2nd_level(self):
@allure.step("Get structure of the 3rd level of nesting on the page")
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]
tags = [element.tag_name for element in elements]
# print(*tags)
return elements

@allure.step("Check if elements of the 3rd level of nesting are visible")
Expand All @@ -52,7 +55,8 @@ def check_elements_visibility_on_3rd_level(self):
@allure.step("Get structure of the 4th level of nesting on the page")
def get_structure_of_4th_level(self):
elements = self.elements_are_present(self.locators.PAGE_FOURTH_LEVEL_ELEMENTS)
# tags = [element.tag_name for element in elements]
tags = [element.tag_name for element in elements]
# print(*tags)
return elements

@allure.step("Check if elements of the 4th level of nesting are visible")
Expand All @@ -62,7 +66,8 @@ def check_elements_visibility_on_4th_level(self):
@allure.step("Get structure of the 5th level of nesting on the page")
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]
tags = [element.tag_name for element in elements]
# print(*tags)
return elements

@allure.step("Check if elements of the 5th level of nesting are visible")
Expand All @@ -72,7 +77,8 @@ def check_elements_visibility_on_5th_level(self):
@allure.step("Get structure of the 6th level of nesting on the page")
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]
tags = [element.tag_name for element in elements]
# print(*tags)
return elements

@allure.step("Check if elements of the 6th level of nesting are visible")
Expand All @@ -82,27 +88,30 @@ def check_elements_visibility_on_6th_level(self):
@allure.step("Get structure of the 7th level of nesting on the page")
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]
tags = [element.tag_name for element in elements]
# 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 4th level of nesting is present on the page")
@allure.step("Check the list1 on the 5th level of nesting is present on the page")
def get_list1_of_breadcrumbs_links(self):
elements = self.elements_are_present(self.locators.PAGE_LIST1)
# tags = [element.tag_name for element in elements]
tags = [element.tag_name for element in elements]
# print(*tags)
return elements

@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 4th level of nesting is present on the page")
@allure.step("Check the list2 on the 5th level of nesting is present on the page")
def get_list2_of_group_links(self):
elements = self.elements_are_present(self.locators.PAGE_LIST2)
# tags = [element.tag_name for element in elements]
tags = [element.tag_name for element in elements]
# print(*tags)
return elements

@allure.step("Check the list2 is visible")
Expand All @@ -112,7 +121,8 @@ def check_list2_visibility(self):
@allure.step("Check the list3 on the 5th level of nesting is present on the page")
def get_list3_of_subgroup_links(self):
elements = self.elements_are_present(self.locators.PAGE_LIST3)
# tags = [element.tag_name for element in elements]
tags = [element.tag_name for element in elements]
# print(*tags)
return elements

@allure.step("Check the list3 is visible")
Expand All @@ -122,7 +132,8 @@ def check_list3_visibility(self):
@allure.step("Check the list4 on the 6th level of nesting is present on the page")
def get_list4_of_links(self):
elements = self.elements_are_present(self.locators.CARD_IMAGES_LIST4)
# tags = [element.tag_name for element in elements]
tags = [element.tag_name for element in elements]
# print(*tags)
return elements

@allure.step("Check the list4 is visible")
Expand Down
8 changes: 8 additions & 0 deletions tests/exercises_ru_similar_phrases_page_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,11 @@ def test_ersp_01_02_verify_page_structure_and_visibility(self, driver, exercises
assert visibility_of_elements_on_6th_level, "6th-level elements are invisible"
assert structure_of_7th_level, "Elements on the 7th level are absent on the page"
assert visibility_of_elements_on_7th_level, "7th-level elements are invisible"

@allure.title("Verify presence, visibility of lists on the page")
def test_erw_01_03_verify_page_structural_elements(self, driver, exercises_ru_similar_phrases_page_open):
page = ExercisesRuSimilarPhrasesPage(driver)
list1_on_5th_level = page.get_list1_of_breadcrumbs_links()
list1_visibility = page.check_list1_visibility()
assert list1_on_5th_level, "The list1 on the 5th level is absent on the page"
assert list1_visibility, "The list1 on the 5th level is invisible"
12 changes: 6 additions & 6 deletions tests/exercises_ru_words_page_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,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_4th_level = page.get_list1_of_breadcrumbs_links()
list1_on_5th_level = page.get_list1_of_breadcrumbs_links()
list1_visibility = page.check_list1_visibility()
list2_on_4th_level = page.get_list2_of_group_links()
list2_on_5th_level = page.get_list2_of_group_links()
list2_visibility = page.check_list2_visibility()
list3_on_5th_level = page.get_list3_of_subgroup_links()
list3_visibility = page.check_list3_visibility()
list4_on_6th_level = page.get_list4_of_links()
list4_visibility = page.check_list4_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 list1_on_5th_level, "The list1 on the 5th level is absent on the page"
assert list1_visibility, "The list1 on the 5th 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"
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"
assert list4_on_6th_level, "The list4 on the 6th level is absent on the page"
Expand Down
Loading