Skip to content

Commit 71844fe

Browse files
ref test_hpu.01.03 Verify lists of links in the Header's dropdown for an unauthorized user
update header_test.py, header_page.py, header_page_locators.py #268
1 parent 46720c1 commit 71844fe

3 files changed

Lines changed: 34 additions & 19 deletions

File tree

‎locators/header_page_locators.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55

66
class HeaderUnauthorizedLocators:
7+
DROPDOWN_LINKS_UNAUTH = (By.XPATH, "//div[contains(@class, 'bottom')]/a")
78
HEADER_BUTTONS = (By.XPATH, "//button")
89
HEADER_CONTENT = (By.XPATH, "//div[contains(@class, 'header')]")
910
HEADER_LINKS_UNAUTH = (By.XPATH, "//nav//a")
@@ -23,7 +24,7 @@ class HeaderUnauthorizedLocators:
2324
LINK_SPECIALISTS = (By.XPATH, "(//nav//a)[7]")
2425
LINK_TELEGRAM = (By.XPATH, '//a[@href="https://t.me/BrainUpUsers"]')
2526
LINK_USED_RESOURCES = (By.XPATH, "(//nav//a)[9]")
26-
LINKS_IN_MORE = (By.XPATH, "//div[contains(@class, 'bottom')]/a")
27+
LINKS_IN_MORE = (By.XPATH, "//div[contains(@class, 'bottom')]/a") # to be deleted after refactoring
2728
# LINK_ABOUT = (By.XPATH, "//div[contains(@class, 'text-s')]/a[1]")
2829
# LINK_CONTACTS = (By.XPATH, "//div[contains(@class, 'bottom')]/a[3]")
2930
# LINK_CONTRIBUTORS = (By.XPATH, "//div[contains(@class, 'bottom')]/a[5]")

‎pages/header_page.py‎

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,36 @@ def get_direct_links_unauth_list(self):
8585
for i in [1, 2, 9, 0]:
8686
direct_links.append(links[i])
8787
att1 = [element.get_attribute("href") for element in direct_links]
88-
print(*att1, len(att1), sep='\n')
88+
# print(*att1, len(att1), sep='\n')
8989
return direct_links
9090

91+
@allure.step("""Get the list of links in the 'More' dropdown in the Header for an UNAUTHORIZED user -- ACTUAL""")
92+
def get_dropdown_links_unauth_list(self):
93+
dropdown_unauth_links = self.elements_are_present(self.locators.DROPDOWN_LINKS_UNAUTH)
94+
att1 = [element.get_attribute("href") for element in dropdown_unauth_links]
95+
print(*att1, len(att1), sep='\n')
96+
return dropdown_unauth_links
97+
98+
99+
100+
@allure.step("""Check the 'About', 'Telegram', 'Registration', 'Logo' links are visible for an unauthorized user
101+
-- ACTUAL""")
102+
def check_direct_links_visibility_unauth(self):
103+
return all(link.is_displayed() for link in self.get_direct_links_unauth_list())
104+
105+
@allure.step("""Check the 'Donate', 'GitHub', 'Contacts', 'Specialists', 'Contributors', 'Used Resources' links
106+
in the 'More' dropdown are invisible for every user -- FOR REVIEW""")
107+
def check_links_invisibility_in_more(self):
108+
return all(self.element_is_not_visible(element) for element in self.get_list_of_links_in_more())
109+
110+
@allure.step("""Check the 'Donate', 'GitHub', 'Contacts', 'Specialists', 'Contributors', 'Used Resources' links
111+
in the 'More' dropdown are visible for every user -- FOR REVIEW""")
112+
def check_links_visibility_in_more(self):
113+
self.click_more_button()
114+
return all(link.is_displayed() for link in self.get_list_of_links_in_more())
115+
116+
117+
91118

92119
# Lists of links for an AUTHORIZED user
93120

@@ -155,10 +182,6 @@ def get_dropdown_external_links_auth_list(self):
155182
return links
156183

157184

158-
@allure.step("Check the 'About', 'Telegram', 'Registration', 'Logo' links are visible for an unauthorized user")
159-
def check_direct_links_visibility_unauth(self):
160-
return all(link.is_displayed() for link in self.get_direct_links_unauth_list())
161-
162185
@allure.step("""Check the 'Groups', 'Statistics', 'About', 'Telegram', 'Registration', 'Logo' links are visible "
163186
for an authorized user""")
164187
def check_direct_links_visibility_auth(self):
@@ -178,16 +201,6 @@ def get_list_of_links_in_more1(self):
178201
def get_list_of_links_in_more(self):
179202
return self.elements_are_present(self.locators.LINKS_IN_MORE)
180203

181-
@allure.step("""Check the 'Donate', 'GitHub', 'Contacts', 'Specialists', 'Contributors', 'Used Resources' links
182-
in the 'More' dropdown are invisible for every user -- FOR REVIEW""")
183-
def check_links_invisibility_in_more(self):
184-
return all(self.element_is_not_visible(element) for element in self.get_list_of_links_in_more())
185-
186-
@allure.step("""Check the 'Donate', 'GitHub', 'Contacts', 'Specialists', 'Contributors', 'Used Resources' links
187-
in the 'More' dropdown are visible for every user -- FOR REVIEW""")
188-
def check_links_visibility_in_more(self):
189-
self.click_more_button()
190-
return all(link.is_displayed() for link in self.get_list_of_links_in_more())
191204

192205
# Lists of links
193206
@allure.step("""Get the list of the 'Contacts', 'Specialists', 'Contributors', 'Used Resources' links "

‎tests/header_test.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,14 @@ def test_hpu_01_02_verify_unauth_header_structure_and_visibility(self, driver, m
4747
assert structure_of_6th_level, "Elements on the 6th level are absent in the Header"
4848
assert invisibility_of_elements_on_6th_level, "6th-level elements are visible"
4949

50-
@allure.title("Verify presence, visibility of links, buttons in the Header for an unauthorized user")
50+
@allure.title("""test_hpu_01.03 Verify presence, visibility of links, buttons in the Header
51+
for an unauthorized user""")
5152
def test_hpu_01_03_verify_unauth_header_structural_elements(self, driver, main_page_open):
5253
page = hPage(driver)
5354
header_links = page.get_list_of_links_unauth()
54-
header_direct_links = page.get_list_of_direct_links_unauth()
55+
header_direct_links = page.get_direct_links_unauth_list()
5556
header_direct_links_visibility = page.check_direct_links_visibility_unauth()
56-
links_in_more_presence = page.get_list_of_links_in_more()
57+
links_in_more_presence = page.get_dropdown_links_unauth_list()
5758
links_in_more_invisibility = page.check_links_invisibility_in_more()
5859
links_in_more_visibility = page.check_links_visibility_in_more()
5960
logo_link_presence = page.check_logo_link_presence()

0 commit comments

Comments
 (0)