1
1
"""Auto tests for verifying web elements on the 'Specialists' page"""
2
2
import allure
3
- from pages .specialists_page import SpecialistsPage
4
- from test_data .specialists_page_data import SpecialistsPageData
5
- from test_data .start_unauthorized_page_data import StartUnauthorizedPageData
3
+ from pages .specialists_page import SpecialistsPage as sPage
4
+ from test_data .specialists_page_data import SpecialistsPageData as sPD
5
+ from test_data .start_unauthorized_page_data import StartUnauthorizedPageData as suPD
6
6
7
7
8
8
# @pytest.mark.skip(reason="unsupported preconditions")
@@ -11,7 +11,7 @@ class TestSpecialistsPage:
11
11
class TestSpecialistsPageStructure :
12
12
@allure .title ("Verify presence and visibility of content on the page" )
13
13
def test_sp_01_01_verify_page_presence_and_visibility (self , driver , specialists_page_open ):
14
- page = SpecialistsPage (driver )
14
+ page = sPage (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"
@@ -20,7 +20,7 @@ def test_sp_01_01_verify_page_presence_and_visibility(self, driver, specialists_
20
20
@allure .title ("""Verify the composition and visibility of elements
21
21
on the 1st-6th levels of nesting on the page""" )
22
22
def test_sp_01_02_verify_page_structure_and_visibility (self , driver , specialists_page_open ):
23
- page = SpecialistsPage (driver )
23
+ page = sPage (driver )
24
24
structure_of_1st_level = page .get_structure_of_1st_level ()
25
25
visibility_of_elements_on_1st_level = page .check_elements_visibility_on_1st_level_on_page ()
26
26
structure_of_2nd_level = page .get_structure_of_2nd_level ()
@@ -47,15 +47,15 @@ def test_sp_01_02_verify_page_structure_and_visibility(self, driver, specialists
47
47
@allure .title ("""Verify presence, visibility of the title, text, link, grid, cards and images
48
48
on the 2nd, 3rd, 5th, 6th levels of nesting on the page""" )
49
49
def test_sp_01_03_verify_page_structural_elements (self , driver , specialists_page_open ):
50
- page = SpecialistsPage (driver )
50
+ page = sPage (driver )
51
51
title_on_2nd_level = page .check_title_presence ()
52
52
title_visibility = page .check_title_visibility ()
53
53
text_on_2nd_level = page .check_text_presence ()
54
54
text_visibility = page .check_text_visibility ()
55
55
grid_on_2nd_level = page .check_grid_presence ()
56
56
grid_visibility = page .check_grid_visibility ()
57
- link_on_3rd_level = page .check_all_specialists_link_presence ()
58
- link_visibility = page .check_all_specialists_link_visibility ()
57
+ link_on_3rd_level = page .check_all_spec_link_presence ()
58
+ link_visibility = page .check_all_spec_link_visibility ()
59
59
cards_on_3rd_level = page .get_list_of_cards ()
60
60
cards_visibility = page .check_cards_visibility ()
61
61
images_on_5th_level = page .get_list_of_card_images ()
@@ -84,101 +84,91 @@ def test_sp_01_03_verify_page_structural_elements(self, driver, specialists_page
84
84
class TestSpecialistPageText :
85
85
@allure .title ("Verify value of the title of the tab" )
86
86
def test_sp_02_01_verify_tab_title (self , driver , specialists_page_open ):
87
- page = SpecialistsPage (driver )
87
+ page = sPage (driver )
88
88
tab_title_value = page .get_value_of_tab_title ()
89
89
assert tab_title_value , "The title value of the tab is empty"
90
- assert tab_title_value in SpecialistsPageData .tab_title , \
91
- "The title value of the tab mismatches the valid value"
90
+ assert tab_title_value in sPD .tab_title , "The title value of the tab mismatches the valid value"
92
91
93
92
@allure .title ("Verify value of title with tag 'h2' on the page" )
94
93
def test_sp_02_02_verify_page_title (self , driver , specialists_page_open ):
95
- page = SpecialistsPage (driver )
94
+ page = sPage (driver )
96
95
title_value = page .get_value_of_page_title ()
97
96
assert title_value , "The title value on the page is empty"
98
- assert title_value in SpecialistsPageData .page_title , "The title on the page mismatches the valid value"
97
+ assert title_value in sPD .page_title , "The title on the page mismatches the valid value"
99
98
100
99
@allure .title ("Verify value of text on the page" )
101
100
def test_sp_02_03_verify_page_text (self , driver , specialists_page_open ):
102
- page = SpecialistsPage (driver )
101
+ page = sPage (driver )
103
102
text_content = page .get_text_content_on_page ()
104
103
assert text_content , "Text content on the page is empty"
105
- assert text_content in SpecialistsPageData .text_on_page , "Text content mismatches the valid value"
104
+ assert text_content in sPD .text_on_page , "Text content mismatches the valid value"
106
105
107
106
@allure .title ("Verify values of names and professions in specialist cards in the grid" )
108
107
def test_sp_02_04_verify_name_and_profession_in_cards (self , driver , specialists_page_open ):
109
- page = SpecialistsPage (driver )
108
+ page = sPage (driver )
110
109
name_values = page .get_name_values_in_cards ()
111
110
profession_values = page .get_profession_values_in_cards ()
112
111
assert name_values , "Name values in cards are empty"
113
- assert all (element in SpecialistsPageData .specialists_names for element in name_values ), \
114
- "Names in specialist cards mismatch valid values"
112
+ assert all (element in sPD .spec_names for element in name_values ), "Names in cards mismatch valid values"
115
113
assert profession_values , "Profession values in cards are empty"
116
- assert all (element in SpecialistsPageData . specialists_professions for element in profession_values ), \
117
- "Professions in specialist cards mismatch valid values"
114
+ assert all (element in sPD . spec_professions for element in profession_values ), \
115
+ "Professions in cards mismatch valid values"
118
116
119
117
@allure .title ("Verify text in the 'All Specialists' link" )
120
118
def test_sp_02_05_verify_text_in_link (self , driver , specialists_page_open ):
121
- page = SpecialistsPage (driver )
122
- link_text = page .get_text_in_all_specialists_link ()
119
+ page = sPage (driver )
120
+ link_text = page .get_text_in_all_spec_link ()
123
121
assert link_text , "Text in the 'All Specialists' link is empty"
124
- assert link_text in SpecialistsPageData .all_specialists_link_text , \
125
- f"Text in the 'All Specialists' link mismatches any valid values"
122
+ assert link_text in sPD .all_spec_link_text , "Text in the 'All Specialists' link mismatches any valid values"
126
123
127
124
class TestSpecialistPageLinks :
128
125
@allure .title ("Verify clickability, href, status code of the 'All Specialists' link" )
129
- def test_sp_03_01_verify_all_specialists_link (self , driver , specialists_page_open ):
130
- page = SpecialistsPage (driver )
131
- link_clickability = page .check_all_specialists_link_clickability ()
132
- link_href = page .get_all_specialists_link_href ()
133
- link_status_code = page .get_all_specialists_link_status_code ()
126
+ def test_sp_03_01_verify_all_spec_link (self , driver , specialists_page_open ):
127
+ page = sPage (driver )
128
+ link_clickability = page .check_all_spec_link_clickability ()
129
+ link_href = page .get_all_spec_link_href ()
130
+ link_status_code = page .get_all_spec_link_status_code ()
134
131
assert link_clickability , "The 'All Specialists' link is unclickable"
135
132
assert link_href , "Link href is empty"
136
- assert link_href == SpecialistsPageData .all_specialists_link_href , \
137
- "The attribute 'href' of the link mismatches the valid value"
138
- assert link_status_code in SpecialistsPageData .all_specialists_link_status_code , \
139
- "The status code of the link mismatches the valid value"
133
+ assert link_href in sPD .all_spec_link_href , "The attribute 'href' of the link mismatches the valid value"
134
+ assert link_status_code in sPD .all_spec_link_status_code , "The link status code mismatches the valid value"
140
135
141
136
@allure .title ("""Verify that the 'All Specialists' link leads an unauthorized user
142
137
to the correct page after clicking""" )
143
- def test_sp_03_02_verify_all_specialists_link_leads_unauthorized_user_to_the_correct_page (
144
- self , driver , specialists_page_open ):
145
- page = SpecialistsPage (driver )
146
- new_tab_url = page .click_all_specialists_link ()
138
+ def test_sp_03_02_verify_all_spec_link_navigation_for_unauthorized_user (self , driver , specialists_page_open ):
139
+ page = sPage (driver )
140
+ new_tab_url = page .click_all_spec_link ()
147
141
text_on_new_tab = page .get_element_text_on_new_tab ()
148
- assert new_tab_url == StartUnauthorizedPageData .page_url , \
149
- "The 'All Specialists' link leads to an incorrect page after clicking"
150
- assert text_on_new_tab in StartUnauthorizedPageData .text_on_page ["text_in_section1" ], \
151
- "The opened page does not load correctly after clicking on the 'All Specialists' link"
142
+ assert new_tab_url == suPD .page_url , "The link leads to an incorrect page after clicking"
143
+ assert text_on_new_tab in suPD .text_on_page ["text_in_section1" ], \
144
+ "The opened page does not load correctly after clicking on the link"
152
145
153
146
@allure .title ("""Verify that the 'All Specialists' link leads an authorized user
154
147
to the correct page after clicking""" )
155
- def test_sp_03_03_verify_all_specialists_link_leads_authorized_user_to_the_correct_page (
156
- self , driver , auto_test_user_authorized ):
157
- page = SpecialistsPage (driver )
148
+ def test_sp_03_03_verify_all_spec_link_navigation_for_authorized_user (self , driver , auto_test_user_authorized ):
149
+ page = sPage (driver )
158
150
page .open_specialists_page ()
159
- new_tab_url = page .click_all_specialists_link ()
151
+ new_tab_url = page .click_all_spec_link ()
160
152
text_on_new_tab = page .get_value_of_page_title ()
161
- assert new_tab_url == SpecialistsPageData .page_url , \
162
- "The 'All Specialists' link leads to an incorrect page after clicking"
163
- assert text_on_new_tab in SpecialistsPageData .page_title , \
164
- "The opened page does not load correctly after clicking on the 'All Specialists' link"
153
+ assert new_tab_url == sPD .page_url , "The link leads to an invalid page after clicking"
154
+ assert text_on_new_tab in sPD .page_title , "The opened page does not load correctly after clicking the link"
165
155
166
156
class TestSpecialistCardImages :
167
157
@allure .title ("Verify attributes of images in specialist cards in the grid" )
168
158
def test_sp_04_01_verify_images_attributes_in_cards (self , driver , specialists_page_open ):
169
- page = SpecialistsPage (driver )
159
+ page = sPage (driver )
170
160
images_src = page .get_images_src ()
171
161
images_alt = page .get_images_alt ()
172
162
assert images_src , "The 'src' attribute value of some card images is empty"
173
- assert all (element in SpecialistsPageData .images_src for element in images_src ), \
163
+ assert all (element in sPD .images_src for element in images_src ), \
174
164
"The 'src' attribute of the card images mismatches valid values"
175
165
assert images_alt , "The 'alt' attribute value of some card images is empty"
176
- assert all (element == SpecialistsPageData .images_alt for element in images_alt ), \
166
+ assert all (element == sPD .images_alt for element in images_alt ), \
177
167
"The 'alt' attribute value of some card images is empty or mismatches valid values"
178
168
179
169
@allure .title ("Verify sizes of images in specialist cards in the grid" )
180
170
def test_sp_04_02_verify_images_sizes_in_cards (self , driver , specialists_page_open ):
181
- page = SpecialistsPage (driver )
171
+ page = sPage (driver )
182
172
images_size = page .get_images_sizes ()
183
173
images_size_changed = page .check_size_changes_of_images ()
184
174
assert images_size != 0 , "Images in specialist cards have not sizes"
0 commit comments