From a145e5893ef2bc26a49cb04c93f6e8b12fb6185e Mon Sep 17 00:00:00 2001 From: Alena Krauch Date: Wed, 20 Nov 2024 23:04:31 +0300 Subject: [PATCH] ref test_erw_01.02, update exercises_ru_words_page_test.py, exercises_ru_words_page.py, exercises_ru_words_page_locators.py, contributors_page.py, footer_page.py, groups_page_test.py, groups_page.py, specialists_page.py, header_test.py, used_resources_page_test.py --- locators/exercises_ru_words_page_locators.py | 1 + pages/contributors_page.py | 4 +--- pages/exercises_ru_words_page.py | 11 +++++++++++ pages/footer_page.py | 2 +- pages/groups_page.py | 5 ----- pages/specialists_page.py | 2 +- tests/exercises_ru_words_page_test.py | 4 ++++ tests/groups_page_test.py | 1 - tests/header_test.py | 1 - tests/used_resources_page_test.py | 1 - 10 files changed, 19 insertions(+), 13 deletions(-) diff --git a/locators/exercises_ru_words_page_locators.py b/locators/exercises_ru_words_page_locators.py index 48f4facc31..fa97fe1e58 100644 --- a/locators/exercises_ru_words_page_locators.py +++ b/locators/exercises_ru_words_page_locators.py @@ -8,3 +8,4 @@ class ExercisesRuWordsPageLocators: PAGE_SECOND_LEVEL_ELEMENTS = (By.XPATH, "//main/*/*") PAGE_THIRD_LEVEL_ELEMENTS = (By.XPATH, "//main/*/*/*") PAGE_FOURTH_LEVEL_ELEMENTS = (By.XPATH, "//main/*/*/*/*") + PAGE_FIFTH_LEVEL_ELEMENTS = (By.XPATH, "//main/*/*/*/*/*") diff --git a/pages/contributors_page.py b/pages/contributors_page.py index 4a4b85fbec..3ad2c72657 100644 --- a/pages/contributors_page.py +++ b/pages/contributors_page.py @@ -136,7 +136,6 @@ def check_values_of_card_descriptions(self): full, empty = [], [] for i in range(len(values)): full.append(values[i]) if values[i] else empty.append(values[i]) - print(len(full), len(empty)) return len(full) + len(empty) @allure.step("Check text in links in cards") @@ -145,7 +144,6 @@ def check_text_in_card_links(self): full, empty = [], [] for i in range(len(values)): full.append(values[i]) if values[i] else empty.append(values[i]) - print(len(full), len(empty)) return len(full) + len(empty) @allure.step("Get text in the 'All Team' link") @@ -192,5 +190,5 @@ def check_size_changes_of_images(self): for i in range(len(images)): changed.append(i) if images_sizes_before[i] != images_sizes_after[i] else unchanged.append(i) lost.append(i) if images_sizes_after[i] == {'height': 0, 'width': 0} else None - print(f'\nChanged: {len(changed)}, Lost: {len(lost)}, Unchanged: {len(unchanged)}') + # print(f'\nChanged: {len(changed)}, Lost: {len(lost)}, Unchanged: {len(unchanged)}') return changed, lost, unchanged diff --git a/pages/exercises_ru_words_page.py b/pages/exercises_ru_words_page.py index cc8807f535..ce08169e19 100644 --- a/pages/exercises_ru_words_page.py +++ b/pages/exercises_ru_words_page.py @@ -59,3 +59,14 @@ def get_structure_of_4th_level(self): @allure.step("Check if elements of the 4th level of nesting are visible") def check_elements_visibility_on_4th_level(self): return all(element.is_displayed() for element in self.get_structure_of_4th_level()) + + @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] + print(tags) + return elements + + @allure.step("Check if elements of the 5th level of nesting are visible") + def check_elements_visibility_on_5th_level(self): + return all(element.is_displayed() for element in self.get_structure_of_5th_level()) diff --git a/pages/footer_page.py b/pages/footer_page.py index 3252f797e8..de5023fdbb 100644 --- a/pages/footer_page.py +++ b/pages/footer_page.py @@ -181,7 +181,7 @@ def click_on_links(self): except TimeoutException: print(f"The tab {i} has not been loaded during the allotted time") count3 += 1 - print(f'{new_tabs_urls}\nDefined tabs urls: {count1}\nUndefined tabs urls: {count2}\nUnloaded tabs: {count3}') + # print(f'{new_tabs_urls}\nDefined tabs urls: {count1}\nUndefined tabs urls: {count2}\nUnloaded tabs: {count3}') return new_tabs_urls @allure.step("Click on the 'Contact us' link in the Footer and thereby open an email client") diff --git a/pages/groups_page.py b/pages/groups_page.py index 5582a86229..eba7f472a2 100644 --- a/pages/groups_page.py +++ b/pages/groups_page.py @@ -204,15 +204,11 @@ def click_on_links_on_ru_local(self): self.element_is_present_and_clickable(self.locators.PAGE_LINK1).click() time.sleep(4) opened_pages.append(self.get_current_tab_url()) - # self.driver.back() self.element_is_present_and_clickable(self.locators1.LOGO_LINK).click() time.sleep(4) - # self.click_on_ru_button() - # time.sleep(2) self.element_is_present_and_clickable(self.locators.PAGE_LINK2).click() time.sleep(4) opened_pages.append(self.get_current_tab_url()) - print(opened_pages) return opened_pages @allure.step("Click on links on the 'en' local and thereby open corresponding web pages in the same tab") @@ -228,7 +224,6 @@ def click_on_links_on_en_local(self): self.element_is_present_and_clickable(self.locators.PAGE_LINK2).click() time.sleep(4) opened_pages.append(self.get_current_tab_url()) - print(opened_pages) return opened_pages # Checking images on the page diff --git a/pages/specialists_page.py b/pages/specialists_page.py index fc40d1a468..37deb8bfc2 100644 --- a/pages/specialists_page.py +++ b/pages/specialists_page.py @@ -260,5 +260,5 @@ def check_size_changes_of_images(self): for i in range(len(images)): changed.append(i) if images_sizes_before[i] != images_sizes_after[i] else unchanged.append(i) lost.append(i) if images_sizes_after[i] == {'height': 0, 'width': 0} else None - print(f'\nChanged: {len(changed)}, Lost: {len(lost)}, Unchanged: {len(unchanged)}') + # print(f'\nChanged: {len(changed)}, Lost: {len(lost)}, Unchanged: {len(unchanged)}') return changed, lost, unchanged diff --git a/tests/exercises_ru_words_page_test.py b/tests/exercises_ru_words_page_test.py index 2059f10104..73be994210 100644 --- a/tests/exercises_ru_words_page_test.py +++ b/tests/exercises_ru_words_page_test.py @@ -25,6 +25,8 @@ def test_erw_01_02_verify_page_structure_and_visibility(self, driver, exercises_ visibility_of_elements_on_3rd_level = page.check_elements_visibility_on_3rd_level() structure_of_4th_level = page.get_structure_of_4th_level() visibility_of_elements_on_4th_level = page.check_elements_visibility_on_4th_level() + structure_of_5th_level = page.get_structure_of_5th_level() + visibility_of_elements_on_5th_level = page.check_elements_visibility_on_5th_level() assert structure_of_1st_level, "The page is empty" assert visibility_of_elements_on_1st_level, "1th-level elements are invisible" assert structure_of_2nd_level, "Elements on the 2nd level are absent on the page" @@ -33,3 +35,5 @@ def test_erw_01_02_verify_page_structure_and_visibility(self, driver, exercises_ assert visibility_of_elements_on_3rd_level, "3rd-level elements are invisible" assert structure_of_4th_level, "Elements on the 4th level are absent on the page" assert visibility_of_elements_on_4th_level, "4th-level elements are invisible" + assert structure_of_5th_level, "Elements on the 5th level are absent on the page" + assert visibility_of_elements_on_5th_level, "5th-level elements are invisible" diff --git a/tests/groups_page_test.py b/tests/groups_page_test.py index f32984e18b..0d11266977 100644 --- a/tests/groups_page_test.py +++ b/tests/groups_page_test.py @@ -88,7 +88,6 @@ def test_gp_02_02_verify_page_title_and_subtitles(self, driver, auto_test_user_a subtitle_values_ru = page.get_values_of_subtitles_ru() title_value_en = page.get_value_of_page_title_en() subtitle_values_en = page.get_values_of_subtitles_en() - print(title_value_ru, subtitle_values_ru, title_value_en, subtitle_values_en, sep='\n') assert title_value_ru, "The title value on the page is empty on the 'ru' local" assert title_value_ru == GroupsPageData.page_title_ru, \ "The title on the page mismatches the valid value on the 'ru' local" diff --git a/tests/header_test.py b/tests/header_test.py index 062a356d9c..25ef0273c6 100644 --- a/tests/header_test.py +++ b/tests/header_test.py @@ -399,7 +399,6 @@ def test_hpa_04_03_verify_auth_icons(self, driver, auto_test_user_authorized): icons_presence = page.get_list_of_auth_icons() icons_visibility = page.check_auth_icons_visibility() icons_xmlns = page.get_auth_icons_xmlns() - print(icons_xmlns) assert icons_presence, "Icons in the Header are absent" assert icons_visibility, "Icons in the Header are invisible" assert icons_xmlns, "The 'xmlns' attribute value of icons in the Header are empty" diff --git a/tests/used_resources_page_test.py b/tests/used_resources_page_test.py index b770855370..103b76bb74 100644 --- a/tests/used_resources_page_test.py +++ b/tests/used_resources_page_test.py @@ -43,7 +43,6 @@ class TestUsedResourcesPageText: def test_ur_02_01_verify_tab_title(self, driver, used_resources_page_open): page = UsedResourcesPage(driver) tab_title_value = page.get_value_of_tab_title() - print(tab_title_value) assert tab_title_value, "The title value of the tab is empty" assert tab_title_value in UsedResourcesPageData.tab_title_expected, \ "The title value of the tab mismatches the valid value"