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
4 changes: 0 additions & 4 deletions locators/exercises_ru_words_page_locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ class ExercisesRuWordsPageLocators:
PAGE_LIST3_4 = (By.XPATH, '(//div[contains(@class, "series-page")]//a)[4]')
# PAGE_LIST3 = (By.XPATH, "//main//div/a")
CARD_IMAGES_LIST4 = (By.XPATH, '//div[contains(@style, "svg")]')


class HeaderLocators:
RU_BUTTON = (By.XPATH, "(//span/button)[1]")
44 changes: 22 additions & 22 deletions pages/exercises_ru_similar_phrases_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ def check_list2_visibility(self):
return self.element_is_visible(self.locators.PAGE_LIST2)

@allure.step("Check the list3 on the 5th level of nesting is present on the page")
def get_list3_of_subgroup_links(self):
def get_list3_of_series_links(self):
return self.elements_are_present(self.locators.PAGE_LIST3)

@allure.step("Check the list3 is visible")
def check_list3_visibility(self):
return all(element.is_displayed() for element in self.get_list3_of_subgroup_links())
return all(element.is_displayed() for element in self.get_list3_of_series_links())

@allure.step("Check the list4 on the 6th level of nesting is present on the page")
def get_list4_of_links(self):
Expand All @@ -122,9 +122,9 @@ def get_value_of_breadcrumbs(self):
def get_group_links_text(self):
return [element.text for element in self.get_list2_of_group_links()]

@allure.step("Get text in subgroup links on the page")
def get_subgroup_links_text(self):
return [element.text for element in self.get_list3_of_subgroup_links()]
@allure.step("Get text in series links on the page")
def get_series_links_text(self):
return [element.text for element in self.get_list3_of_series_links()]

# Checking links on the page
@allure.step("Check if breadcrumbs are clickable")
Expand Down Expand Up @@ -154,18 +154,18 @@ def get_group_link_active_links(self):
# print(len(group_link_active_links), *group_link_active_links, sep='\n')
return [el.get_attribute("data-test-active-link") for el in self.get_list2_of_group_links()]

@allure.step("Check if subgroup links are clickable")
def check_subgroup_links_clickability(self):
return all(link.is_enabled() for link in self.get_list3_of_subgroup_links())
@allure.step("Check if series links are clickable")
def check_series_links_clickability(self):
return all(link.is_enabled() for link in self.get_list3_of_series_links())

@allure.step("Get attribute 'href' of subgroup links")
def get_subgroup_links_href(self):
# print(len(subgroup_links_href), *subgroup_links_href, sep='\n')
return [element.get_attribute("href") for element in self.get_list3_of_subgroup_links()]
@allure.step("Get attribute 'href' of series links")
def get_series_links_href(self):
# print(len(series_links_href), *series_links_href, sep='\n')
return [element.get_attribute("href") for element in self.get_list3_of_series_links()]

@allure.step("Get status code of subgroup links")
def get_subgroup_link_status_codes(self):
return [requests.head(link_href).status_code for link_href in self.get_subgroup_links_href()]
@allure.step("Get status code of series links")
def get_series_link_status_codes(self):
return [requests.head(link_href).status_code for link_href in self.get_series_links_href()]

@allure.step("Click on breadcrumbs links and thereby open corresponding web pages in the same tab")
def click_on_breadcrumbs_links(self):
Expand Down Expand Up @@ -194,15 +194,15 @@ def click_on_group_links(self):

return opened_pages

@allure.step("""Click on subgroup links and thereby open corresponding web pages in the same tab""")
def click_on_subgroup_links(self):
subgroup_locators = [self.locators.PAGE_LIST3_1, self.locators.PAGE_LIST3_2,
self.locators.PAGE_LIST3_3, self.locators.PAGE_LIST3_4,
self.locators.PAGE_LIST3_5, self.locators.PAGE_LIST3_6]
@allure.step("""Click on series links and thereby open corresponding web pages in the same tab""")
def click_on_series_links(self):
series_locators = [self.locators.PAGE_LIST3_1, self.locators.PAGE_LIST3_2,
self.locators.PAGE_LIST3_3, self.locators.PAGE_LIST3_4,
self.locators.PAGE_LIST3_5, self.locators.PAGE_LIST3_6]
group_page_url = self.get_current_tab_url()
opened_pages = []

for link_locator in subgroup_locators:
for link_locator in series_locators:
self.element_is_clickable(link_locator).click()
Wait(self.driver, self.timeout).until(EC.url_changes(group_page_url))
opened_pages.append(self.get_current_tab_url())
Expand All @@ -222,7 +222,7 @@ def get_links_style(self):
@allure.step("Get the list of sizes of background-images in links")
def get_images_sizes(self):
images_size = [image.size for image in self.get_list4_of_links()]
print(len(images_size), *images_size, sep='\n')
# print(len(images_size), *images_size, sep='\n')
return images_size

@allure.step("Check changes of images sizes after resizing")
Expand Down
49 changes: 24 additions & 25 deletions pages/exercises_ru_words_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait as Wait
from pages.base_page import BasePage
from locators.exercises_ru_words_page_locators import ExercisesRuWordsPageLocators, HeaderLocators
from locators.exercises_ru_words_page_locators import ExercisesRuWordsPageLocators


class ExercisesRuWordsPage(BasePage):
locators = ExercisesRuWordsPageLocators
locators1 = HeaderLocators

# Checking the structure and display of elements on the page
@allure.step("Check if some content is present in DOM")
Expand Down Expand Up @@ -94,12 +93,12 @@ def check_list2_visibility(self):
return all(element.is_displayed() for element in self.get_list2_of_group_links())

@allure.step("Check the list3 on the 5th level of nesting is present on the page")
def get_list3_of_subgroup_links(self):
def get_list3_of_series_links(self):
return self.elements_are_present(self.locators.PAGE_LIST3)

@allure.step("Check the list3 is visible")
def check_list3_visibility(self):
return all(element.is_displayed() for element in self.get_list3_of_subgroup_links())
return all(element.is_displayed() for element in self.get_list3_of_series_links())

@allure.step("Check the list4 on the 6th level of nesting is present on the page")
def get_list4_of_links(self):
Expand All @@ -123,9 +122,9 @@ def get_value_of_breadcrumbs(self):
def get_group_links_text(self):
return [element.text for element in self.get_list2_of_group_links()]

@allure.step("Get text in subgroup links on the page")
def get_subgroup_links_text(self):
return [element.text for element in self.get_list3_of_subgroup_links()]
@allure.step("Get text in series links on the page")
def get_series_links_text(self):
return [element.text for element in self.get_list3_of_series_links()]

# Checking links on the page
@allure.step("Check if breadcrumbs are clickable")
Expand All @@ -152,22 +151,22 @@ def get_group_link_titles(self):
def get_group_link_active_links(self):
return [el.get_attribute("data-test-active-link") for el in self.get_list2_of_group_links()]

@allure.step("Check if subgroup links are clickable")
def check_subgroup_links_clickability(self):
return all(link.is_enabled() for link in self.get_list3_of_subgroup_links())
@allure.step("Check if series links are clickable")
def check_series_links_clickability(self):
return all(link.is_enabled() for link in self.get_list3_of_series_links())

@allure.step("Get attribute 'title' of subgroup links")
def get_subgroup_link_titles(self):
return [element.get_attribute("title") for element in self.get_list3_of_subgroup_links()]
@allure.step("Get attribute 'title' of series links")
def get_series_link_titles(self):
return [element.get_attribute("title") for element in self.get_list3_of_series_links()]

@allure.step("Get attribute 'href' of subgroup links")
def get_subgroup_links_href(self):
# print(len(subgroup_links_href), *subgroup_links_href, sep='\n')
return [element.get_attribute("href") for element in self.get_list3_of_subgroup_links()]
@allure.step("Get attribute 'href' of series links")
def get_series_links_href(self):
# print(len(series_links_href), *series_links_href, sep='\n')
return [element.get_attribute("href") for element in self.get_list3_of_series_links()]

@allure.step("Get status code of subgroup links")
def get_subgroup_link_status_codes(self):
return [requests.head(link_href).status_code for link_href in self.get_subgroup_links_href()]
@allure.step("Get status code of series links")
def get_series_link_status_codes(self):
return [requests.head(link_href).status_code for link_href in self.get_series_links_href()]

@allure.step("Click on breadcrumbs links and thereby open corresponding web pages in the same tab")
def click_on_breadcrumbs_links(self):
Expand Down Expand Up @@ -197,14 +196,14 @@ def click_on_group_links(self):

return opened_pages

@allure.step("""Click on subgroup links and thereby open corresponding web pages in the same tab""")
def click_on_subgroup_links(self):
subgroup_locators = [self.locators.PAGE_LIST3_1, self.locators.PAGE_LIST3_2,
self.locators.PAGE_LIST3_3, self.locators.PAGE_LIST3_4]
@allure.step("""Click on series links and thereby open corresponding web pages in the same tab""")
def click_on_series_links(self):
series_locators = [self.locators.PAGE_LIST3_1, self.locators.PAGE_LIST3_2,
self.locators.PAGE_LIST3_3, self.locators.PAGE_LIST3_4]
group_page_url = self.get_current_tab_url()
opened_pages = []

for link_locator in subgroup_locators:
for link_locator in series_locators:
self.element_is_clickable(link_locator).click()
Wait(self.driver, self.timeout).until(EC.url_changes(group_page_url))
opened_pages.append(self.get_current_tab_url())
Expand Down
12 changes: 6 additions & 6 deletions test_data/exercises_ru_pages_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ class ExercisesRuPagesData:
group_link_active_links = ('Слова', 'Слова Королёвой', 'Похожие фразы', 'Группа слов', 'Предложения',
'Слова с частотной группировкой')

# subgroup links data
# series links data
s = 'background-image: url("https://brnup.s3.eu-north-1.amazonaws.com/pictures/theme/'
e = '.svg");'

subgroup_links_style_similar_phrases_ru = (
series_links_style_similar_phrases_ru = (
f"{s}longShortPhrases{e}", f"{s}noPhrases{e}", f"{s}similarPhrases{e}", f"{s}differentEndPhrases{e}",
f"{s}shortWords{e}", f"{s}prepositionPhrases{e}")

subgroup_links_text_similar_phrases_ru = (
series_links_text_similar_phrases_ru = (
'Разной длительности', 'С частицей Не', 'Похожие', 'С разным окончанием', 'Из коротких слов',
'С разными предлогами')

subgroup_links_style_words_ru = (
series_links_style_words_ru = (
f"{s}family{e}", f"{s}home{e}", f"{s}food{e}", f"{s}clothes{e}", f"{s}school{e}", f"{s}math{e}", f"{s}pets{e}",
f"{s}animals{e}", f"{s}transport{e}", f"{s}colors{e}", f"{s}city{e}", f"{s}country{e}", f"{s}walk{e}",
f"{s}weather{e}", f"{s}future{e}", f"{s}body{e}", f"{s}game{e}", f"{s}adventure{e}", f"{s}hospital{e}",
Expand All @@ -49,7 +49,7 @@ class ExercisesRuPagesData:
f"{s}stationery{e}", f"{s}flowers{e}", f"{s}literature{e}", f"{s}physics{e}", f"{s}biology{e}",
f"{s}instruments{e}")

subgroup_links_text_words_ru = (
series_links_text_words_ru = (
'Семья', 'Любимый дом', 'Что я ем', 'Одежда', 'В школе', 'Математика', 'Домашние питомцы', 'Мир животных',
'Транспорт', 'Цвета и форма', 'В городе', 'В деревне', 'На прогулке', 'Погода', 'Стану кем хочу',
'Тело человека', 'Развлечения', 'Путешествия', 'В больнице', 'Что я чувствую', 'Игрушки', 'Насекомые',
Expand All @@ -58,7 +58,7 @@ class ExercisesRuPagesData:
'Растения', 'Деревья и кустарники', 'Спорт', 'В магазине', 'Парнокопытные', 'Породы собак',
'Канцелярские принадлежности', 'Цветы', 'Русский язык и литература', 'Физика', 'Биология', 'Инструменты')

subgroup_links_titles_words_ru = (
series_links_titles_words_ru = (
'Слова про семью', 'Слова про дом', 'Слова о еде', 'Слова об одежде', 'Слова о школе и учёбе',
'Математика и её термины', 'Слова о домашних питомцах', 'Слова о животных', 'Слова о транспорте',
'Слова о понятиях цета и формы', 'Слова о жизни города', 'Слова из деревенской жизни', 'Слова о прогулке',
Expand Down
4 changes: 2 additions & 2 deletions test_data/links.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ class ExercisesUrls:
breadcrumbs_urls_ru_similar_phrases = breadcrumbs_urls_ru + (URL_EXERCISES_RU_SIMILAR_PHRASES_PAGE,)

b = f"{URL_EXERCISES_RU_SIMILAR_PHRASES_PAGE}/subgroup/"
subgroup_link_urls_ru_similar_phrases = (f"{b}60", f"{b}61", f"{b}62", f"{b}63", f"{b}64", f"{b}65")
series_link_urls_ru_similar_phrases = (f"{b}60", f"{b}61", f"{b}62", f"{b}63", f"{b}64", f"{b}65")

# Speech Exercises RU > Words
URL_EXERCISES_RU_WORDS_PAGE = f"{STARTING_POINT}/2/series/1"

breadcrumbs_urls_ru_words = breadcrumbs_urls_ru + (URL_EXERCISES_RU_WORDS_PAGE,)

c = f"{URL_EXERCISES_RU_WORDS_PAGE}/subgroup/"
subgroup_link_urls_ru_words = (
series_link_urls_ru_words = (
f"{c}1", f"{c}2", f"{c}3", f"{c}4", f"{c}5", f"{c}6", f"{c}7", f"{c}8", f"{c}9", f"{c}10", f"{c}11", f"{c}12",
f"{c}13", f"{c}14", f"{c}15", f"{c}16", f"{c}17", f"{c}18", f"{c}19", f"{c}20", f"{c}21", f"{c}22", f"{c}23",
f"{c}24", f"{c}25", f"{c}26", f"{c}27", f"{c}28", f"{c}29", f"{c}30", f"{c}31", f"{c}32", f"{c}33", f"{c}34",
Expand Down
Loading