generated from NHSDigital/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest_03_import_records.py
More file actions
210 lines (176 loc) · 9.33 KB
/
test_03_import_records.py
File metadata and controls
210 lines (176 loc) · 9.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
import pytest
from libs.generic_constants import fixture_scope
from libs.mavis_constants import child_year_group, test_data_file_paths
from pages import pg_children, pg_dashboard, pg_import_records, pg_login, pg_sessions
class Test_ImportRecords:
login_page = pg_login.pg_login()
dashboard_page = pg_dashboard.pg_dashboard()
import_records_page = pg_import_records.pg_import_records()
sessions_page = pg_sessions.pg_sessions()
@pytest.fixture(scope=fixture_scope.FUNCTION, autouse=False)
def setup_tests(self, start_mavis: None):
self.login_page.login_as_nurse()
yield
self.login_page.logout_of_mavis()
@pytest.fixture(scope=fixture_scope.FUNCTION, autouse=False)
def setup_child_list(self, setup_tests: None):
self.dashboard_page.click_import_records()
self.import_records_page.click_import_records()
yield
@pytest.fixture(scope=fixture_scope.FUNCTION, autouse=False)
def setup_class_list(self, setup_tests: None):
try:
self.dashboard_page.click_sessions()
self.sessions_page.schedule_a_valid_session_in_school_1()
self.dashboard_page.go_to_dashboard()
self.dashboard_page.click_import_records()
self.import_records_page.click_import_records()
yield
finally:
self.dashboard_page.go_to_dashboard()
self.dashboard_page.click_sessions()
self.sessions_page.delete_all_sessions_for_school_1()
@pytest.fixture(scope=fixture_scope.FUNCTION, autouse=False)
def setup_vaccs(self, setup_tests: None):
try:
self.dashboard_page.click_sessions()
self.sessions_page.schedule_a_valid_session_in_school_1(for_today=True)
self.import_records_page.import_class_list_records_from_school_session(
file_paths=test_data_file_paths.CLASS_SESSION_ID
)
self.sessions_page.click_school1()
self.sessions_page.save_session_id_from_offline_excel()
self.dashboard_page.go_to_dashboard()
self.dashboard_page.click_import_records()
self.import_records_page.click_import_records()
yield
finally:
self.dashboard_page.go_to_dashboard()
self.dashboard_page.click_sessions()
self.sessions_page.delete_all_sessions_for_school_1()
@pytest.fixture(scope=fixture_scope.FUNCTION, autouse=False)
def setup_vaccs_systmone(self, setup_tests: None):
try:
self.dashboard_page.click_sessions()
self.sessions_page.schedule_a_valid_session_in_school_1(for_today=True)
self.dashboard_page.go_to_dashboard()
self.dashboard_page.click_import_records()
self.import_records_page.click_import_records()
yield
finally:
self.dashboard_page.go_to_dashboard()
self.dashboard_page.click_sessions()
self.sessions_page.delete_all_sessions_for_school_1()
########################################### CHILD LIST ###########################################
@pytest.mark.childlist
@pytest.mark.order(301)
def test_child_list_file_upload_positive(self, setup_child_list):
self.import_records_page.import_child_records(file_paths=test_data_file_paths.CHILD_POSITIVE)
@pytest.mark.childlist
@pytest.mark.order(302)
def test_child_list_file_upload_negative(self, setup_child_list):
self.import_records_page.import_child_records(file_paths=test_data_file_paths.CHILD_NEGATIVE)
@pytest.mark.childlist
@pytest.mark.order(303)
def test_child_list_file_structure(self, setup_child_list):
self.import_records_page.import_child_records(file_paths=test_data_file_paths.CHILD_INVALID_STRUCTURE)
@pytest.mark.childlist
@pytest.mark.order(304)
def test_child_list_no_record(self, setup_child_list):
self.import_records_page.import_child_records(file_paths=test_data_file_paths.CHILD_HEADER_ONLY)
@pytest.mark.childlist
@pytest.mark.order(305)
def test_child_list_empty_file(self, setup_child_list):
self.import_records_page.import_child_records(file_paths=test_data_file_paths.CHILD_EMPTY_FILE)
@pytest.mark.childlist
@pytest.mark.order(306)
@pytest.mark.skip(reason="Test under construction")
def test_child_list_space_normalisation(self, setup_child_list):
self.import_records_page.import_child_records(
file_paths=test_data_file_paths.CHILD_MAV_1080, verify_on_children_page=True
)
########################################### CLASS LIST ###########################################
@pytest.mark.classlist
@pytest.mark.order(326)
def test_class_list_file_upload_positive(self, setup_class_list: None):
self.import_records_page.import_class_list_records(file_paths=test_data_file_paths.CLASS_POSITIVE)
@pytest.mark.classlist
@pytest.mark.order(327)
def test_class_list_file_upload_negative(self, setup_class_list: None):
self.import_records_page.import_class_list_records(file_paths=test_data_file_paths.CLASS_NEGATIVE)
@pytest.mark.classlist
@pytest.mark.order(328)
def test_class_list_file_structure(self, setup_class_list: None):
self.import_records_page.import_class_list_records(file_paths=test_data_file_paths.CLASS_INVALID_STRUCTURE)
@pytest.mark.classlist
@pytest.mark.order(329)
def test_class_list_no_record(self, setup_class_list: None):
self.import_records_page.import_class_list_records(file_paths=test_data_file_paths.CLASS_HEADER_ONLY)
@pytest.mark.classlist
@pytest.mark.order(330)
def test_class_list_empty_file(self, setup_class_list: None):
self.import_records_page.import_class_list_records(file_paths=test_data_file_paths.CLASS_EMPTY_FILE)
@pytest.mark.classlist
@pytest.mark.order(331)
def test_class_list_year_group(self, setup_class_list: None):
self.import_records_page.import_class_list_records(
file_paths=test_data_file_paths.CLASS_YEAR_GROUP, year_group=child_year_group.YEAR_8
)
########################################### VACCINATIONS ###########################################
@pytest.mark.vaccinations
@pytest.mark.order(351)
def test_vaccs_positive_file_upload(self, setup_vaccs):
self.import_records_page.import_vaccination_records(file_paths=test_data_file_paths.VACCS_POSITIVE)
@pytest.mark.vaccinations
@pytest.mark.order(352)
def test_vaccs_negative_file_upload(self, setup_vaccs):
self.import_records_page.import_vaccination_records(file_paths=test_data_file_paths.VACCS_NEGATIVE)
@pytest.mark.vaccinations
@pytest.mark.order(353)
def test_vaccs_duplicate_record_upload(self, setup_vaccs):
self.import_records_page.import_vaccination_records(file_paths=test_data_file_paths.VACCS_DUP_1)
self.dashboard_page.go_to_dashboard()
self.dashboard_page.click_import_records()
self.import_records_page.click_import_records()
self.import_records_page.import_vaccination_records(file_paths=test_data_file_paths.VACCS_DUP_2)
@pytest.mark.vaccinations
@pytest.mark.order(354)
def test_vaccs_file_structure(self, setup_vaccs):
self.import_records_page.import_vaccination_records(file_paths=test_data_file_paths.VACCS_INVALID_STRUCTURE)
@pytest.mark.vaccinations
@pytest.mark.order(355)
def test_vaccs_no_record(self, setup_vaccs):
self.import_records_page.import_vaccination_records(file_paths=test_data_file_paths.VACCS_HEADER_ONLY)
@pytest.mark.vaccinations
@pytest.mark.order(356)
def test_vaccs_empty_file(self, setup_vaccs):
self.import_records_page.import_vaccination_records(file_paths=test_data_file_paths.VACCS_EMPTY_FILE)
@pytest.mark.vaccinations
@pytest.mark.order(357)
def test_vaccs_historic_positive_file_upload(self, setup_vaccs):
self.import_records_page.import_vaccination_records(file_paths=test_data_file_paths.VACCS_HIST_POSITIVE)
@pytest.mark.vaccinations
@pytest.mark.order(358)
def test_vaccs_historic_negative_file_upload(self, setup_vaccs):
self.import_records_page.import_vaccination_records(file_paths=test_data_file_paths.VACCS_HIST_NEGATIVE)
@pytest.mark.vaccinations
@pytest.mark.order(359)
def test_vaccs_historic_no_urn_mav_855(self, setup_vaccs):
self.import_records_page.import_vaccination_records(file_paths=test_data_file_paths.VACCS_HPV_MAV_855)
self.dashboard_page.go_to_dashboard()
self.dashboard_page.click_children()
self.import_records_page.verify_mav_855()
@pytest.mark.vaccinations
@pytest.mark.order(360)
def test_vaccs_systmone_positive_file_upload(self, setup_vaccs_systmone):
self.import_records_page.import_vaccination_records(file_paths=test_data_file_paths.VACCS_SYSTMONE_POSITIVE)
@pytest.mark.vaccinations
@pytest.mark.order(361)
def test_vaccs_systmone_negative_file_upload(self, setup_vaccs_systmone):
self.import_records_page.import_vaccination_records(file_paths=test_data_file_paths.VACCS_SYSTMONE_NEGATIVE)
@pytest.mark.vaccinations
@pytest.mark.order(362)
def test_vaccs_systmone_negative_historical_file_upload(self, setup_vaccs_systmone):
self.import_records_page.import_vaccination_records(
file_paths=test_data_file_paths.VACCS_SYSTMONE_HIST_NEGATIVE
)