1
1
"""Auto tests for verifying web elements on the starting page for unauthorized users"""
2
2
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
5
5
from test_data .login_page_data import LoginPageData
6
6
7
7
8
8
@allure .epic ("The Start Unauthorized Page" )
9
9
class TestStartUnauthorizedPage :
10
- class TestStartUnauthorizedPageStructure :
10
+ class TestStUnPageStructure :
11
11
12
12
@allure .title ("Verify presence and visibility of content on the page" )
13
13
def test_su_01_01_verify_page_presence_and_visibility (self , driver , main_page_open ):
14
- page = StartUnauthorizedPage (driver )
14
+ page = suPage (driver )
15
15
page_content_presence = page .check_presence_of_page_content ()
16
16
page_content_visibility = page .check_visibility_of_page_content ()
17
17
assert page_content_presence , "The page content is absent in DOM"
18
18
assert page_content_visibility , "The page content is invisible on the page"
19
19
20
20
@allure .title ("Verify amount and visibility of sections with content on the page" )
21
21
def test_su_01_02_verify_sections_structure_and_visibility (self , driver , main_page_open ):
22
- page = StartUnauthorizedPage (driver )
22
+ page = suPage (driver )
23
23
sections_amount = page .get_amount_of_sections_on_page ()
24
24
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 , \
26
26
"The amount of sections with content mismatches the valid value"
27
27
assert sections_visibility , "Sections with content are invisible"
28
28
29
29
@allure .title ("""Verify the composition and visibility of elements
30
30
on the 1st-3rd levels of nesting in the section 1""" )
31
31
def test_su_01_03_verify_section1_structure_and_visibility (self , driver , main_page_open ):
32
- page = StartUnauthorizedPage (driver )
32
+ page = suPage (driver )
33
33
structure_of_1st_level = page .get_structure_of_1st_level_in_section1 ()
34
34
visibility_of_elements_on_1st_level = page .check_elements_visibility_on_1st_level_in_section1 ()
35
35
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
46
46
@allure .title ("""Verify the composition and visibility of elements
47
47
on the 1st-3rd levels of nesting in the section 2""" )
48
48
def test_su_01_04_verify_section2_structure_and_visibility (self , driver , main_page_open ):
49
- page = StartUnauthorizedPage (driver )
49
+ page = suPage (driver )
50
50
structure_of_1st_level = page .get_structure_of_1st_level_in_section2 ()
51
51
visibility_of_elements_on_1st_level = page .check_elements_visibility_on_1st_level_in_section2 ()
52
52
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
60
60
assert structure_of_3rd_level , "Elements on the 3rd level are absent in the section 2"
61
61
assert visibility_of_elements_on_3rd_level , "3rd-level elements are invisible"
62
62
63
- class TestStartUnauthorizedPageText :
63
+ class TestStUnPageText :
64
64
@allure .title ("Verify value of the title of the tab" )
65
65
def test_su_02_01_verify_tab_title (self , driver , main_page_open ):
66
- page = StartUnauthorizedPage (driver )
66
+ page = suPage (driver )
67
67
tab_title_value = page .get_value_of_tab_title ()
68
68
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"
71
70
72
71
@allure .title ("Verify values of titles and subtitles with tags h2, h4 on the page" )
73
72
def test_su_02_02_verify_page_titles_and_subtitles (self , driver , main_page_open ):
74
- page = StartUnauthorizedPage (driver )
73
+ page = suPage (driver )
75
74
title_values = page .get_values_of_titles ()
76
75
subtitle_values = page .get_values_of_subtitles ()
77
76
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 ), \
79
78
"Titles on the page mismatch any valid values"
80
79
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 ), \
82
81
"Subtitles mismatch any valid values"
83
82
84
83
@allure .title ("Verify content of the text in sections 1, 2" )
85
84
def test_su_02_03_verify_page_text (self , driver , main_page_open ):
86
- page = StartUnauthorizedPage (driver )
85
+ page = suPage (driver )
87
86
text_content_section1 = page .get_text_content_in_section1 ()
88
87
text_content_section2 = page .get_text_content_in_section2 ()
89
88
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" ], \
91
90
"Text in the section 1 mismatches any valid values"
92
91
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" ]
94
93
for element in text_content_section2 ), "Text in the section 2 mismatches any valid values"
95
94
96
95
@allure .title ("Verify text in the 'Login' link in the section 1" )
97
96
def test_su_02_04_verify_text_in_links (self , driver , main_page_open ):
98
- page = StartUnauthorizedPage (driver )
97
+ page = suPage (driver )
99
98
link_text = page .get_text_in_login_link ()
100
99
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"
102
101
103
- class TestStartUnauthorizedPageLinks :
102
+ class TestStUnPageLinks :
104
103
@allure .title ("""Verify presence, visibility, clickability, href, status code
105
104
of the 'Login' link in the section 1""" )
106
105
def test_su_03_01_verify_login_link (self , driver , main_page_open ):
107
- page = StartUnauthorizedPage (driver )
106
+ page = suPage (driver )
108
107
link_presence = page .check_login_link_presence ()
109
108
link_visibility = page .check_login_link_visibility ()
110
109
link_clickability = page .check_login_link_clickability ()
@@ -114,39 +113,35 @@ def test_su_03_01_verify_login_link(self, driver, main_page_open):
114
113
assert link_visibility , "The 'Login' link is invisible"
115
114
assert link_clickability , "The 'Login' link is unclickable"
116
115
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"
121
118
122
119
@allure .title ("Verify that the 'Login' link leads to the correct page after clicking" )
123
120
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 )
125
122
page .click_login_link ()
126
123
text_on_opened_page = page .get_element_text_on_opened_login_page ()
127
124
assert text_on_opened_page in LoginPageData .sign_in_tab , \
128
125
"The 'Login' link leads to an incorrect page after clicking or opened page does not load correctly"
129
126
130
- class TestStartUnauthorizedPageImage :
127
+ class TestStUnPageImage :
131
128
@allure .title ("Verify presence, visibility and attributes of the image in the section 1" )
132
129
def test_su_04_01_verify_image_in_section1 (self , driver , main_page_open ):
133
- page = StartUnauthorizedPage (driver )
130
+ page = suPage (driver )
134
131
image_presence = page .check_image_presence ()
135
132
image_visibility = page .check_image_visibility ()
136
133
image_src = page .get_src_of_image ()
137
134
image_alt = page .get_alt_of_image ()
138
135
assert image_presence , "The image is absent in the section 1"
139
136
assert image_visibility , "The image is invisible in the section 1"
140
137
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"
146
141
147
142
@allure .title ("Verify size of the image in the section 1" )
148
143
def test_su_04_02_verify_image_size_in_section1 (self , driver , main_page_open ):
149
- page = StartUnauthorizedPage (driver )
144
+ page = suPage (driver )
150
145
image_size = page .get_size_of_image ()
151
146
image_size_changes = page .check_size_changes_of_image ()
152
147
assert image_size != 0 , "The image in the section 1 hasn't sizes"
0 commit comments