Skip to content

Commit 630bab4

Browse files
Merge pull request #43 from NHSDigital:20241206
20241206
2 parents fbe13d8 + 70a8dcd commit 630bab4

22 files changed

+189
-154
lines changed

.github/workflows/MAVIS_TEST.yml

Lines changed: 64 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ jobs:
3737
pip install flake8 pytest
3838
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
3939
playwright install
40-
playwright install-deps
4140
- name: Lint with flake8
4241
run: |
4342
# stop the build if there are Python syntax errors or undefined names
@@ -49,10 +48,11 @@ jobs:
4948
HEADLESS: ${{ vars.HEADLESS }}
5049
CAPTURE_SCREENSHOTS: ${{ vars.CAPTURE_SCREENSHOTS }}
5150
TEST_URL: ${{ vars.TEST_URL }}
52-
PARENTAL_CONSENT_URL: ${{ vars.PARENTAL_CONSENT_URL }}
5351
RESET_ENDPOINT: ${{ vars.RESET_ENDPOINT }}
54-
LOGIN_PASSWORD: ${{ secrets.LOGIN_PASSWORD }}
55-
LOGIN_USERNAME: ${{ secrets.LOGIN_USERNAME }}
52+
NURSE_PASSWORD: ${{ secrets.NURSE_PASSWORD }}
53+
NURSE_USERNAME: ${{ secrets.NURSE_USERNAME }}
54+
SUPERUSER_PASSWORD: ${{ secrets.SUPERUSER_PASSWORD }}
55+
SUPERUSER_USERNAME: ${{ secrets.SUPERUSER_USERNAME }}
5656
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }}
5757
TEST_USERNAME: ${{ secrets.TEST_USERNAME }}
5858
API_TOKEN: ${{ secrets.API_TOKEN }}
@@ -65,10 +65,11 @@ jobs:
6565
HEADLESS: ${{ vars.HEADLESS }}
6666
CAPTURE_SCREENSHOTS: ${{ vars.CAPTURE_SCREENSHOTS }}
6767
TEST_URL: ${{ vars.TEST_URL }}
68-
PARENTAL_CONSENT_URL: ${{ vars.PARENTAL_CONSENT_URL }}
6968
RESET_ENDPOINT: ${{ vars.RESET_ENDPOINT }}
70-
LOGIN_PASSWORD: ${{ secrets.LOGIN_PASSWORD }}
71-
LOGIN_USERNAME: ${{ secrets.LOGIN_USERNAME }}
69+
NURSE_PASSWORD: ${{ secrets.NURSE_PASSWORD }}
70+
NURSE_USERNAME: ${{ secrets.NURSE_USERNAME }}
71+
SUPERUSER_PASSWORD: ${{ secrets.SUPERUSER_PASSWORD }}
72+
SUPERUSER_USERNAME: ${{ secrets.SUPERUSER_USERNAME }}
7273
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }}
7374
TEST_USERNAME: ${{ secrets.TEST_USERNAME }}
7475
API_TOKEN: ${{ secrets.API_TOKEN }}
@@ -81,58 +82,96 @@ jobs:
8182
HEADLESS: ${{ vars.HEADLESS }}
8283
CAPTURE_SCREENSHOTS: ${{ vars.CAPTURE_SCREENSHOTS }}
8384
TEST_URL: ${{ vars.TEST_URL }}
84-
PARENTAL_CONSENT_URL: ${{ vars.PARENTAL_CONSENT_URL }}
8585
RESET_ENDPOINT: ${{ vars.RESET_ENDPOINT }}
86-
LOGIN_PASSWORD: ${{ secrets.LOGIN_PASSWORD }}
87-
LOGIN_USERNAME: ${{ secrets.LOGIN_USERNAME }}
86+
NURSE_PASSWORD: ${{ secrets.NURSE_PASSWORD }}
87+
NURSE_USERNAME: ${{ secrets.NURSE_USERNAME }}
88+
SUPERUSER_PASSWORD: ${{ secrets.SUPERUSER_PASSWORD }}
89+
SUPERUSER_USERNAME: ${{ secrets.SUPERUSER_USERNAME }}
8890
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }}
8991
TEST_USERNAME: ${{ secrets.TEST_USERNAME }}
9092
API_TOKEN: ${{ secrets.API_TOKEN }}
9193
run: |
9294
echo "::group::Firefox"
9395
pytest --browser_or_device firefox
9496
echo "::endgroup::"
95-
- name: Test on iPhone 12
97+
- name: Test on Edge
9698
env:
9799
HEADLESS: ${{ vars.HEADLESS }}
98100
CAPTURE_SCREENSHOTS: ${{ vars.CAPTURE_SCREENSHOTS }}
99101
TEST_URL: ${{ vars.TEST_URL }}
100-
PARENTAL_CONSENT_URL: ${{ vars.PARENTAL_CONSENT_URL }}
101102
RESET_ENDPOINT: ${{ vars.RESET_ENDPOINT }}
102-
LOGIN_PASSWORD: ${{ secrets.LOGIN_PASSWORD }}
103-
LOGIN_USERNAME: ${{ secrets.LOGIN_USERNAME }}
103+
NURSE_PASSWORD: ${{ secrets.NURSE_PASSWORD }}
104+
NURSE_USERNAME: ${{ secrets.NURSE_USERNAME }}
105+
SUPERUSER_PASSWORD: ${{ secrets.SUPERUSER_PASSWORD }}
106+
SUPERUSER_USERNAME: ${{ secrets.SUPERUSER_USERNAME }}
104107
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }}
105108
TEST_USERNAME: ${{ secrets.TEST_USERNAME }}
106109
API_TOKEN: ${{ secrets.API_TOKEN }}
107110
run: |
108-
echo "::group::iPhone 12"
109-
pytest -m mobile --browser_or_device iphone_12
111+
echo "::group::Edge"
112+
pytest --browser_or_device msedge
110113
echo "::endgroup::"
111-
- name: Test on iPhone 11
114+
- name: Test on iPhone 14
112115
env:
113116
HEADLESS: ${{ vars.HEADLESS }}
114117
CAPTURE_SCREENSHOTS: ${{ vars.CAPTURE_SCREENSHOTS }}
115118
TEST_URL: ${{ vars.TEST_URL }}
116-
PARENTAL_CONSENT_URL: ${{ vars.PARENTAL_CONSENT_URL }}
117119
RESET_ENDPOINT: ${{ vars.RESET_ENDPOINT }}
118-
LOGIN_PASSWORD: ${{ secrets.LOGIN_PASSWORD }}
119-
LOGIN_USERNAME: ${{ secrets.LOGIN_USERNAME }}
120+
NURSE_PASSWORD: ${{ secrets.NURSE_PASSWORD }}
121+
NURSE_USERNAME: ${{ secrets.NURSE_USERNAME }}
122+
SUPERUSER_PASSWORD: ${{ secrets.SUPERUSER_PASSWORD }}
123+
SUPERUSER_USERNAME: ${{ secrets.SUPERUSER_USERNAME }}
120124
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }}
121125
TEST_USERNAME: ${{ secrets.TEST_USERNAME }}
122126
API_TOKEN: ${{ secrets.API_TOKEN }}
123127
run: |
124-
echo "::group::iPhone 11"
125-
pytest -m mobile --browser_or_device iphone_11
128+
echo "::group::iPhone 14"
129+
pytest -m mobile --browser_or_device iphone_14
130+
echo "::endgroup::"
131+
- name: Test on iPhone 15
132+
env:
133+
HEADLESS: ${{ vars.HEADLESS }}
134+
CAPTURE_SCREENSHOTS: ${{ vars.CAPTURE_SCREENSHOTS }}
135+
TEST_URL: ${{ vars.TEST_URL }}
136+
RESET_ENDPOINT: ${{ vars.RESET_ENDPOINT }}
137+
NURSE_PASSWORD: ${{ secrets.NURSE_PASSWORD }}
138+
NURSE_USERNAME: ${{ secrets.NURSE_USERNAME }}
139+
SUPERUSER_PASSWORD: ${{ secrets.SUPERUSER_PASSWORD }}
140+
SUPERUSER_USERNAME: ${{ secrets.SUPERUSER_USERNAME }}
141+
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }}
142+
TEST_USERNAME: ${{ secrets.TEST_USERNAME }}
143+
API_TOKEN: ${{ secrets.API_TOKEN }}
144+
run: |
145+
echo "::group::iPhone 15"
146+
pytest -m mobile --browser_or_device iphone_15
147+
echo "::endgroup::"
148+
- name: Test on iPad Gen 7
149+
env:
150+
HEADLESS: ${{ vars.HEADLESS }}
151+
CAPTURE_SCREENSHOTS: ${{ vars.CAPTURE_SCREENSHOTS }}
152+
TEST_URL: ${{ vars.TEST_URL }}
153+
RESET_ENDPOINT: ${{ vars.RESET_ENDPOINT }}
154+
NURSE_PASSWORD: ${{ secrets.NURSE_PASSWORD }}
155+
NURSE_USERNAME: ${{ secrets.NURSE_USERNAME }}
156+
SUPERUSER_PASSWORD: ${{ secrets.SUPERUSER_PASSWORD }}
157+
SUPERUSER_USERNAME: ${{ secrets.SUPERUSER_USERNAME }}
158+
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }}
159+
TEST_USERNAME: ${{ secrets.TEST_USERNAME }}
160+
API_TOKEN: ${{ secrets.API_TOKEN }}
161+
run: |
162+
echo "::group::iPad Gen 7"
163+
pytest -m mobile --browser_or_device ipad_7
126164
echo "::endgroup::"
127165
- name: Test on Google Pixel 5
128166
env:
129167
HEADLESS: ${{ vars.HEADLESS }}
130168
CAPTURE_SCREENSHOTS: ${{ vars.CAPTURE_SCREENSHOTS }}
131169
TEST_URL: ${{ vars.TEST_URL }}
132-
PARENTAL_CONSENT_URL: ${{ vars.PARENTAL_CONSENT_URL }}
133170
RESET_ENDPOINT: ${{ vars.RESET_ENDPOINT }}
134-
LOGIN_PASSWORD: ${{ secrets.LOGIN_PASSWORD }}
135-
LOGIN_USERNAME: ${{ secrets.LOGIN_USERNAME }}
171+
NURSE_PASSWORD: ${{ secrets.NURSE_PASSWORD }}
172+
NURSE_USERNAME: ${{ secrets.NURSE_USERNAME }}
173+
SUPERUSER_PASSWORD: ${{ secrets.SUPERUSER_PASSWORD }}
174+
SUPERUSER_USERNAME: ${{ secrets.SUPERUSER_USERNAME }}
136175
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }}
137176
TEST_USERNAME: ${{ secrets.TEST_USERNAME }}
138177
API_TOKEN: ${{ secrets.API_TOKEN }}

conftest.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,17 @@ def start_browser(pw, browser_or_device: str):
4949
}
5050
try:
5151
match browser_or_device.lower():
52-
case "iphone_12":
52+
case "iphone_14":
5353
_browser = pw.webkit.launch(headless=ce.headless_mode)
54-
_context = _browser.new_context(**pw.devices["iPhone 12"], http_credentials=_http_credentials)
55-
case "iphone_11":
54+
_context = _browser.new_context(**pw.devices["iPhone 14"], http_credentials=_http_credentials)
55+
case "iphone_15":
5656
_browser = pw.chromium.launch(channel="chrome", headless=ce.headless_mode)
57-
_context = _browser.new_context(**pw.devices["iPhone 11"], http_credentials=_http_credentials)
57+
_context = _browser.new_context(**pw.devices["iPhone 15"], http_credentials=_http_credentials)
58+
case "ipad_7":
59+
_browser = pw.chromium.launch(headless=ce.headless_mode)
60+
_context = _browser.new_context(
61+
**pw.devices["iPad (gen 7) landscape"], http_credentials=_http_credentials
62+
)
5863
case "pixel_5":
5964
_browser = pw.webkit.launch(headless=ce.headless_mode)
6065
_context = _browser.new_context(**pw.devices["Pixel 5"], http_credentials=_http_credentials)

libs/__init__.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ class CurrentExecution:
1616
session_screenshots_dir: str = ""
1717
screenshot_sequence: int = 0
1818
capture_screenshot_flag: bool = False
19-
login_username: str = ""
20-
login_password: str = ""
21-
parental_consent_url: str = ""
19+
nurse_username: str = ""
20+
nurse_password: str = ""
21+
superuser_username: str = ""
22+
superuser_password: str = ""
2223
reset_endpoint: str = ""
2324
api_token: str = ""
2425

@@ -28,11 +29,12 @@ def get_env_values():
2829
CurrentExecution.service_url = os.getenv("TEST_URL")
2930
CurrentExecution.base_auth_username = os.getenv("TEST_USERNAME")
3031
CurrentExecution.base_auth_password = os.getenv("TEST_PASSWORD")
31-
CurrentExecution.login_username = os.getenv("LOGIN_USERNAME")
32-
CurrentExecution.login_password = os.getenv("LOGIN_PASSWORD")
32+
CurrentExecution.nurse_username = os.getenv("NURSE_USERNAME")
33+
CurrentExecution.nurse_password = os.getenv("NURSE_PASSWORD")
34+
CurrentExecution.superuser_username = os.getenv("SUPERUSER_USERNAME")
35+
CurrentExecution.superuser_password = os.getenv("SUPERUSER_PASSWORD")
3336
CurrentExecution.headless_mode = os.getenv("HEADLESS").lower() == "true"
3437
CurrentExecution.capture_screenshot_flag = os.getenv("CAPTURE_SCREENSHOTS").lower() == "true"
35-
CurrentExecution.parental_consent_url = os.getenv("PARENTAL_CONSENT_URL")
3638
CurrentExecution.reset_endpoint = os.getenv("RESET_ENDPOINT")
3739
CurrentExecution.api_token = os.getenv("API_TOKEN")
3840

libs/api_ops.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ def api_get(endpoint, header, param):
1414
resp = requests.get(url=endpoint, params=param)
1515
else:
1616
resp = requests.get(url=endpoint, params=param, headers=header)
17-
assert api_operations.__verify_response_code(resp.status_code), f"API GET failed for {endpoint}."
17+
assert api_operations.__verify_response_code(
18+
resp.status_code
19+
), f"API GET failed for {endpoint} - {resp.status_code}."
1820
return resp
1921

2022
@staticmethod

libs/constants.py

Lines changed: 28 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ class api_constants:
3838
API_SUCCESS_STATUS_CODE_MAX: Final[int] = 299
3939

4040

41-
class workflow_type:
42-
APPLICATION: Final[str] = "application"
43-
PARENTAL_CONSENT: Final[str] = "parental_consent"
44-
45-
4641
class data_values:
4742
EMPTY: Final[str] = "<empty>"
4843

@@ -108,81 +103,33 @@ class escape_characters:
108103
]
109104

110105

111-
class test_data_file_paths:
112-
PARENTAL_CONSENT: Final[str] = "test_data/ParentalConsent.xlsx"
113-
VACCS_HPV_POSITIVE: Final[str] = (
114-
f"test_data/hpv/i_positive.csv{escape_characters.SEPARATOR_CHAR}test_data/hpv/o_positive.csv{escape_characters.SEPARATOR_CHAR}hpv"
115-
)
116-
VACCS_HPV_NEGATIVE: Final[str] = (
117-
f"test_data/hpv/i_negative.csv{escape_characters.SEPARATOR_CHAR}test_data/hpv/o_negative.csv{escape_characters.SEPARATOR_CHAR}hpv"
118-
)
119-
VACCS_HIST_HPV_POSITIVE: Final[str] = (
120-
f"test_data/hpv/i_hist_positive.csv{escape_characters.SEPARATOR_CHAR}test_data/hpv/o_hist_positive.csv{escape_characters.SEPARATOR_CHAR}hpv"
121-
)
122-
VACCS_HIST_HPV_NEGATIVE: Final[str] = (
123-
f"test_data/hpv/i_hist_negative.csv{escape_characters.SEPARATOR_CHAR}test_data/hpv/o_hist_negative.csv{escape_characters.SEPARATOR_CHAR}hpv"
124-
)
125-
VACCS_HPV_DUP_1: Final[str] = (
126-
f"test_data/hpv/i_dup_1.csv{escape_characters.SEPARATOR_CHAR}test_data/hpv/o_dup_1.csv{escape_characters.SEPARATOR_CHAR}hpv"
127-
)
128-
VACCS_HPV_DUP_2: Final[str] = (
129-
f"test_data/hpv/i_dup_2.csv{escape_characters.SEPARATOR_CHAR}test_data/hpv/o_dup_2.csv{escape_characters.SEPARATOR_CHAR}hpv"
130-
)
131-
VACCS_HPV_INVALID_STRUCTURE: Final[str] = (
132-
f"test_data/hpv/i_invalid_structure.csv{escape_characters.SEPARATOR_CHAR}test_data/hpv/o_invalid_structure.csv{escape_characters.SEPARATOR_CHAR}hpv"
133-
)
134-
VACCS_HPV_EMPTY_FILE: Final[str] = (
135-
f"test_data/hpv/i_empty.csv{escape_characters.SEPARATOR_CHAR}test_data/hpv/o_empty.csv{escape_characters.SEPARATOR_CHAR}hpv"
136-
)
137-
VACCS_HPV_HEADER_ONLY: Final[str] = (
138-
f"test_data/hpv/i_header_only.csv{escape_characters.SEPARATOR_CHAR}test_data/hpv/o_header_only.csv{escape_characters.SEPARATOR_CHAR}hpv"
139-
)
140-
COHORTS_POSITIVE: Final[str] = (
141-
f"test_data/cohorts/i_positive.csv{escape_characters.SEPARATOR_CHAR}test_data/cohorts/o_positive.csv{escape_characters.SEPARATOR_CHAR}cohort"
142-
)
143-
COHORTS_NEGATIVE: Final[str] = (
144-
f"test_data/cohorts/i_negative.csv{escape_characters.SEPARATOR_CHAR}test_data/cohorts/o_negative.csv{escape_characters.SEPARATOR_CHAR}cohort"
145-
)
146-
COHORTS_INVALID_STRUCTURE: Final[str] = (
147-
f"test_data/cohorts/i_invalid_structure.csv{escape_characters.SEPARATOR_CHAR}test_data/cohorts/o_invalid_structure.csv{escape_characters.SEPARATOR_CHAR}cohort"
148-
)
149-
COHORTS_EMPTY_FILE: Final[str] = (
150-
f"test_data/cohorts/i_empty.csv{escape_characters.SEPARATOR_CHAR}test_data/cohorts/o_empty.csv{escape_characters.SEPARATOR_CHAR}cohort"
151-
)
152-
COHORTS_HEADER_ONLY: Final[str] = (
153-
f"test_data/cohorts/i_header_only.csv{escape_characters.SEPARATOR_CHAR}test_data/cohorts/o_header_only.csv{escape_characters.SEPARATOR_CHAR}cohort"
154-
)
155-
CHILD_POSITIVE: Final[str] = (
156-
f"test_data/child/i_positive.csv{escape_characters.SEPARATOR_CHAR}test_data/child/o_positive.csv{escape_characters.SEPARATOR_CHAR}child"
157-
)
158-
CHILD_NEGATIVE: Final[str] = (
159-
f"test_data/child/i_negative.csv{escape_characters.SEPARATOR_CHAR}test_data/child/o_negative.csv{escape_characters.SEPARATOR_CHAR}child"
160-
)
161-
CHILD_INVALID_STRUCTURE: Final[str] = (
162-
f"test_data/child/i_invalid_structure.csv{escape_characters.SEPARATOR_CHAR}test_data/child/o_invalid_structure.csv{escape_characters.SEPARATOR_CHAR}child"
163-
)
164-
CHILD_EMPTY_FILE: Final[str] = (
165-
f"test_data/child/i_empty.csv{escape_characters.SEPARATOR_CHAR}test_data/child/o_empty.csv{escape_characters.SEPARATOR_CHAR}child"
166-
)
167-
CHILD_HEADER_ONLY: Final[str] = (
168-
f"test_data/child/i_header_only.csv{escape_characters.SEPARATOR_CHAR}test_data/child/o_header_only.csv{escape_characters.SEPARATOR_CHAR}child"
169-
)
170-
CLASS_POSITIVE: Final[str] = (
171-
f"test_data/class_list/i_positive.csv{escape_characters.SEPARATOR_CHAR}test_data/class_list/o_positive.csv{escape_characters.SEPARATOR_CHAR}class"
172-
)
173-
CLASS_NEGATIVE: Final[str] = (
174-
f"test_data/class_list/i_negative.csv{escape_characters.SEPARATOR_CHAR}test_data/class_list/o_negative.csv{escape_characters.SEPARATOR_CHAR}class"
175-
)
176-
CLASS_INVALID_STRUCTURE: Final[str] = (
177-
f"test_data/class_list/i_invalid_structure.csv{escape_characters.SEPARATOR_CHAR}test_data/class_list/o_invalid_structure.csv{escape_characters.SEPARATOR_CHAR}class"
178-
)
179-
CLASS_EMPTY_FILE: Final[str] = (
180-
f"test_data/class_list/i_empty.csv{escape_characters.SEPARATOR_CHAR}test_data/class_list/o_empty.csv{escape_characters.SEPARATOR_CHAR}class"
181-
)
182-
CLASS_HEADER_ONLY: Final[str] = (
183-
f"test_data/class_list/i_header_only.csv{escape_characters.SEPARATOR_CHAR}test_data/class_list/o_header_only.csv{escape_characters.SEPARATOR_CHAR}class"
184-
)
185-
186-
187106
class file_encoding:
188107
ASCII = "ascii"
108+
109+
110+
class test_data_file_paths:
111+
PARENTAL_CONSENT: Final[str] = "test_data/ParentalConsent.xlsx"
112+
VACCS_HPV_POSITIVE: Final[str] = "VACCS_HPV_POSITIVE"
113+
VACCS_HPV_NEGATIVE: Final[str] = "VACCS_HPV_NEGATIVE"
114+
VACCS_HIST_HPV_POSITIVE: Final[str] = "VACCS_HIST_HPV_POSITIVE"
115+
VACCS_HIST_HPV_NEGATIVE: Final[str] = "VACCS_HIST_HPV_NEGATIVE"
116+
VACCS_HPV_DUP_1: Final[str] = "VACCS_HPV_DUP_1"
117+
VACCS_HPV_DUP_2: Final[str] = "VACCS_HPV_DUP_2"
118+
VACCS_HPV_INVALID_STRUCTURE: Final[str] = "VACCS_HPV_INVALID_STRUCTURE"
119+
VACCS_HPV_EMPTY_FILE: Final[str] = "VACCS_HPV_EMPTY_FILE"
120+
VACCS_HPV_HEADER_ONLY: Final[str] = "VACCS_HPV_HEADER_ONLY"
121+
COHORTS_POSITIVE: Final[str] = "COHORTS_POSITIVE"
122+
COHORTS_NEGATIVE: Final[str] = "COHORTS_NEGATIVE"
123+
COHORTS_INVALID_STRUCTURE: Final[str] = "COHORTS_INVALID_STRUCTURE"
124+
COHORTS_EMPTY_FILE: Final[str] = "COHORTS_EMPTY_FILE"
125+
COHORTS_HEADER_ONLY: Final[str] = "COHORTS_HEADER_ONLY"
126+
CHILD_POSITIVE: Final[str] = "CHILD_POSITIVE"
127+
CHILD_NEGATIVE: Final[str] = "CHILD_NEGATIVE"
128+
CHILD_INVALID_STRUCTURE: Final[str] = "CHILD_INVALID_STRUCTURE"
129+
CHILD_EMPTY_FILE: Final[str] = "CHILD_EMPTY_FILE"
130+
CHILD_HEADER_ONLY: Final[str] = "CHILD_HEADER_ONLY"
131+
CLASS_POSITIVE: Final[str] = "CLASS_POSITIVE"
132+
CLASS_NEGATIVE: Final[str] = "CLASS_NEGATIVE"
133+
CLASS_INVALID_STRUCTURE: Final[str] = "CLASS_INVALID_STRUCTURE"
134+
CLASS_EMPTY_FILE: Final[str] = "CLASS_EMPTY_FILE"
135+
CLASS_HEADER_ONLY: Final[str] = "CLASS_HEADER_ONLY"

libs/testdata_ops.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ class testdata_operations:
1010
fo = file_ops.file_operations()
1111
ce = CurrentExecution()
1212

13+
def __init__(self):
14+
self.mapping_df: pd.DataFrame = self.fo.read_csv_to_df(file_path="test_data/file_mapping.csv")
15+
1316
def create_file_from_template(self, template_path: str, file_name_prefix: str) -> str:
1417
_template_text = self.fo.get_file_text(file_path=template_path)
1518
_file_text = []
@@ -34,7 +37,7 @@ def get_new_nhs_no(self, valid=True) -> str:
3437

3538
def get_expected_errors(self, file_path: str) -> list[str]:
3639
_file_content = self.fo.get_file_text(file_path=file_path)
37-
return _file_content.split("\n") if _file_content is not None else None
40+
return _file_content.split(escape_characters.NEW_LINE) if _file_content is not None else None
3841

3942
def read_spreadsheet(self, file_path: str) -> pd.DataFrame:
4043
_df = self.fo.read_excel_to_df(file_path=file_path)
@@ -52,10 +55,11 @@ def clean_df(self, df: pd.DataFrame) -> pd.DataFrame:
5255
_df.replace(to_replace="", value=data_values.EMPTY, inplace=True)
5356
return _df
5457

55-
def split_file_paths(self, file_paths: str) -> tuple[str, str]:
56-
file_for = file_paths.split(escape_characters.SEPARATOR_CHAR)[2]
57-
_input_file_path = self.create_file_from_template(
58-
template_path=file_paths.split(escape_characters.SEPARATOR_CHAR)[0], file_name_prefix=file_for
58+
def get_file_paths(self, file_paths: str) -> tuple[str, str]:
59+
_input_template_path: str = self.mapping_df.query("ID==@file_paths")["INPUT_TEMPLATE"].to_string(index=False)
60+
_output_template_path: str = self.mapping_df.query("ID==@file_paths")["OUTPUT_TEMPLATE"].to_string(index=False)
61+
_file_prefix: str = self.mapping_df.query("ID==@file_paths")["FILE_PREFIX"].to_string(index=False)
62+
_input_file_path: str = self.create_file_from_template(
63+
template_path=_input_template_path, file_name_prefix=_file_prefix
5964
)
60-
_output_file_path = file_paths.split(escape_characters.SEPARATOR_CHAR)[1]
61-
return _input_file_path, _output_file_path
65+
return _input_file_path, _output_template_path

pages/pg_dashboard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def verify_all_expected_links(self):
5757
locator=self.LNK_UNMATCHED_CONSENT_RESPONSES, property=object_properties.VISIBILITY, value=True, exact=True
5858
)
5959
self.po.verify(locator=self.LNK_SCHOOL_MOVES, property=object_properties.VISIBILITY, value=True, exact=True)
60-
self.po.verify(locator=self.LNK_NOTICES, property=object_properties.VISIBILITY, value=True, exact=True)
60+
# self.po.verify(locator=self.LNK_NOTICES, property=object_properties.VISIBILITY, value=True, exact=True) # Superuser only
6161
self.po.verify(locator=self.LNK_ORGANISATION, property=object_properties.VISIBILITY, value=True, exact=True)
6262
self.po.verify(
6363
locator=self.LNK_SERVICE_GUIDANCE, property=object_properties.VISIBILITY, value=True, exact=True

0 commit comments

Comments
 (0)