Skip to content

Issue_268_HEADER_data #527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2025
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
66 changes: 17 additions & 49 deletions test_data/header_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,60 +37,28 @@ class HeaderData:

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")
s = Links.URL_MAIN_PAGE
s1 = f"{s}contact"
s2 = f"{s}contributors"
s3 = f"{s}description"
s4 = f"{s}groups?locale=ru-ru"
s5 = f"{s}groups?locale=en-us"
s6 = f"{s}profile"
s7 = f"{s}profile/statistics"
s8 = f"{s}registration"
s9 = f"{s}specialists"
s10 = f"{s}used-resources"
s11 = "https://github.com/Brain-up/brn"
s12 = "https://opencollective.com/brainup"
s13 = "https://t.me/BrainUpUsers"

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")
set_auth = (s, s1, s2, s3, s4, s5, s6, s7, s9, s10, s11, s12, s13)
set_unauth = (s, s1, s2, s3, s8, s9, s10, s11, s12, s13)

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_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",)
logo_image_xmlns = "http://www.w3.org/2000/svg"

profile_avatar_src = f"{Links.URL_MAIN_PAGE}pictures/avatars/avatar%201.png"
profile_avatar_src = f"{s}pictures/avatars/avatar%201.png"
profile_avatar_alt = "user avatar"
14 changes: 6 additions & 8 deletions tests/header_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Auto tests for verifying web elements in the Header of the site"""
import allure
import pytest
from pages.header_page import HeaderPage as hPage
from test_data.header_data import HeaderData as hPD

Expand Down Expand Up @@ -111,7 +110,7 @@ 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 hPD.link_titles, "The link title mismatches the valid value"
assert links_href, "Links href are empty"
assert all(element in hPD.links_href_unauth for element in links_href), \
assert all(element in hPD.set_unauth for element in links_href), \
"Attributes 'href' of links mismatch valid values"
assert all(element in hPD.link_status_codes for element in link_status_codes), \
"Status codes of links mismatch valid values"
Expand All @@ -123,7 +122,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(element in hPD.pages_urls_unauth for element in opened_pages), \
assert all(element in hPD.set_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 +132,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(element in hPD.pages_urls_unauth for element in opened_pages), \
assert all(element in hPD.set_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 @@ -302,8 +301,7 @@ 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(element in hPD.links_href_auth for element in links_href), \
"Attributes 'href' of links mismatch valid values"
assert all(element in hPD.set_auth for element in links_href), "Links href mismatch valid values"
assert all(element in hPD.link_status_codes for element in link_status_codes), \
"Status codes of links mismatch valid values"

Expand All @@ -314,7 +312,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(element in hPD.pages_urls_auth for element in opened_pages), \
assert all(element in hPD.set_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 @@ -324,7 +322,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(element in hPD.pages_urls_auth for element in opened_pages), \
assert all(element in hPD.set_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