From d4535e2c81fb7f0c6f4c792e3fa87985b00e5227 Mon Sep 17 00:00:00 2001 From: Alena Krauch Date: Tue, 17 Jun 2025 20:44:05 +0300 Subject: [PATCH] update exercises_ru_words_page.py, conftest.py --- pages/exercises_ru_words_page.py | 12 ------------ tests/conftest.py | 23 ++++++++++++++++++++++- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/pages/exercises_ru_words_page.py b/pages/exercises_ru_words_page.py index 69e09046ca..3ab8476d22 100644 --- a/pages/exercises_ru_words_page.py +++ b/pages/exercises_ru_words_page.py @@ -23,7 +23,6 @@ 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) return elements @allure.step("Check if elements of the 1st level of nesting are visible") @@ -34,7 +33,6 @@ def check_elements_visibility_on_1st_level(self): 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] - # print(*tags) return elements @allure.step("Check if elements of the 2nd level of nesting are visible") @@ -45,7 +43,6 @@ 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) return elements @allure.step("Check if elements of the 3rd level of nesting are visible") @@ -56,7 +53,6 @@ def check_elements_visibility_on_3rd_level(self): 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] - # print(*tags) return elements @allure.step("Check if elements of the 4th level of nesting are visible") @@ -67,7 +63,6 @@ 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) return elements @allure.step("Check if elements of the 5th level of nesting are visible") @@ -78,7 +73,6 @@ 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) return elements @allure.step("Check if elements of the 6th level of nesting are visible") @@ -89,7 +83,6 @@ 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) return elements @allure.step("Check if elements of the 7th level of nesting are visible") @@ -100,7 +93,6 @@ def check_elements_visibility_on_7th_level(self): 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") @@ -111,7 +103,6 @@ def check_list1_visibility(self): def get_list2_of_group_links(self): elements = self.elements_are_present(self.locators.PAGE_LIST2) tags = [element.tag_name for element in elements] - # print(*tags) return elements @allure.step("Check the list2 is visible") @@ -122,7 +113,6 @@ def check_list2_visibility(self): def get_list3_of_subgroup_links(self): elements = self.elements_are_present(self.locators.PAGE_LIST3) tags = [element.tag_name for element in elements] - # print(*tags) return elements @allure.step("Check the list3 is visible") @@ -133,7 +123,6 @@ def check_list3_visibility(self): def get_list4_of_links(self): elements = self.elements_are_present(self.locators.CARD_IMAGES_LIST4) tags = [element.tag_name for element in elements] - # print(*tags) return elements @allure.step("Check the list4 is visible") @@ -144,7 +133,6 @@ def check_list4_visibility(self): @allure.step("Get value of the title of the tab") def get_value_of_tab_title(self): tab_title = self.get_current_tab_title() - print(tab_title) return tab_title @allure.step("Get value of the breadcrumbs on the page") diff --git a/tests/conftest.py b/tests/conftest.py index e7ac50d108..9a0ff88136 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -11,6 +11,7 @@ from locators.contacts_page_locators import ContactsPageLocators from locators.contributors_page_locators import ContributorsPageLocators from locators.exercises_ru_similar_phrases_page_locators import ExercisesRuSimilarPhrasesPageLocators as erspPL +from locators.exercises_ru_words_page_locators import ExercisesRuWordsPageLocators as erwPL from locators.groups_page_locators import GroupsPageLocators from locators.header_page_locators import HeaderUnauthorizedLocators as huLocators from locators.login_page_locators import LoginPageLocators @@ -100,11 +101,31 @@ def page_fully_loaded(driver): @pytest.fixture() @allure.step(f'Open page: {ExercisesUrls.URL_EXERCISES_RU_WORDS_PAGE}') -def exercises_ru_words_page_open(driver, groups_ru_page_open): +def exercises_ru_words_page_open1(driver, groups_ru_page_open): driver.get(ExercisesUrls.URL_EXERCISES_RU_WORDS_PAGE) time.sleep(3) +@pytest.fixture() +@allure.step(f'Open page: {ExercisesUrls.URL_EXERCISES_RU_WORDS_PAGE} on the "ru" local') +def exercises_ru_words_page_open(driver, groups_ru_page_open): + driver.get(ExercisesUrls.URL_EXERCISES_RU_WORDS_PAGE) + + def page_fully_loaded(driver): + ready_state = driver.execute_script("return document.readyState") + if ready_state != "complete": + return False + + try: + content = driver.find_element(*erwPL.PAGE_LIST3) + return content.is_displayed() + except NoSuchElementException: + return False + + Wait(driver, timeout=10).until(page_fully_loaded) + Wait(driver, 10).until(EC.presence_of_all_elements_located(erwPL.PAGE_LIST3)) + + @pytest.fixture() @allure.step(f'Open page: {MainPageLinks.URL_LOGIN_PAGE}') def login_page_open(driver, main_page_open):