Skip to content

Commit d1c8436

Browse files
Code and file updates
2 parents 0e2596e + 1d64603 commit d1c8436

File tree

7 files changed

+264
-224
lines changed

7 files changed

+264
-224
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Manage vaccinations in schools
2+
23
[![Run MAVIS tests on TEST](https://github.com/NHSDigital/manage-vaccinations-in-schools-testing/actions/workflows/MAVIS_TEST.yml/badge.svg)](https://github.com/NHSDigital/manage-vaccinations-in-schools-testing/actions/workflows/MAVIS_TEST.yml)
34

45
## Introduction

libs/constants.py

Lines changed: 92 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,76 @@
1+
from typing import Final
2+
3+
14
class object_properties:
2-
TEXT = "text"
3-
VISIBILITY = "visibility"
5+
TEXT: Final[str] = "text"
6+
VISIBILITY: Final[str] = "visibility"
47

58

69
class actions:
7-
CLICK_LINK = "click_link"
8-
CLICK_BUTTON = "click_button"
9-
CLICK_LABEL = "click_label"
10-
FILL = "fill"
11-
TYPE = "type"
12-
RADIO_BUTTON_SELECT = "radio_select"
13-
SELECT_FILE = "select_file"
14-
SELECT_FROM_LIST = "select_from_list"
15-
CHECKBOX_CHECK = "checkbox_check"
16-
CLICK_LINK_INDEX_FOR_ROW = "click_link_index_for_row"
17-
CLICK_WILDCARD = "click_wildcard"
10+
CLICK_LINK: Final[str] = "click_link"
11+
CLICK_BUTTON: Final[str] = "click_button"
12+
CLICK_LABEL: Final[str] = "click_label"
13+
FILL: Final[str] = "fill"
14+
TYPE: Final[str] = "type"
15+
RADIO_BUTTON_SELECT: Final[str] = "radio_select"
16+
SELECT_FILE: Final[str] = "select_file"
17+
SELECT_FROM_LIST: Final[str] = "select_from_list"
18+
CHECKBOX_CHECK: Final[str] = "checkbox_check"
19+
CLICK_LINK_INDEX_FOR_ROW: Final[str] = "click_link_index_for_row"
20+
CLICK_WILDCARD: Final[str] = "click_wildcard"
1821

1922

2023
class screenshot_types:
21-
JPEG = "jpeg"
24+
JPEG: Final[str] = "jpeg"
2225

2326

2427
class file_mode:
25-
READ = "r"
26-
WRITE = "w"
27-
APPEND = "a"
28+
READ: Final[str] = "r"
29+
WRITE: Final[str] = "w"
30+
APPEND: Final[str] = "a"
2831

2932

3033
class api_constants:
31-
API_SUCCESS_STATUS_CODE_MIN = 200
32-
API_SUCCESS_STATUS_CODE_MAX = 299
34+
API_SUCCESS_STATUS_CODE_MIN: Final[int] = 200
35+
API_SUCCESS_STATUS_CODE_MAX: Final[int] = 299
3336

3437

3538
class workflow_type:
36-
APPLICATION = "application"
37-
PARENTAL_CONSENT = "parental_consent"
39+
APPLICATION: Final[str] = "application"
40+
PARENTAL_CONSENT: Final[str] = "parental_consent"
3841

3942

4043
class data_values:
41-
EMPTY = "<empty>"
44+
EMPTY: Final[str] = "<empty>"
4245

4346

4447
class playwright_roles:
45-
LINK = "link"
46-
BUTTON = "button"
47-
OPTION = "option"
48-
ROW = "row"
48+
LINK: Final[str] = "link"
49+
BUTTON: Final[str] = "button"
50+
OPTION: Final[str] = "option"
51+
ROW: Final[str] = "row"
4952

5053

5154
class wait_time:
52-
MIN = "3s"
53-
MED = "10s"
54-
MAX = "30s"
55+
MIN: Final[str] = "3s"
56+
MED: Final[str] = "10s"
57+
MAX: Final[str] = "30s"
5558

5659

5760
class escape_characters:
58-
SEPARATOR = "||" # Used only in code
59-
SPACE = " "
60-
NEW_LINE = "\n"
61-
CARRIAGE_RETURN = "\r"
62-
NEW_LINE_CARRIAGE_RETURN = "\r\n"
63-
SINGLE_QUOTE_OPEN_UNICODE = "’"
64-
SINGLE_QUOTE_CLOSE_UNICODE = "‘"
65-
SINGLE_QUOTE_OPEN = "‘"
66-
SINGLE_QUOTE_CLOSE = "’"
67-
TAB = "\t"
68-
COLON = ":"
69-
BACKSLASH = "\\"
70-
STROKE = "/"
61+
SEPARATOR: Final[str] = "||" # Used only in code
62+
SPACE: Final[str] = " "
63+
NEW_LINE: Final[str] = "\n"
64+
CARRIAGE_RETURN: Final[str] = "\r"
65+
NEW_LINE_CARRIAGE_RETURN: Final[str] = "\r\n"
66+
SINGLE_QUOTE_OPEN_UNICODE: Final[str] = "’"
67+
SINGLE_QUOTE_CLOSE_UNICODE: Final[str] = "‘"
68+
SINGLE_QUOTE_OPEN: Final[str] = "‘"
69+
SINGLE_QUOTE_CLOSE: Final[str] = "’"
70+
TAB: Final[str] = "\t"
71+
COLON: Final[str] = ":"
72+
BACKSLASH: Final[str] = "\\"
73+
STROKE: Final[str] = "/"
7174
UI_FORMATTING = [
7275
SPACE,
7376
NEW_LINE,
@@ -83,42 +86,66 @@ class escape_characters:
8386

8487

8588
class test_data_file_paths:
86-
PARENTAL_CONSENT = "test_data/ParentalConsent.xlsx"
87-
VACCS_HPV_POSITIVE = f"test_data/hpv/i_positive.csv{escape_characters.SEPARATOR}test_data/hpv/o_positive.csv"
88-
VACCS_HPV_NEGATIVE = f"test_data/hpv/i_negative.csv{escape_characters.SEPARATOR}test_data/hpv/o_negative.csv"
89-
VACCS_HPV_DUP_1 = f"test_data/hpv/i_dup_1.csv{escape_characters.SEPARATOR}test_data/hpv/o_dup_1.csv"
90-
VACCS_HPV_DUP_2 = f"test_data/hpv/i_dup_2.csv{escape_characters.SEPARATOR}test_data/hpv/o_dup_2.csv"
91-
VACCS_HPV_INVALID_STRUCTURE = (
89+
PARENTAL_CONSENT: Final[str] = "test_data/ParentalConsent.xlsx"
90+
VACCS_HPV_POSITIVE: Final[str] = (
91+
f"test_data/hpv/i_positive.csv{escape_characters.SEPARATOR}test_data/hpv/o_positive.csv"
92+
)
93+
VACCS_HPV_NEGATIVE: Final[str] = (
94+
f"test_data/hpv/i_negative.csv{escape_characters.SEPARATOR}test_data/hpv/o_negative.csv"
95+
)
96+
VACCS_HPV_DUP_1: Final[str] = f"test_data/hpv/i_dup_1.csv{escape_characters.SEPARATOR}test_data/hpv/o_dup_1.csv"
97+
VACCS_HPV_DUP_2: Final[str] = f"test_data/hpv/i_dup_2.csv{escape_characters.SEPARATOR}test_data/hpv/o_dup_2.csv"
98+
VACCS_HPV_INVALID_STRUCTURE: Final[str] = (
9299
f"test_data/hpv/i_invalid_structure.csv{escape_characters.SEPARATOR}test_data/hpv/o_invalid_structure.csv"
93100
)
94-
VACCS_HPV_EMPTY_FILE = f"test_data/hpv/i_empty.csv{escape_characters.SEPARATOR}test_data/hpv/o_empty.csv"
95-
VACCS_HPV_HEADER_ONLY = (
101+
VACCS_HPV_EMPTY_FILE: Final[str] = (
102+
f"test_data/hpv/i_empty.csv{escape_characters.SEPARATOR}test_data/hpv/o_empty.csv"
103+
)
104+
VACCS_HPV_HEADER_ONLY: Final[str] = (
96105
f"test_data/hpv/i_header_only.csv{escape_characters.SEPARATOR}test_data/hpv/o_header_only.csv"
97106
)
98-
COHORTS_POSITIVE = f"test_data/cohorts/i_positive.csv{escape_characters.SEPARATOR}test_data/cohorts/o_positive.csv"
99-
COHORTS_NEGATIVE = f"test_data/cohorts/i_negative.csv{escape_characters.SEPARATOR}test_data/cohorts/o_negative.csv"
100-
COHORTS_INVALID_STRUCTURE = f"test_data/cohorts/i_invalid_structure.csv{escape_characters.SEPARATOR}test_data/cohorts/o_invalid_structure.csv"
101-
COHORTS_EMPTY_FILE = f"test_data/cohorts/i_empty.csv{escape_characters.SEPARATOR}test_data/cohorts/o_empty.csv"
102-
COHORTS_HEADER_ONLY = (
107+
COHORTS_POSITIVE: Final[str] = (
108+
f"test_data/cohorts/i_positive.csv{escape_characters.SEPARATOR}test_data/cohorts/o_positive.csv"
109+
)
110+
COHORTS_NEGATIVE: Final[str] = (
111+
f"test_data/cohorts/i_negative.csv{escape_characters.SEPARATOR}test_data/cohorts/o_negative.csv"
112+
)
113+
COHORTS_INVALID_STRUCTURE: Final[str] = (
114+
f"test_data/cohorts/i_invalid_structure.csv{escape_characters.SEPARATOR}test_data/cohorts/o_invalid_structure.csv"
115+
)
116+
COHORTS_EMPTY_FILE: Final[str] = (
117+
f"test_data/cohorts/i_empty.csv{escape_characters.SEPARATOR}test_data/cohorts/o_empty.csv"
118+
)
119+
COHORTS_HEADER_ONLY: Final[str] = (
103120
f"test_data/cohorts/i_header_only.csv{escape_characters.SEPARATOR}test_data/cohorts/o_header_only.csv"
104121
)
105-
CHILD_POSITIVE = f"test_data/child/i_positive.csv{escape_characters.SEPARATOR}test_data/child/o_positive.csv"
106-
CHILD_NEGATIVE = f"test_data/child/i_negative.csv{escape_characters.SEPARATOR}test_data/child/o_negative.csv"
107-
CHILD_INVALID_STRUCTURE = (
122+
CHILD_POSITIVE: Final[str] = (
123+
f"test_data/child/i_positive.csv{escape_characters.SEPARATOR}test_data/child/o_positive.csv"
124+
)
125+
CHILD_NEGATIVE: Final[str] = (
126+
f"test_data/child/i_negative.csv{escape_characters.SEPARATOR}test_data/child/o_negative.csv"
127+
)
128+
CHILD_INVALID_STRUCTURE: Final[str] = (
108129
f"test_data/child/i_invalid_structure.csv{escape_characters.SEPARATOR}test_data/child/o_invalid_structure.csv"
109130
)
110-
CHILD_EMPTY_FILE = f"test_data/child/i_empty.csv{escape_characters.SEPARATOR}test_data/child/o_empty.csv"
111-
CHILD_HEADER_ONLY = (
131+
CHILD_EMPTY_FILE: Final[str] = (
132+
f"test_data/child/i_empty.csv{escape_characters.SEPARATOR}test_data/child/o_empty.csv"
133+
)
134+
CHILD_HEADER_ONLY: Final[str] = (
112135
f"test_data/child/i_header_only.csv{escape_characters.SEPARATOR}test_data/child/o_header_only.csv"
113136
)
114-
CLASS_POSITIVE = (
137+
CLASS_POSITIVE: Final[str] = (
115138
f"test_data/class_list/i_positive.csv{escape_characters.SEPARATOR}test_data/class_list/o_positive.csv"
116139
)
117-
CLASS_NEGATIVE = (
140+
CLASS_NEGATIVE: Final[str] = (
118141
f"test_data/class_list/i_negative.csv{escape_characters.SEPARATOR}test_data/class_list/o_negative.csv"
119142
)
120-
CLASS_INVALID_STRUCTURE = f"test_data/class_list/i_invalid_structure.csv{escape_characters.SEPARATOR}test_data/class_list/o_invalid_structure.csv"
121-
CLASS_EMPTY_FILE = f"test_data/class_list/i_empty.csv{escape_characters.SEPARATOR}test_data/class_list/o_empty.csv"
122-
CLASS_HEADER_ONLY = (
143+
CLASS_INVALID_STRUCTURE: Final[str] = (
144+
f"test_data/class_list/i_invalid_structure.csv{escape_characters.SEPARATOR}test_data/class_list/o_invalid_structure.csv"
145+
)
146+
CLASS_EMPTY_FILE: Final[str] = (
147+
f"test_data/class_list/i_empty.csv{escape_characters.SEPARATOR}test_data/class_list/o_empty.csv"
148+
)
149+
CLASS_HEADER_ONLY: Final[str] = (
123150
f"test_data/class_list/i_header_only.csv{escape_characters.SEPARATOR}test_data/class_list/o_header_only.csv"
124151
)

pages/pg_dashboard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def go_to_dashboard(self):
3636

3737
def verify_all_expected_links(self):
3838
self.po.verify(locator=self.LNK_PROGRAMMES, property=object_properties.VISIBILITY, value=True, exact=True)
39-
# self.po.verify(locator=self.LNK_VACCINES, property=object_properties.VISIBILITY, value=True, exact=True) # Out of scope for 1a
39+
self.po.verify(locator=self.LNK_VACCINES, property=object_properties.VISIBILITY, value=True, exact=True)
4040
self.po.verify(locator=self.LNK_SESSIONS, property=object_properties.VISIBILITY, value=True, exact=True)
4141
self.po.verify(locator=self.LNK_CHILDREN, property=object_properties.VISIBILITY, value=True, exact=True)
4242
self.po.verify(locator=self.LNK_NOTICES, property=object_properties.VISIBILITY, value=True, exact=True)

pages/pg_programmes.py

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,31 @@ class pg_programmes:
2323
LBL_PARAGRAPH = "paragraph"
2424
LBL_MAIN = "main"
2525

26-
def click_HPV(self):
26+
def click_hpv(self):
2727
self.po.perform_action(locator=self.LNK_HPV, action=actions.CLICK_LINK)
2828

29-
def click_Imports(self):
29+
def click_imports(self):
3030
self.po.perform_action(locator=self.LNK_IMPORTS, action=actions.CLICK_LINK)
3131

32-
def click_Cohorts(self):
32+
def click_cohorts(self):
3333
self.po.perform_action(locator=self.LNK_COHORTS, action=actions.CLICK_LINK)
3434

35-
def click_ImportRecords(self):
35+
def click_import_records(self):
3636
self.po.perform_action(locator=self.LNK_IMPORT_RECORDS, action=actions.CLICK_LINK)
3737

38-
def click_ImportCohortRecords(self):
38+
def click_import_cohort_records(self):
3939
self.po.perform_action(locator=self.LNK_IMPORT_CHILD_RECORDS, action=actions.CLICK_LINK)
4040

41-
def select_ChildRecords(self):
41+
def select_child_records(self):
4242
self.po.perform_action(locator=self.RDO_CHILD_RECORDS, action=actions.RADIO_BUTTON_SELECT)
4343

44-
def select_VaccinationRecords(self):
44+
def select_vaccination_records(self):
4545
self.po.perform_action(locator=self.RDO_VACCINATION_RECORDS, action=actions.RADIO_BUTTON_SELECT)
4646

47-
def click_Continue(self):
47+
def click_continue(self):
4848
self.po.perform_action(locator=self.BTN_CONTINUE, action=actions.CLICK_BUTTON)
4949

50-
def click_ChooseFile_ChildRecords(self):
50+
def click_choose_file_child_records(self):
5151
self.po.perform_action(locator=self.LBL_CHOOSE_COHORT_FILE, action=actions.CLICK_LABEL)
5252

5353
def choose_file_child_records(self, file_path: str):
@@ -57,7 +57,7 @@ def choose_file_child_records(self, file_path: str):
5757
value=file_path,
5858
)
5959

60-
def click_ChooseFile_VaccinationRecords(self):
60+
def click_choose_file_vaccination_records(self):
6161
self.po.perform_action(locator=self.LBL_CHOOSE_COHORT_FILE, action=actions.CLICK_LABEL)
6262

6363
def choose_file_vaccination_records(self, file_path: str):
@@ -67,7 +67,7 @@ def choose_file_vaccination_records(self, file_path: str):
6767
value=file_path,
6868
)
6969

70-
def verify_Import_Processing_Started(self):
70+
def verify_import_processing_started(self):
7171
self.po.verify(locator=self.LBL_PARAGRAPH, property=object_properties.TEXT, value=self.LBL_IMPORT_STARTED)
7272

7373
def click_uploaded_file_datetime(self):
@@ -84,75 +84,75 @@ def verify_upload_output(self, file_path: str):
8484

8585
def upload_hpv_vaccination_records(self, file_paths: str):
8686
_input_file_path, _output_file_path = self.tdo.split_file_paths(file_paths=file_paths)
87-
self.click_HPV()
88-
self.click_Imports()
89-
self.click_ImportRecords()
90-
self.select_VaccinationRecords()
91-
self.click_Continue()
87+
self.click_hpv()
88+
self.click_imports()
89+
self.click_import_records()
90+
self.select_vaccination_records()
91+
self.click_continue()
9292
self.choose_file_vaccination_records(file_path=_input_file_path)
93-
self.click_Continue()
93+
self.click_continue()
9494
self.record_upload_time()
9595
wait(timeout=wait_time.MED)
96-
self.click_Imports()
96+
self.click_imports()
9797
wait(timeout=wait_time.MIN) # Required for Firefox
9898
self.click_uploaded_file_datetime()
9999
self.verify_upload_output(file_path=_output_file_path)
100100

101101
def upload_hpv_child_records(self, file_paths: str):
102102
_input_file_path, _output_file_path = self.tdo.split_file_paths(file_paths=file_paths)
103-
self.click_HPV()
104-
self.click_Imports()
105-
self.click_ImportRecords()
106-
self.select_ChildRecords()
107-
self.click_Continue()
103+
self.click_hpv()
104+
self.click_imports()
105+
self.click_import_records()
106+
self.select_child_records()
107+
self.click_continue()
108108
self.choose_file_child_records(file_path=_input_file_path)
109-
self.click_Continue()
109+
self.click_continue()
110110
self.record_upload_time()
111111
wait(timeout=wait_time.MED)
112-
self.click_Imports()
112+
self.click_imports()
113113
self.click_uploaded_file_datetime()
114114
self.verify_upload_output(file_path=_output_file_path)
115115

116116
def upload_cohorts(self, file_paths: str):
117117
_input_file_path, _output_file_path = self.tdo.split_file_paths(file_paths=file_paths)
118-
self.click_HPV()
119-
self.click_Cohorts()
120-
self.click_ImportCohortRecords()
118+
self.click_hpv()
119+
self.click_cohorts()
120+
self.click_import_cohort_records()
121121
self.choose_file_child_records(file_path=_input_file_path)
122-
self.click_Continue()
122+
self.click_continue()
123123
self.record_upload_time()
124124
wait(timeout=wait_time.MED)
125-
self.click_Imports()
125+
self.click_imports()
126126
self.click_uploaded_file_datetime()
127127
self.verify_upload_output(file_path=_output_file_path)
128128

129129
def upload_invalid_files(self, file_paths: str):
130130
_input_file_path, _output_file_path = self.tdo.split_file_paths(file_paths=file_paths)
131-
self.click_HPV()
132-
self.click_Imports()
133-
self.click_ImportRecords()
134-
self.select_VaccinationRecords()
135-
self.click_Continue()
131+
self.click_hpv()
132+
self.click_imports()
133+
self.click_import_records()
134+
self.select_vaccination_records()
135+
self.click_continue()
136136
self.choose_file_vaccination_records(file_path=_input_file_path)
137-
self.click_Continue()
137+
self.click_continue()
138138
self.verify_upload_output(file_path=_output_file_path)
139139

140140
def upload_invalid_cohorts(self, file_paths: str):
141141
_input_file_path, _output_file_path = self.tdo.split_file_paths(file_paths=file_paths)
142-
self.click_HPV()
143-
self.click_Cohorts()
144-
self.click_ImportCohortRecords()
142+
self.click_hpv()
143+
self.click_cohorts()
144+
self.click_import_cohort_records()
145145
self.choose_file_child_records(file_path=_input_file_path)
146-
self.click_Continue()
146+
self.click_continue()
147147
self.verify_upload_output(file_path=_output_file_path)
148148

149149
def upload_invalid_hpv_child_records(self, file_paths: str):
150150
_input_file_path, _output_file_path = self.tdo.split_file_paths(file_paths=file_paths)
151-
self.click_HPV()
152-
self.click_Imports()
153-
self.click_ImportRecords()
154-
self.select_ChildRecords()
155-
self.click_Continue()
151+
self.click_hpv()
152+
self.click_imports()
153+
self.click_import_records()
154+
self.select_child_records()
155+
self.click_continue()
156156
self.choose_file_child_records(file_path=_input_file_path)
157-
self.click_Continue()
157+
self.click_continue()
158158
self.verify_upload_output(file_path=_output_file_path)

0 commit comments

Comments
 (0)