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_words_page_locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
class ExercisesRuWordsPageLocators:
PAGE_CONTENT = (By.TAG_NAME, "main")
PAGE_FIRST_LEVEL_ELEMENTS = (By.XPATH, "//main/*")
PAGE_SECOND_LEVEL_ELEMENTS = (By.XPATH, "//main/*/*")
1 change: 1 addition & 0 deletions locators/groups_page_locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ class GroupsPageLocators:
class HeaderLocators:
EN_BUTTON = (By.XPATH, "(//span/button)[2]")
RU_BUTTON = (By.XPATH, "(//span/button)[1]")
LOGO_LINK = (By.XPATH, "//a[@data-test-logo]")
11 changes: 11 additions & 0 deletions pages/exercises_ru_words_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,14 @@ def get_structure_of_1st_level(self):
@allure.step("Check if elements of the 1st level of nesting are visible")
def check_elements_visibility_on_1st_level(self):
return all(element.is_displayed() for element in self.get_structure_of_1st_level())

@allure.step("Get structure of the 2nd level of nesting on the page")
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")
def check_elements_visibility_on_2nd_level(self):
return all(element.is_displayed() for element in self.get_structure_of_2nd_level())
20 changes: 11 additions & 9 deletions pages/groups_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ def get_values_of_subtitles_en(self):
@allure.step("Click on the 'ru' button in the Header for every user")
def click_on_ru_button(self):
self.element_is_present_and_clickable(self.locators1.RU_BUTTON).click()
time.sleep(2)
time.sleep(4)

@allure.step("Click on the 'en' button in the Header for every user")
def click_on_en_button(self):
self.element_is_present_and_clickable(self.locators1.EN_BUTTON).click()
time.sleep(2)
time.sleep(4)

@allure.step("Get the list of links on the 3rd level of nesting on the page")
def get_list_of_links(self):
Expand Down Expand Up @@ -198,16 +198,18 @@ def get_links_status_codes(self):
@allure.step("Click on links on the 'ru' local and thereby open corresponding web pages in the same tab")
def click_on_links_on_ru_local(self):
self.click_on_ru_button()
time.sleep(1)
time.sleep(2)
opened_pages = []
self.element_is_present_and_clickable(self.locators.PAGE_LINK1).click()
time.sleep(3)
time.sleep(4)
opened_pages.append(self.get_current_tab_url())
self.driver.back()
time.sleep(3)
self.click_on_ru_button()
# 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(3)
time.sleep(4)
opened_pages.append(self.get_current_tab_url())
print(opened_pages)
return opened_pages
Expand All @@ -223,7 +225,7 @@ def click_on_links_on_en_local(self):
self.driver.back()
time.sleep(3)
self.element_is_present_and_clickable(self.locators.PAGE_LINK2).click()
time.sleep(3)
time.sleep(4)
opened_pages.append(self.get_current_tab_url())
print(opened_pages)
return opened_pages
Expand Down
6 changes: 5 additions & 1 deletion tests/exercises_ru_words_page_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ def test_erw_01_01_verify_page_presence_and_visibility(self, driver, exercises_r
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 level of nesting on the page")
@allure.title("Verify composition, visibility of elements on the 1st-2nd levels of nesting on the page")
def test_erw_01_02_verify_page_structure_and_visibility(self, driver, exercises_ru_words_page_open):
page = ExercisesRuWordsPage(driver)
structure_of_1st_level = page.get_structure_of_1st_level()
visibility_of_elements_on_1st_level = page.check_elements_visibility_on_1st_level()
structure_of_2nd_level = page.get_structure_of_2nd_level()
visibility_of_elements_on_2nd_level = page.check_elements_visibility_on_2nd_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"
assert visibility_of_elements_on_2nd_level, "2nd-level elements are invisible"
13 changes: 7 additions & 6 deletions tests/groups_page_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,19 @@ def test_gp_02_01_verify_tab_title(self, driver, auto_test_user_authorized):
def test_gp_02_02_verify_page_title_and_subtitles(self, driver, auto_test_user_authorized):
page = GroupsPage(driver)
title_value_ru = page.get_value_of_page_title_ru()
title_value_en = page.get_value_of_page_title_en()
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"
assert title_value_en, "The title value on the page is empty on the 'en' local"
assert title_value_en == GroupsPageData.page_title_en, \
"The title on the page mismatches the valid value on the 'en' local"
assert subtitle_values_ru, "Subtitle values are empty on the 'ru' local"
assert all(subtitle_value in GroupsPageData.page_subtitles_ru for subtitle_value in subtitle_values_ru), \
"Subtitles mismatch any valid values on the 'ru' local"
assert title_value_en, "The title value on the page is empty on the 'en' local"
assert title_value_en == GroupsPageData.page_title_en, \
"The title on the page mismatches the valid value on the 'en' local"
assert subtitle_values_en, "Subtitle values are empty on the 'en' local"
assert all(subtitle_value in GroupsPageData.page_subtitles_en for subtitle_value in subtitle_values_en), \
"Subtitles mismatch any valid values on the 'en' local"
Expand Down Expand Up @@ -133,15 +134,15 @@ def test_gp_03_02_verify_ru_links_lead_to_proper_pages(self, driver, auto_test_u
opened_pages = page.click_on_links_on_ru_local()
assert opened_pages, "Transitions to exercises pages have not performed"
assert all(page in GroupsPageData.pages_urls for page in opened_pages), \
"Some of links lead to incorrect pages after clicking"
"Some links lead to incorrect pages after clicking"

@allure.title("""Verify if links on the 'en' local lead to correct pages after clicking""")
def test_gp_03_03_verify_en_links_lead_to_proper_pages(self, driver, auto_test_user_authorized):
page = GroupsPage(driver)
opened_pages = page.click_on_links_on_en_local()
assert opened_pages, "Transitions to exercises pages have not performed"
assert all(page in GroupsPageData.pages_urls for page in opened_pages), \
"Some of links lead to incorrect pages after clicking"
"Some links lead to incorrect pages after clicking"

class TestGroupsPageImages:
@allure.title("Verify attributes of images in links on the page")
Expand Down