diff --git a/locators/exercises_ru_words_page_locators.py b/locators/exercises_ru_words_page_locators.py index 104f1c26d1..e258c2bcd4 100644 --- a/locators/exercises_ru_words_page_locators.py +++ b/locators/exercises_ru_words_page_locators.py @@ -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: diff --git a/pages/exercises_ru_words_page.py b/pages/exercises_ru_words_page.py index 6768e52022..136f4c7930 100644 --- a/pages/exercises_ru_words_page.py +++ b/pages/exercises_ru_words_page.py @@ -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") @@ -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") @@ -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") @@ -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") @@ -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] @@ -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): diff --git a/tests/conftest.py b/tests/conftest.py index 8226e4d4be..ae283744c0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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): diff --git a/tests/exercises_ru_words_page_test.py b/tests/exercises_ru_words_page_test.py index 8829d5b20c..fab3e32be7 100644 --- a/tests/exercises_ru_words_page_test.py +++ b/tests/exercises_ru_words_page_test.py @@ -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")