Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions locators/exercises_ru_similar_phrases_page_locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ class ExercisesRuSimilarPhrasesPageLocators:
PAGE_FOURTH_LEVEL_ELEMENTS = (By.XPATH, "//main/*/*/*/*")
PAGE_FIFTH_LEVEL_ELEMENTS = (By.XPATH, "//main/*/*/*/*/*")
PAGE_SIXTH_LEVEL_ELEMENTS = (By.XPATH, "//main/*/*/*/*/*/*")
PAGE_SEVENTH_LEVEL_ELEMENTS = (By.XPATH, "//main/*/*/*/*/*/*/*")
11 changes: 11 additions & 0 deletions pages/exercises_ru_similar_phrases_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,14 @@ def get_structure_of_6th_level(self):
@allure.step("Check if elements of the 6th level of nesting are visible")
def check_elements_visibility_on_6th_level(self):
return all(element.is_displayed() for element in self.get_structure_of_6th_level())

@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]
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())
2 changes: 1 addition & 1 deletion pages/exercises_ru_words_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def click_on_breadcrumbs_links(self):
self.element_is_present_and_clickable(self.locators.PAGE_LIST1_3).click()
time.sleep(1)
opened_pages.append(self.get_current_tab_url())
# print(*opened_pages, sep='\n')
print(*opened_pages, sep='\n')
return opened_pages

@allure.step("Click on group links and thereby open corresponding web pages in the same tab")
Expand Down
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,14 @@ def exercises_ru_page_open(driver, auto_test_user_authorized):
@allure.step(f'Open page: {ExercisesUrls.URL_EXERCISES_RU_SIMILAR_PHRASES_PAGE}')
def exercises_ru_similar_phrases_page_open(driver, exercises_ru_page_open):
driver.get(ExercisesUrls.URL_EXERCISES_RU_SIMILAR_PHRASES_PAGE)
time.sleep(1)


@pytest.fixture()
@allure.step(f'Open page: {ExercisesUrls.URL_EXERCISES_RU_WORDS_PAGE}')
def exercises_ru_words_page_open(driver, exercises_ru_page_open):
driver.get(ExercisesUrls.URL_EXERCISES_RU_WORDS_PAGE)
time.sleep(2)
time.sleep(3)


@pytest.fixture()
Expand Down
8 changes: 6 additions & 2 deletions tests/exercises_ru_similar_phrases_page_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@allure.epic("The Exercises 'Similar phrases' Page on the 'ru' local")
class TestExercisesRuSimilarPhrasesPage:
class TestExercisesRuSimilarPhrasesPageStructure:
class TestExRuSimPhrPageStructure:
@allure.title("Verify presence and visibility of content on the page")
def test_ersp_01_01_verify_page_presence_and_visibility(self, driver, exercises_ru_similar_phrases_page_open):
page = ExercisesRuSimilarPhrasesPage(driver)
Expand All @@ -14,7 +14,7 @@ def test_ersp_01_01_verify_page_presence_and_visibility(self, driver, exercises_
assert page_content_presence, "The page content is absent in DOM"
assert page_content_visibility, "The page content is invisible"

@allure.title("Verify composition, visibility of elements on the 1st-5th levels of nesting on the page")
@allure.title("Verify composition, visibility of elements on the 1st-7th levels of nesting on the page")
def test_ersp_01_02_verify_page_structure_and_visibility(self, driver, exercises_ru_similar_phrases_page_open):
page = ExercisesRuSimilarPhrasesPage(driver)
structure_of_1st_level = page.get_structure_of_1st_level()
Expand All @@ -29,6 +29,8 @@ def test_ersp_01_02_verify_page_structure_and_visibility(self, driver, exercises
visibility_of_elements_on_5th_level = page.check_elements_visibility_on_5th_level()
structure_of_6th_level = page.get_structure_of_6th_level()
visibility_of_elements_on_6th_level = page.check_elements_visibility_on_6th_level()
structure_of_7th_level = page.get_structure_of_7th_level()
visibility_of_elements_on_7th_level = page.check_elements_visibility_on_7th_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"
Expand All @@ -41,3 +43,5 @@ def test_ersp_01_02_verify_page_structure_and_visibility(self, driver, exercises
assert visibility_of_elements_on_5th_level, "5th-level elements are invisible"
assert structure_of_6th_level, "Elements on the 6th level are absent on the page"
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"
8 changes: 4 additions & 4 deletions tests/exercises_ru_words_page_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

@allure.epic("The Exercises 'Words' Page on the 'ru' local")
class TestExercisesRuWordsPage:
class TestExercisesRuWordsPageStructure:
class TestExRuWordsPageStructure:
@allure.title("Verify presence and visibility of content on the page")
def test_erw_01_01_verify_page_presence_and_visibility(self, driver, exercises_ru_words_page_open):
page = ExercisesRuWordsPage(driver)
Expand Down Expand Up @@ -67,7 +67,7 @@ def test_erw_01_03_verify_page_structural_elements(self, driver, exercises_ru_wo
assert list4_on_6th_level, "The list4 on the 6th level is absent on the page"
assert list4_visibility, "The list4 on the 6th level is invisible"

class TestExercisesRuWordsPageText:
class TestExRuWordsPageText:
@allure.title("Verify value of the title of the tab")
def test_erw_02_01_verify_tab_title(self, driver, exercises_ru_words_page_open):
page = ExercisesRuWordsPage(driver)
Expand Down Expand Up @@ -99,7 +99,7 @@ def test_erw_02_04_verify_subgroup_links_text(self, driver, exercises_ru_words_p
assert all(text in ExRuWoPaData.subgroup_links_text for text in subgroup_links_text), \
"Text in subgroup links mismatches valid values"

class TestExercisesRuWordsPageLinks:
class TestExRuWordsPageLinks:
@allure.title("Verify clickability, href, status code of links in breadcrumbs on the page")
def test_erw_03_01_verify_breadcrumbs_links(self, driver, exercises_ru_words_page_open):
page = ExercisesRuWordsPage(driver)
Expand Down Expand Up @@ -170,7 +170,7 @@ def test_erw_03_06_verify_subgroup_links_lead_to_correct_pages(self, driver, exe
assert all(page in ExRuWoPaData.subgroup_link_urls for page in opened_pages2_4), \
"Some subgroup links lead to incorrect pages after clicking"

class TestExercisesRuWordsPageImages:
class TestExRuWordsPageImages:
@allure.title("Verify attributes of images in links on the page")
def test_erw_04_01_verify_images_attributes(self, driver, exercises_ru_words_page_open):
page = ExercisesRuWordsPage(driver)
Expand Down
Loading