Skip to content

Commit 78fd5cf

Browse files
ref test_erwf_01.02 Verify page structure and visibility
update exercises_ru_words_family_page_test.py, exercises_ru_words_family_page.py, exercises_ru_words_family_page_locators.py #623
1 parent fffea47 commit 78fd5cf

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

locators/exercises_ru_words_family_page_locators.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ class ExercisesRuWordsFamilyPageLocators:
66
PAGE_CONTENT = (By.TAG_NAME, "main")
77
PAGE_FIRST_LEVEL_ELEMENTS = (By.XPATH, "//main/*")
88
PAGE_SECOND_LEVEL_ELEMENTS = (By.XPATH, "//main/*/*")
9+
PAGE_THIRD_LEVEL_ELEMENTS = (By.XPATH, "//main/*/*/*")

pages/exercises_ru_words_family_page.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,15 @@ def check_elements_visibility_on_1st_level(self):
2727

2828
@allure.step("Get structure of the 2nd level of nesting on the page")
2929
def get_structure_of_2nd_level(self):
30-
elements = self.elements_are_present(self.locators.PAGE_SECOND_LEVEL_ELEMENTS)
31-
# tags = [element.tag_name for element in elements]
32-
# print(*tags, sep='\n')
33-
return elements
30+
return self.elements_are_present(self.locators.PAGE_SECOND_LEVEL_ELEMENTS)
3431

3532
@allure.step("Check if elements of the 2nd level of nesting are visible")
3633
def check_elements_visibility_on_2nd_level(self):
3734
return all(element.is_displayed() for element in self.get_structure_of_2nd_level())
35+
36+
@allure.step("Get structure of the 3rd level of nesting on the page")
37+
def get_structure_of_3rd_level(self):
38+
elements = self.elements_are_present(self.locators.PAGE_THIRD_LEVEL_ELEMENTS)
39+
tags = [element.tag_name for element in elements]
40+
print(*tags, sep='\n')
41+
return elements

tests/exercises_ru_words_family_page_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ def test_erwf_01_01_verify_page_presence_and_visibility(self, driver, exercises_
1515
assert page_content_presence, "The page content is absent in DOM"
1616
assert page_content_visibility, "The page content is invisible"
1717

18-
@allure.title("Verify composition, visibility of elements on the 1st-2nd levels of nesting on the page")
18+
@allure.title("Verify composition, visibility of elements on the 1st-3rd levels of nesting on the page")
1919
def test_erwf_01_02_verify_page_structure_and_visibility(self, driver, exercises_ru_words_family_page_open):
2020
page = erwfPage(driver)
2121
structure_of_1st_level = page.get_structure_of_1st_level()
2222
visibility_of_elements_on_1st_level = page.check_elements_visibility_on_1st_level()
2323
structure_of_2nd_level = page.get_structure_of_2nd_level()
2424
visibility_of_elements_on_2nd_level = page.check_elements_visibility_on_2nd_level()
25+
structure_of_3rd_level = page.get_structure_of_3rd_level()
2526
assert structure_of_1st_level, "The page is empty"
2627
assert visibility_of_elements_on_1st_level, "1th-level elements are invisible"
2728
assert structure_of_2nd_level, "Elements on the 2nd level are absent on the page"
2829
assert visibility_of_elements_on_2nd_level, "2nd-level elements are invisible"
30+
assert structure_of_3rd_level, "Elements on the 3rd level are absent on the page"

0 commit comments

Comments
 (0)