Skip to content

Commit ecb97f7

Browse files
update start_unauthorized_page_test.py
1 parent 70e3c3d commit ecb97f7

File tree

1 file changed

+30
-35
lines changed

1 file changed

+30
-35
lines changed

tests/start_unauthorized_page_test.py

+30-35
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
"""Auto tests for verifying web elements on the starting page for unauthorized users"""
22
import allure
3-
from pages.start_unauthorized_page import StartUnauthorizedPage
4-
from test_data.start_unauthorized_page_data import StartUnauthorizedPageData
3+
from pages.start_unauthorized_page import StartUnauthorizedPage as suPage
4+
from test_data.start_unauthorized_page_data import StartUnauthorizedPageData as suPD
55
from test_data.login_page_data import LoginPageData
66

77

88
@allure.epic("The Start Unauthorized Page")
99
class TestStartUnauthorizedPage:
10-
class TestStartUnauthorizedPageStructure:
10+
class TestStUnPageStructure:
1111

1212
@allure.title("Verify presence and visibility of content on the page")
1313
def test_su_01_01_verify_page_presence_and_visibility(self, driver, main_page_open):
14-
page = StartUnauthorizedPage(driver)
14+
page = suPage(driver)
1515
page_content_presence = page.check_presence_of_page_content()
1616
page_content_visibility = page.check_visibility_of_page_content()
1717
assert page_content_presence, "The page content is absent in DOM"
1818
assert page_content_visibility, "The page content is invisible on the page"
1919

2020
@allure.title("Verify amount and visibility of sections with content on the page")
2121
def test_su_01_02_verify_sections_structure_and_visibility(self, driver, main_page_open):
22-
page = StartUnauthorizedPage(driver)
22+
page = suPage(driver)
2323
sections_amount = page.get_amount_of_sections_on_page()
2424
sections_visibility = page.check_visibility_of_sections()
25-
assert sections_amount == StartUnauthorizedPageData.amount_of_sections_with_content_on_page, \
25+
assert sections_amount == suPD.amount_of_sections_with_content_on_page, \
2626
"The amount of sections with content mismatches the valid value"
2727
assert sections_visibility, "Sections with content are invisible"
2828

2929
@allure.title("""Verify the composition and visibility of elements
3030
on the 1st-3rd levels of nesting in the section 1""")
3131
def test_su_01_03_verify_section1_structure_and_visibility(self, driver, main_page_open):
32-
page = StartUnauthorizedPage(driver)
32+
page = suPage(driver)
3333
structure_of_1st_level = page.get_structure_of_1st_level_in_section1()
3434
visibility_of_elements_on_1st_level = page.check_elements_visibility_on_1st_level_in_section1()
3535
structure_of_2nd_level = page.get_structure_of_2nd_level_in_section1()
@@ -46,7 +46,7 @@ def test_su_01_03_verify_section1_structure_and_visibility(self, driver, main_pa
4646
@allure.title("""Verify the composition and visibility of elements
4747
on the 1st-3rd levels of nesting in the section 2""")
4848
def test_su_01_04_verify_section2_structure_and_visibility(self, driver, main_page_open):
49-
page = StartUnauthorizedPage(driver)
49+
page = suPage(driver)
5050
structure_of_1st_level = page.get_structure_of_1st_level_in_section2()
5151
visibility_of_elements_on_1st_level = page.check_elements_visibility_on_1st_level_in_section2()
5252
structure_of_2nd_level = page.get_structure_of_2nd_level_in_section2()
@@ -60,51 +60,50 @@ def test_su_01_04_verify_section2_structure_and_visibility(self, driver, main_pa
6060
assert structure_of_3rd_level, "Elements on the 3rd level are absent in the section 2"
6161
assert visibility_of_elements_on_3rd_level, "3rd-level elements are invisible"
6262

63-
class TestStartUnauthorizedPageText:
63+
class TestStUnPageText:
6464
@allure.title("Verify value of the title of the tab")
6565
def test_su_02_01_verify_tab_title(self, driver, main_page_open):
66-
page = StartUnauthorizedPage(driver)
66+
page = suPage(driver)
6767
tab_title_value = page.get_value_of_tab_title()
6868
assert tab_title_value, "The title value of the tab is empty"
69-
assert tab_title_value == StartUnauthorizedPageData.tab_title, \
70-
"The title value of the tab mismatches the valid value"
69+
assert tab_title_value == suPD.tab_title, "The title value of the tab mismatches the valid value"
7170

7271
@allure.title("Verify values of titles and subtitles with tags h2, h4 on the page")
7372
def test_su_02_02_verify_page_titles_and_subtitles(self, driver, main_page_open):
74-
page = StartUnauthorizedPage(driver)
73+
page = suPage(driver)
7574
title_values = page.get_values_of_titles()
7675
subtitle_values = page.get_values_of_subtitles()
7776
assert title_values, "Title values on the page are empty"
78-
assert all(element in StartUnauthorizedPageData.page_titles for element in title_values), \
77+
assert all(element in suPD.page_titles for element in title_values), \
7978
"Titles on the page mismatch any valid values"
8079
assert subtitle_values, "Subtitle values on the page are empty"
81-
assert all(element in StartUnauthorizedPageData.page_subtitles for element in subtitle_values), \
80+
assert all(element in suPD.page_subtitles for element in subtitle_values), \
8281
"Subtitles mismatch any valid values"
8382

8483
@allure.title("Verify content of the text in sections 1, 2")
8584
def test_su_02_03_verify_page_text(self, driver, main_page_open):
86-
page = StartUnauthorizedPage(driver)
85+
page = suPage(driver)
8786
text_content_section1 = page.get_text_content_in_section1()
8887
text_content_section2 = page.get_text_content_in_section2()
8988
assert text_content_section1, "Text content in the section 1 is empty"
90-
assert text_content_section1 in StartUnauthorizedPageData.text_on_page["text_in_section1"], \
89+
assert text_content_section1 in suPD.text_on_page["text_in_section1"], \
9190
"Text in the section 1 mismatches any valid values"
9291
assert text_content_section2, "The text content in the section 2 is empty"
93-
assert all(element in StartUnauthorizedPageData.text_on_page["text_in_section2"]
92+
assert all(element in suPD.text_on_page["text_in_section2"]
9493
for element in text_content_section2), "Text in the section 2 mismatches any valid values"
9594

9695
@allure.title("Verify text in the 'Login' link in the section 1")
9796
def test_su_02_04_verify_text_in_links(self, driver, main_page_open):
98-
page = StartUnauthorizedPage(driver)
97+
page = suPage(driver)
9998
link_text = page.get_text_in_login_link()
10099
assert link_text, "Text in the link is empty"
101-
assert link_text in StartUnauthorizedPageData.login_link_text, "Text in the link mismatches the valid value"
100+
assert link_text in suPD.login_link_text, "Text in the link mismatches the valid value"
102101

103-
class TestStartUnauthorizedPageLinks:
102+
class TestStUnPageLinks:
104103
@allure.title("""Verify presence, visibility, clickability, href, status code
105104
of the 'Login' link in the section 1""")
106105
def test_su_03_01_verify_login_link(self, driver, main_page_open):
107-
page = StartUnauthorizedPage(driver)
106+
page = suPage(driver)
108107
link_presence = page.check_login_link_presence()
109108
link_visibility = page.check_login_link_visibility()
110109
link_clickability = page.check_login_link_clickability()
@@ -114,39 +113,35 @@ def test_su_03_01_verify_login_link(self, driver, main_page_open):
114113
assert link_visibility, "The 'Login' link is invisible"
115114
assert link_clickability, "The 'Login' link is unclickable"
116115
assert link_href, "Link href is empty"
117-
assert link_href == StartUnauthorizedPageData.login_link_href, \
118-
"The attribute 'href' of the link mismatches the valid value"
119-
assert link_status_code in StartUnauthorizedPageData.login_link_status_code, \
120-
"The status code of the link mismatches the valid value"
116+
assert link_href == suPD.login_link_href, "The attribute 'href' of the link mismatches the valid value"
117+
assert link_status_code in suPD.login_link_status_code, "The link status code mismatches the valid value"
121118

122119
@allure.title("Verify that the 'Login' link leads to the correct page after clicking")
123120
def test_su_03_02_verify_login_link_leads_to_the_correct_page(self, driver, main_page_open):
124-
page = StartUnauthorizedPage(driver)
121+
page = suPage(driver)
125122
page.click_login_link()
126123
text_on_opened_page = page.get_element_text_on_opened_login_page()
127124
assert text_on_opened_page in LoginPageData.sign_in_tab, \
128125
"The 'Login' link leads to an incorrect page after clicking or opened page does not load correctly"
129126

130-
class TestStartUnauthorizedPageImage:
127+
class TestStUnPageImage:
131128
@allure.title("Verify presence, visibility and attributes of the image in the section 1")
132129
def test_su_04_01_verify_image_in_section1(self, driver, main_page_open):
133-
page = StartUnauthorizedPage(driver)
130+
page = suPage(driver)
134131
image_presence = page.check_image_presence()
135132
image_visibility = page.check_image_visibility()
136133
image_src = page.get_src_of_image()
137134
image_alt = page.get_alt_of_image()
138135
assert image_presence, "The image is absent in the section 1"
139136
assert image_visibility, "The image is invisible in the section 1"
140137
assert image_src, "The 'src' attribute value of the image is empty"
141-
assert StartUnauthorizedPageData.image_src_in_section1 in image_src, \
142-
"The 'src' attribute value of the image in the section 1 mismatches the valid value"
143-
assert image_alt, "The 'alt' attribute value of the image is empty"
144-
assert image_alt == StartUnauthorizedPageData.image_alt_in_section1, \
145-
"The 'alt' attribute value of the image in the section 1 mismatches the valid value"
138+
assert suPD.image_src_in_section1 in image_src, "The image 'src' attribute mismatches the valid value"
139+
assert image_alt, "The image 'alt' attribute is empty"
140+
assert image_alt == suPD.image_alt_in_section1, "The image 'alt' attribute mismatches the valid value"
146141

147142
@allure.title("Verify size of the image in the section 1")
148143
def test_su_04_02_verify_image_size_in_section1(self, driver, main_page_open):
149-
page = StartUnauthorizedPage(driver)
144+
page = suPage(driver)
150145
image_size = page.get_size_of_image()
151146
image_size_changes = page.check_size_changes_of_image()
152147
assert image_size != 0, "The image in the section 1 hasn't sizes"

0 commit comments

Comments
 (0)