Skip to content

Commit fc96167

Browse files
update header_test.py, header_data.py
1 parent 726276c commit fc96167

File tree

2 files changed

+23
-57
lines changed

2 files changed

+23
-57
lines changed

test_data/header_data.py

+17-49
Original file line numberDiff line numberDiff line change
@@ -37,60 +37,28 @@ class HeaderData:
3737

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

40-
links_href_unauth = (f"{Links.URL_MAIN_PAGE}",
41-
f"{Links.URL_MAIN_PAGE}description",
42-
"https://t.me/BrainUpUsers",
43-
"https://opencollective.com/brainup",
44-
"https://github.com/Brain-up/brn",
45-
f"{Links.URL_MAIN_PAGE}contact",
46-
f"{Links.URL_MAIN_PAGE}specialists",
47-
f"{Links.URL_MAIN_PAGE}contributors",
48-
f"{Links.URL_MAIN_PAGE}used-resources",
49-
f"{Links.URL_MAIN_PAGE}registration")
40+
s = Links.URL_MAIN_PAGE
41+
s1 = f"{s}contact"
42+
s2 = f"{s}contributors"
43+
s3 = f"{s}description"
44+
s4 = f"{s}groups?locale=ru-ru"
45+
s5 = f"{s}groups?locale=en-us"
46+
s6 = f"{s}profile"
47+
s7 = f"{s}profile/statistics"
48+
s8 = f"{s}registration"
49+
s9 = f"{s}specialists"
50+
s10 = f"{s}used-resources"
51+
s11 = "https://github.com/Brain-up/brn"
52+
s12 = "https://opencollective.com/brainup"
53+
s13 = "https://t.me/BrainUpUsers"
5054

51-
links_href_auth = (f"{Links.URL_MAIN_PAGE}",
52-
f"{Links.URL_MAIN_PAGE}groups?locale=ru-ru",
53-
f"{Links.URL_MAIN_PAGE}groups?locale=en-us",
54-
f"{Links.URL_MAIN_PAGE}profile/statistics",
55-
f"{Links.URL_MAIN_PAGE}description",
56-
"https://t.me/BrainUpUsers",
57-
"https://opencollective.com/brainup",
58-
"https://github.com/Brain-up/brn",
59-
f"{Links.URL_MAIN_PAGE}contact",
60-
f"{Links.URL_MAIN_PAGE}specialists",
61-
f"{Links.URL_MAIN_PAGE}contributors",
62-
f"{Links.URL_MAIN_PAGE}used-resources",
63-
f"{Links.URL_MAIN_PAGE}profile")
55+
set_auth = (s, s1, s2, s3, s4, s5, s6, s7, s9, s10, s11, s12, s13)
56+
set_unauth = (s, s1, s2, s3, s8, s9, s10, s11, s12, s13)
6457

6558
link_status_codes = (200,)
6659

67-
pages_urls_unauth = (f"{Links.URL_MAIN_PAGE}description",
68-
"https://t.me/BrainUpUsers",
69-
f"{Links.URL_MAIN_PAGE}registration",
70-
f"{Links.URL_MAIN_PAGE}contact",
71-
f"{Links.URL_MAIN_PAGE}specialists",
72-
f"{Links.URL_MAIN_PAGE}contributors",
73-
f"{Links.URL_MAIN_PAGE}used-resources",
74-
"https://opencollective.com/brainup",
75-
"https://github.com/Brain-up/brn",
76-
f"{Links.URL_MAIN_PAGE}")
77-
78-
pages_urls_auth = (f"{Links.URL_MAIN_PAGE}groups?locale=ru-ru",
79-
f"{Links.URL_MAIN_PAGE}groups?locale=en-us",
80-
f"{Links.URL_MAIN_PAGE}profile/statistics",
81-
f"{Links.URL_MAIN_PAGE}description",
82-
"https://t.me/BrainUpUsers",
83-
f"{Links.URL_MAIN_PAGE}profile",
84-
f"{Links.URL_MAIN_PAGE}contact",
85-
f"{Links.URL_MAIN_PAGE}specialists",
86-
f"{Links.URL_MAIN_PAGE}contributors",
87-
f"{Links.URL_MAIN_PAGE}used-resources",
88-
"https://opencollective.com/brainup",
89-
"https://github.com/Brain-up/brn",
90-
f"{Links.URL_MAIN_PAGE}")
91-
9260
icons_xmlns = ("http://www.w3.org/2000/svg",)
9361
logo_image_xmlns = "http://www.w3.org/2000/svg"
9462

95-
profile_avatar_src = f"{Links.URL_MAIN_PAGE}pictures/avatars/avatar%201.png"
63+
profile_avatar_src = f"{s}pictures/avatars/avatar%201.png"
9664
profile_avatar_alt = "user avatar"

tests/header_test.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Auto tests for verifying web elements in the Header of the site"""
22
import allure
3-
import pytest
43
from pages.header_page import HeaderPage as hPage
54
from test_data.header_data import HeaderData as hPD
65

@@ -111,7 +110,7 @@ def test_hpu_03_01_verify_unauth_header_links(self, driver, main_page_open):
111110
assert tg_link_title, "The link title value is empty"
112111
assert tg_link_title in hPD.link_titles, "The link title mismatches the valid value"
113112
assert links_href, "Links href are empty"
114-
assert all(element in hPD.links_href_unauth for element in links_href), \
113+
assert all(element in hPD.set_unauth for element in links_href), \
115114
"Attributes 'href' of links mismatch valid values"
116115
assert all(element in hPD.link_status_codes for element in link_status_codes), \
117116
"Status codes of links mismatch valid values"
@@ -123,7 +122,7 @@ def test_hpu_03_02_verify_unauth_internal_links_lead_to_correct_pages(self, driv
123122
internal_links_in_more = page.get_list_of_internal_links_in_more()
124123
opened_pages = page.click_on_internal_links_in_header_unauth()
125124
assert internal_links_in_more, "Internal links are not collected in the list"
126-
assert all(element in hPD.pages_urls_unauth for element in opened_pages), \
125+
assert all(element in hPD.set_unauth for element in opened_pages), \
127126
"Some of internal links lead to incorrect pages after clicking"
128127

129128
@allure.title("""Verify if external links in the Header for an unauthorized user
@@ -133,7 +132,7 @@ def test_hpu_03_03_verify_unauth_external_links_lead_to_correct_pages(self, driv
133132
external_links_in_more = page.get_list_of_external_links_in_more()
134133
opened_pages = page.click_on_external_links_in_header()
135134
assert external_links_in_more, "External links are not collected in the list"
136-
assert all(element in hPD.pages_urls_unauth for element in opened_pages), \
135+
assert all(element in hPD.set_unauth for element in opened_pages), \
137136
"Some of external links lead to incorrect pages after clicking"
138137

139138
@allure.title("""Verify that the 'Logo' link on the Start Unauthorized Page
@@ -302,8 +301,7 @@ def test_hpa_03_01_verify_auth_header_links(self, driver, auto_test_user_authori
302301
link_status_codes = page.get_links_status_codes_auth()
303302
assert links_clickability, "Links are unclickable"
304303
assert links_href, "Links href are empty"
305-
assert all(element in hPD.links_href_auth for element in links_href), \
306-
"Attributes 'href' of links mismatch valid values"
304+
assert all(element in hPD.set_auth for element in links_href), "Links href mismatch valid values"
307305
assert all(element in hPD.link_status_codes for element in link_status_codes), \
308306
"Status codes of links mismatch valid values"
309307

@@ -314,7 +312,7 @@ def test_hpa_03_02_verify_auth_internal_links_lead_to_proper_pages(self, driver,
314312
internal_links_in_more = page.get_list_of_internal_links_in_more()
315313
opened_pages = page.click_on_internal_links_in_header_auth()
316314
assert internal_links_in_more, "Internal links are not collected in the list"
317-
assert all(element in hPD.pages_urls_auth for element in opened_pages), \
315+
assert all(element in hPD.set_auth for element in opened_pages), \
318316
"Some of internal links lead to incorrect pages after clicking"
319317

320318
@allure.title("""Verify if external links in the Header for an authorized user
@@ -324,7 +322,7 @@ def test_hpa_03_03_verify_auth_external_links_lead_to_proper_pages(self, driver,
324322
external_links_in_more = page.get_list_of_external_links_in_more()
325323
opened_pages = page.click_on_external_links_in_header()
326324
assert external_links_in_more, "External links are not collected in the list"
327-
assert all(element in hPD.pages_urls_auth for element in opened_pages), \
325+
assert all(element in hPD.set_auth for element in opened_pages), \
328326
"Some of external links lead to incorrect pages after clicking"
329327

330328
@allure.title("""Verify that the Logo link on the Start Authorized Page

0 commit comments

Comments
 (0)