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
29 changes: 18 additions & 11 deletions pages/exercises_ru_similar_phrases_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,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")
Expand All @@ -31,7 +31,7 @@ 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)
# print(*tags)
return elements

@allure.step("Check if elements of the 2nd level of nesting are visible")
Expand All @@ -42,7 +42,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")
Expand All @@ -53,7 +53,7 @@ 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)
# print(*tags)
return elements

@allure.step("Check if elements of the 4th level of nesting are visible")
Expand All @@ -64,7 +64,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")
Expand All @@ -75,7 +75,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")
Expand All @@ -86,7 +86,7 @@ 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")
Expand All @@ -97,7 +97,7 @@ 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)
# print(*tags)
return elements

@allure.step("Check the list1 is visible")
Expand All @@ -108,7 +108,7 @@ 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)
# print(*tags)
return elements

@allure.step("Check the list2 is visible")
Expand All @@ -119,7 +119,7 @@ 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)
# print(*tags)
return elements

@allure.step("Check the list3 is visible")
Expand All @@ -130,9 +130,16 @@ 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)
# print(*tags)
return elements

@allure.step("Check the list4 is visible")
def check_list4_visibility(self):
return all(element.is_displayed() for element in self.get_list4_of_links())

# Checking text on the tab&page
@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
5 changes: 3 additions & 2 deletions pages/exercises_ru_words_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ 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")
Expand Down Expand Up @@ -262,9 +263,9 @@ def click_on_group_links(self):
group_links = self.get_list2_of_group_links()
for i in range(7):
group_links[i].click()
time.sleep(1)
time.sleep(2)
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 subgroup link 'Family' and thereby open corresponding web pages in the same tab")
Expand Down
2 changes: 1 addition & 1 deletion test_data/exercises_ru_similar_phrases_page_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


class ExercisesRuSimilarPhrasesPageData:
pass
tab_title_ru = "Речевые упражнения (готовы для занятий) | BrainUp"
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ 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)
time.sleep(3)


@pytest.fixture()
Expand Down
9 changes: 9 additions & 0 deletions tests/exercises_ru_similar_phrases_page_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Auto tests for verifying web elements on the 'Exercises "Similar phrases"' page on the 'ru' local"""
import allure
from pages.exercises_ru_similar_phrases_page import ExercisesRuSimilarPhrasesPage
from test_data.exercises_ru_similar_phrases_page_data import ExercisesRuSimilarPhrasesPageData as ExRuSimPhrPaData


@allure.epic("The Exercises 'Similar phrases' Page on the 'ru' local")
Expand Down Expand Up @@ -65,3 +66,11 @@ def test_ersp_01_03_verify_page_structural_elements(self, driver, exercises_ru_s
assert list3_visibility, "The list3 on the 5th level is invisible"
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 TestExRuSimPhrPageText:
@allure.title("Verify value of the title of the tab")
def test_ersp_02_01_verify_tab_title(self, driver, exercises_ru_similar_phrases_page_open):
page = ExercisesRuSimilarPhrasesPage(driver)
tab_title_value = page.get_value_of_tab_title()
assert tab_title_value, "The title value of the tab is empty"
assert tab_title_value == ExRuSimPhrPaData.tab_title_ru, "The tab title doesn't match the valid value"