diff --git a/locators/exercises_ru_similar_phrases_page_locators.py b/locators/exercises_ru_similar_phrases_page_locators.py index dd9f45def7..acabdba578 100644 --- a/locators/exercises_ru_similar_phrases_page_locators.py +++ b/locators/exercises_ru_similar_phrases_page_locators.py @@ -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') diff --git a/pages/exercises_ru_similar_phrases_page.py b/pages/exercises_ru_similar_phrases_page.py index 8ae2139dc1..f13e7b5785 100644 --- a/pages/exercises_ru_similar_phrases_page.py +++ b/pages/exercises_ru_similar_phrases_page.py @@ -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) diff --git a/pages/exercises_ru_words_page.py b/pages/exercises_ru_words_page.py index fc028181fb..c4fab2232b 100644 --- a/pages/exercises_ru_words_page.py +++ b/pages/exercises_ru_words_page.py @@ -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") @@ -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") @@ -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") @@ -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") @@ -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") @@ -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") @@ -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") @@ -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") @@ -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") diff --git a/tests/exercises_ru_similar_phrases_page_test.py b/tests/exercises_ru_similar_phrases_page_test.py index f319dda9fa..fdbb7e17c5 100644 --- a/tests/exercises_ru_similar_phrases_page_test.py +++ b/tests/exercises_ru_similar_phrases_page_test.py @@ -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" diff --git a/tests/exercises_ru_words_page_test.py b/tests/exercises_ru_words_page_test.py index 4d9a48b671..c96b037d10 100644 --- a/tests/exercises_ru_words_page_test.py +++ b/tests/exercises_ru_words_page_test.py @@ -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"