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
150 changes: 69 additions & 81 deletions test_data/header_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,105 +3,93 @@


class HeaderData:
links_text_unauth = [
"ОПИСАНИЕ", "ABOUT",
"TELEGRAM",
"Пожертвовать", "Donate",
"GitHub",
"Контакты", "Contacts",
"Специалисты", "Specialists",
"Наша команда", "Contributors",
"Используемые ресурсы", "Used Resources",
"Регистрация", "Registration"
]
links_text_unauth = ("ОПИСАНИЕ", "ABOUT",
"TELEGRAM",
"Пожертвовать", "Donate",
"GitHub",
"Контакты", "Contacts",
"Специалисты", "Specialists",
"Наша команда", "Contributors",
"Используемые ресурсы", "Used Resources",
"Регистрация", "Registration")

links_text_auth = [
"УПРАЖНЕНИЯ", "GROUPS",
"СТАТИСТИКА", "STATISTICS",
"ОПИСАНИЕ", "ABOUT",
"TELEGRAM",
"Пожертвовать", "Donate",
"GitHub",
"Контакты", "Contacts",
"Специалисты", "Specialists",
"Наша команда", "Contributors",
"Используемые ресурсы", "Used Resources"
]
links_text_auth = ("УПРАЖНЕНИЯ", "GROUPS",
"СТАТИСТИКА", "STATISTICS",
"ОПИСАНИЕ", "ABOUT",
"TELEGRAM",
"Пожертвовать", "Donate",
"GitHub",
"Контакты", "Contacts",
"Специалисты", "Specialists",
"Наша команда", "Contributors",
"Используемые ресурсы", "Used Resources")

buttons_text = ['RU', 'EN', 'ЕЩЕ...', 'MORE...']
buttons_text = ('RU', 'EN', 'ЕЩЕ...', 'MORE...')

ru_en_buttons_text = "RU / EN"

title_text_ru_unauth = "Преимущества"
title_text_en_unauth = "Advantages"
titles_text_unauth = ["Преимущества", "Advantages"]
titles_text_unauth = ("Преимущества", "Advantages")

title_text_ru_auth = "Давайте выберем, какие упражнения будем делать сегодня?"
title_text_en_auth = "Let's choose what exercises we do today?"

link_titles = "Телеграм чат для пользователей"

links_href_unauth = [
f"{Links.URL_MAIN_PAGE}",
f"{Links.URL_MAIN_PAGE}description",
"https://t.me/BrainUpUsers",
"https://opencollective.com/brainup",
"https://github.com/Brain-up/brn",
f"{Links.URL_MAIN_PAGE}contact",
f"{Links.URL_MAIN_PAGE}specialists",
f"{Links.URL_MAIN_PAGE}contributors",
f"{Links.URL_MAIN_PAGE}used-resources",
f"{Links.URL_MAIN_PAGE}registration"
]
links_href_unauth = (f"{Links.URL_MAIN_PAGE}",
f"{Links.URL_MAIN_PAGE}description",
"https://t.me/BrainUpUsers",
"https://opencollective.com/brainup",
"https://github.com/Brain-up/brn",
f"{Links.URL_MAIN_PAGE}contact",
f"{Links.URL_MAIN_PAGE}specialists",
f"{Links.URL_MAIN_PAGE}contributors",
f"{Links.URL_MAIN_PAGE}used-resources",
f"{Links.URL_MAIN_PAGE}registration")

links_href_auth = [
f"{Links.URL_MAIN_PAGE}",
f"{Links.URL_MAIN_PAGE}groups?locale=ru-ru",
f"{Links.URL_MAIN_PAGE}groups?locale=en-us",
f"{Links.URL_MAIN_PAGE}profile/statistics",
f"{Links.URL_MAIN_PAGE}description",
"https://t.me/BrainUpUsers",
"https://opencollective.com/brainup",
"https://github.com/Brain-up/brn",
f"{Links.URL_MAIN_PAGE}contact",
f"{Links.URL_MAIN_PAGE}specialists",
f"{Links.URL_MAIN_PAGE}contributors",
f"{Links.URL_MAIN_PAGE}used-resources",
f"{Links.URL_MAIN_PAGE}profile"
]
links_href_auth = (f"{Links.URL_MAIN_PAGE}",
f"{Links.URL_MAIN_PAGE}groups?locale=ru-ru",
f"{Links.URL_MAIN_PAGE}groups?locale=en-us",
f"{Links.URL_MAIN_PAGE}profile/statistics",
f"{Links.URL_MAIN_PAGE}description",
"https://t.me/BrainUpUsers",
"https://opencollective.com/brainup",
"https://github.com/Brain-up/brn",
f"{Links.URL_MAIN_PAGE}contact",
f"{Links.URL_MAIN_PAGE}specialists",
f"{Links.URL_MAIN_PAGE}contributors",
f"{Links.URL_MAIN_PAGE}used-resources",
f"{Links.URL_MAIN_PAGE}profile")

link_status_codes = 200
link_status_codes = (200,)

pages_urls_unauth = [
f"{Links.URL_MAIN_PAGE}description",
"https://t.me/BrainUpUsers",
f"{Links.URL_MAIN_PAGE}registration",
f"{Links.URL_MAIN_PAGE}contact",
f"{Links.URL_MAIN_PAGE}specialists",
f"{Links.URL_MAIN_PAGE}contributors",
f"{Links.URL_MAIN_PAGE}used-resources",
"https://opencollective.com/brainup",
"https://github.com/Brain-up/brn",
f"{Links.URL_MAIN_PAGE}"
]
pages_urls_unauth = (f"{Links.URL_MAIN_PAGE}description",
"https://t.me/BrainUpUsers",
f"{Links.URL_MAIN_PAGE}registration",
f"{Links.URL_MAIN_PAGE}contact",
f"{Links.URL_MAIN_PAGE}specialists",
f"{Links.URL_MAIN_PAGE}contributors",
f"{Links.URL_MAIN_PAGE}used-resources",
"https://opencollective.com/brainup",
"https://github.com/Brain-up/brn",
f"{Links.URL_MAIN_PAGE}")

pages_urls_auth = [
f"{Links.URL_MAIN_PAGE}groups?locale=ru-ru",
f"{Links.URL_MAIN_PAGE}groups?locale=en-us",
f"{Links.URL_MAIN_PAGE}profile/statistics",
f"{Links.URL_MAIN_PAGE}description",
"https://t.me/BrainUpUsers",
f"{Links.URL_MAIN_PAGE}profile",
f"{Links.URL_MAIN_PAGE}contact",
f"{Links.URL_MAIN_PAGE}specialists",
f"{Links.URL_MAIN_PAGE}contributors",
f"{Links.URL_MAIN_PAGE}used-resources",
"https://opencollective.com/brainup",
"https://github.com/Brain-up/brn",
f"{Links.URL_MAIN_PAGE}"
]
pages_urls_auth = (f"{Links.URL_MAIN_PAGE}groups?locale=ru-ru",
f"{Links.URL_MAIN_PAGE}groups?locale=en-us",
f"{Links.URL_MAIN_PAGE}profile/statistics",
f"{Links.URL_MAIN_PAGE}description",
"https://t.me/BrainUpUsers",
f"{Links.URL_MAIN_PAGE}profile",
f"{Links.URL_MAIN_PAGE}contact",
f"{Links.URL_MAIN_PAGE}specialists",
f"{Links.URL_MAIN_PAGE}contributors",
f"{Links.URL_MAIN_PAGE}used-resources",
"https://opencollective.com/brainup",
"https://github.com/Brain-up/brn",
f"{Links.URL_MAIN_PAGE}")

icons_xmlns = "http://www.w3.org/2000/svg"
icons_xmlns = ("http://www.w3.org/2000/svg",)
logo_image_xmlns = "http://www.w3.org/2000/svg"

profile_avatar_src = f"{Links.URL_MAIN_PAGE}pictures/avatars/avatar%201.png"
Expand Down
38 changes: 19 additions & 19 deletions tests/header_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_hpu_01_01_verify_unauth_header_presence_and_visibility(self, driver, ma
page = HeaderPage(driver)
page_content_presence = page.check_header_presence()
page_content_visibility = page.check_header_visibility()
assert page_content_presence is not None, "The Header is absent in DOM"
assert page_content_presence, "The Header is absent in DOM"
assert page_content_visibility, "The Header is invisible for an unauthorized user"

@allure.title("""Verify composition, visibility of elements on the 1st-6th levels of nesting in the Header
Expand Down Expand Up @@ -90,13 +90,13 @@ def test_hpu_02_01_verify_unauth_text_in_links_and_buttons(self, driver, main_pa
links_in_more_text = page.get_text_of_links_in_more()
buttons_text = page.get_text_in_buttons_unauth()
ru_en_buttons_text = page.get_text_in_ru_en_buttons()
assert all(link_text in HeaderData.links_text_unauth for link_text in direct_links_text), \
assert all(element in HeaderData.links_text_unauth for element in direct_links_text), \
"Text in links in section 2 mismatches valid values"
assert all(link_text in HeaderData.links_text_unauth for link_text in links_in_more_text), \
assert all(element in HeaderData.links_text_unauth for element in links_in_more_text), \
"Text in links in section 3 mismatches valid values"
assert all(button_text in HeaderData.buttons_text for button_text in buttons_text), \
assert all(element in HeaderData.buttons_text for element in buttons_text), \
"Text in buttons mismatches valid values"
assert all(button_text in HeaderData.ru_en_buttons_text for button_text in ru_en_buttons_text), \
assert all(element in HeaderData.ru_en_buttons_text for element in ru_en_buttons_text), \
"Text in 'ru-en' buttons mismatches valid values"

class TestUnauthHeaderPageLinks:
Expand All @@ -111,9 +111,9 @@ def test_hpu_03_01_verify_unauth_header_links(self, driver, main_page_open):
assert tg_link_title, "The link title value is empty"
assert tg_link_title in HeaderData.link_titles, "The link title mismatches the valid value"
assert links_href, "Links href are empty"
assert all(link_href in HeaderData.links_href_unauth for link_href in links_href), \
assert all(element in HeaderData.links_href_unauth for element in links_href), \
"Attributes 'href' of links mismatch valid values"
assert all(status_code == HeaderData.link_status_codes for status_code in link_status_codes), \
assert all(element in HeaderData.link_status_codes for element in link_status_codes), \
"Status codes of links mismatch valid values"

@allure.title("""Verify if internal links in the Header for an unauthorized user
Expand All @@ -123,7 +123,7 @@ def test_hpu_03_02_verify_unauth_internal_links_lead_to_correct_pages(self, driv
internal_links_in_more = page.get_list_of_internal_links_in_more()
opened_pages = page.click_on_internal_links_in_header_unauth()
assert internal_links_in_more, "Internal links are not collected in the list"
assert all(page in HeaderData.pages_urls_unauth for page in opened_pages), \
assert all(element in HeaderData.pages_urls_unauth for element in opened_pages), \
"Some of internal links lead to incorrect pages after clicking"

@allure.title("""Verify if external links in the Header for an unauthorized user
Expand All @@ -133,7 +133,7 @@ def test_hpu_03_03_verify_unauth_external_links_lead_to_correct_pages(self, driv
external_links_in_more = page.get_list_of_external_links_in_more()
opened_pages = page.click_on_external_links_in_header()
assert external_links_in_more, "External links are not collected in the list"
assert all(page in HeaderData.pages_urls_unauth for page in opened_pages), \
assert all(element in HeaderData.pages_urls_unauth for element in opened_pages), \
"Some of external links lead to incorrect pages after clicking"

@allure.title("""Verify that the 'Logo' link on the Start Unauthorized Page
Expand Down Expand Up @@ -199,7 +199,7 @@ def test_hpa_01_01_verify_auth_header_presence_and_visibility(self, driver, auto
page = HeaderPage(driver)
page_content_presence = page.check_header_presence()
page_content_visibility = page.check_header_visibility()
assert page_content_presence is not None, "The Header is absent in DOM"
assert page_content_presence, "The Header is absent in DOM"
assert page_content_visibility, "The Header is invisible for an authorized user"

@allure.title("""Verify composition, visibility of elements on the 1st-6th levels of nesting in the Header
Expand Down Expand Up @@ -279,14 +279,14 @@ def test_hpa_02_01_verify_auth_text_in_links_and_buttons(self, driver, auto_test
links_in_more_text = page.get_text_of_links_in_more()
buttons_text = page.get_text_in_buttons_auth()
ru_en_buttons_text = page.get_text_in_ru_en_buttons()
assert all(link_text in HeaderData.links_text_auth for link_text in direct_links_text[:4]), \
assert all(element in HeaderData.links_text_auth for element in direct_links_text[:4]), \
"Text in links in section 2 mismatches valid values"
assert direct_links_text[4], "Text in the 'Profile' link is absent"
assert all(link_text in HeaderData.links_text_auth for link_text in links_in_more_text), \
assert all(element in HeaderData.links_text_auth for element in links_in_more_text), \
"Text in links in section 3 mismatches valid values"
assert all(button_text in HeaderData.buttons_text for button_text in buttons_text), \
assert all(element in HeaderData.buttons_text for element in buttons_text), \
"Text in buttons mismatches valid values"
assert all(button_text in HeaderData.ru_en_buttons_text for button_text in ru_en_buttons_text), \
assert all(element in HeaderData.ru_en_buttons_text for element in ru_en_buttons_text), \
"Text in 'ru-en' buttons mismatches valid values"

@allure.title("Verify presence, visibility of the user name in the Header for an authorized user")
Expand All @@ -306,9 +306,9 @@ def test_hpa_03_01_verify_auth_header_links(self, driver, auto_test_user_authori
link_status_codes = page.get_links_status_codes_auth()
assert links_clickability, "Links are unclickable"
assert links_href, "Links href are empty"
assert all(link_href in HeaderData.links_href_auth for link_href in links_href), \
assert all(element in HeaderData.links_href_auth for element in links_href), \
"Attributes 'href' of links mismatch valid values"
assert all(status_code == HeaderData.link_status_codes for status_code in link_status_codes), \
assert all(element in HeaderData.link_status_codes for element in link_status_codes), \
"Status codes of links mismatch valid values"

@allure.title("""Verify if internal links in the Header for an authorized user
Expand All @@ -318,7 +318,7 @@ def test_hpa_03_02_verify_auth_internal_links_lead_to_proper_pages(self, driver,
internal_links_in_more = page.get_list_of_internal_links_in_more()
opened_pages = page.click_on_internal_links_in_header_auth()
assert internal_links_in_more, "Internal links are not collected in the list"
assert all(page in HeaderData.pages_urls_auth for page in opened_pages), \
assert all(element in HeaderData.pages_urls_auth for element in opened_pages), \
"Some of internal links lead to incorrect pages after clicking"

@allure.title("""Verify if external links in the Header for an authorized user
Expand All @@ -328,7 +328,7 @@ def test_hpa_03_03_verify_auth_external_links_lead_to_proper_pages(self, driver,
external_links_in_more = page.get_list_of_external_links_in_more()
opened_pages = page.click_on_external_links_in_header()
assert external_links_in_more, "External links are not collected in the list"
assert all(page in HeaderData.pages_urls_auth for page in opened_pages), \
assert all(element in HeaderData.pages_urls_auth for element in opened_pages), \
"Some of external links lead to incorrect pages after clicking"

@allure.title("""Verify that the 'Logo' link on the Start Authorized Page
Expand Down Expand Up @@ -402,7 +402,7 @@ def test_hpa_04_03_verify_auth_icons(self, driver, auto_test_user_authorized):
assert icons_presence, "Icons in the Header are absent"
assert icons_visibility, "Icons in the Header are invisible"
assert icons_xmlns, "The 'xmlns' attribute value of icons in the Header are empty"
assert all(icon_xmlns == HeaderData.icons_xmlns for icon_xmlns in icons_xmlns), \
assert all(element in HeaderData.icons_xmlns for element in icons_xmlns), \
"The 'xmlns' attribute value of some icons is empty or non-accurate"

@allure.title("""Verify presence, visibility and attributes of the profile avatar in the Header
Expand Down