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
21 changes: 0 additions & 21 deletions pages/groups_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,11 @@
from locators.groups_page_locators import GroupsPageLocators, HeaderLocators
from test_data.links import MainPageLinks as Links

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec


class GroupsPage(BasePage):
locators = GroupsPageLocators
locators1 = HeaderLocators

@allure.step("Loader checking")
def loader_checking(self):
self.timeout = 50
return WebDriverWait(self.driver, self.timeout).until(
ec.visibility_of_element_located(self.locators.PAGE_SUBTITLES))

# Checking the structure and display of elements on the page
@allure.step("Check if some content is present in DOM")
def check_presence_of_page_content(self):
Expand Down Expand Up @@ -76,17 +67,13 @@ def check_elements_visibility_on_5th_level(self):

@allure.step("Get structure of the 6th level of nesting on the page")
def get_structure_of_6th_level(self):
WebDriverWait(self.driver, 30).until(
ec.presence_of_all_elements_located(self.locators.PAGE_SIXTH_LEVEL_ELEMENTS))
elements = self.elements_are_present(self.locators.PAGE_SIXTH_LEVEL_ELEMENTS)
# tags = [element.tag_name for element in elements]
return elements

@allure.step("Check if elements of the 6th level of nesting are visible")
def check_elements_visibility_on_6th_level(self):
elements = self.get_structure_of_6th_level()
for element in elements:
WebDriverWait(self.driver, 10).until(ec.visibility_of(element))
return all(element.is_displayed() for element in elements)

@allure.step("Check the title h3 on the 2nd level of nesting is present on the page")
Expand All @@ -107,16 +94,12 @@ def check_visibility_of_tiles(self):

@allure.step("Get the list of images on the 6th level of nesting on the page")
def get_list_of_images(self):
WebDriverWait(self.driver, 30).until(
ec.presence_of_all_elements_located(self.locators.PAGE_IMAGES))
elements = self.elements_are_present(self.locators.PAGE_IMAGES)
return elements

@allure.step("Check if images on the 6th level of nesting are visible")
def check_visibility_of_images(self):
elements = self.get_list_of_images()
for element in elements:
WebDriverWait(self.driver, 10).until(ec.visibility_of(element))
return all(element.is_displayed() for element in elements)

@allure.step("Get the list of subtitles on the 6th level of nesting on the page")
Expand Down Expand Up @@ -168,7 +151,6 @@ def check_links_clickability(self):
@allure.step("Get attribute 'title' of links on the 'ru' local")
def get_links_titles_ru(self):
elements = self.get_list_of_links()
# WebDriverWait(self.driver, 10).until(ec.visibility_of_all_elements_located(self.locators.PAGE_IMAGES))
return [element.get_attribute('title') for element in elements]

@allure.step("Get attribute 'title' of links on the 'en' local")
Expand Down Expand Up @@ -228,7 +210,6 @@ def get_images_src(self):
@allure.step("Get the list of attribute 'alt' values of images in links on the 'ru' local")
def get_images_alt_ru(self):
elements = self.get_list_of_images()
WebDriverWait(self.driver, 10).until(ec.visibility_of_all_elements_located(self.locators.PAGE_IMAGES))
return [element.get_attribute('alt') for element in elements]

@allure.step("Get the list of attribute 'alt' values of images in links on the 'en' local")
Expand All @@ -238,8 +219,6 @@ def get_images_alt_en(self):
@allure.step("Get the list of sizes of images in links")
def get_images_sizes(self):
elements = self.get_list_of_images()
for element in elements:
WebDriverWait(self.driver, 10).until(ec.visibility_of(element))
return [element.size for element in elements]

@allure.step("Check changes of images sizes after resizing")
Expand Down
4 changes: 0 additions & 4 deletions tests/exercises_ru_similar_phrases_page_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ class TestExRuSimPhrPageText:
def test_ersp_02_01_verify_tab_title(self, driver, exercises_ru_similar_phrases_page_open):
page = erspPage(driver)
tab_title_value = page.get_value_of_tab_title()
print("Found tab title value:", tab_title_value) # temporarily for debugging
print("Expected tab title value:", erspPD.tab_title_ru)
assert tab_title_value, "The title value of the tab is empty"
assert tab_title_value in erspPD.tab_title_ru, "The tab title mismatches the valid value"

Expand All @@ -97,8 +95,6 @@ def test_ersp_02_03_verify_group_links_text(self, driver, exercises_ru_similar_p
def test_ersp_02_04_verify_subgroup_links_text(self, driver, exercises_ru_similar_phrases_page_open):
page = erspPage(driver)
subgroup_links_text = page.get_subgroup_links_text()
print("Found tab title value:", subgroup_links_text) # temporarily for debugging
print("Expected tab title value:", erspPD.subgroup_links_text)
assert subgroup_links_text, "Text in cards is absent"
assert all(element in erspPD.subgroup_links_text for element in subgroup_links_text), \
"Text in subgroup links mismatches valid values"
Expand Down
4 changes: 0 additions & 4 deletions tests/groups_page_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ def test_gp_03_01_verify_links(self, driver, groups_ru_page_open):
def test_gp_03_02_01_verify_links_ru_title(self, driver, groups_ru_page_open):
page = gPage(driver)
link_titles_ru = page.get_links_titles_ru()
print("Found alt attributes:", link_titles_ru) # temporarily for debugging
print("Expected alt attributes:", gPD.link_titles_ru)
assert link_titles_ru, "Link titles values are empty on the 'ru' local"
assert all(element in gPD.link_titles_ru for element in link_titles_ru), \
"Link titles mismatch any valid values on the 'ru' local"
Expand Down Expand Up @@ -181,8 +179,6 @@ def test_gp_04_01_verify_images_src(self, driver, groups_ru_page_open):
def test_gp_04_02_verify_images_alt_ru(self, driver, groups_ru_page_open):
page = gPage(driver)
images_alt_ru = page.get_images_alt_ru()
print("Found alt attributes:", images_alt_ru) # temporarily for debugging
print("Expected alt attributes:", gPD.images_alt_ru)
assert images_alt_ru, "The 'alt' attribute value of some images is empty on the 'ru' local"
assert all(element in gPD.images_alt_ru for element in images_alt_ru), \
"The 'alt' attribute value of some images is empty or mismatches valid values on the 'ru' local"
Expand Down