Skip to content

Commit bb3c17f

Browse files
committed
Add follow-up request question to parent journey
If a parent refuses a vaccine and selects a certain reason, they are asked whether they'd like someone to contact them to discuss options, known as a "fllow-up". The test needs to handle this scenario
1 parent c801cea commit bb3c17f

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

mavis/test/pages/online_consent_wizard_page.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ def __init__(self, page: Page) -> None:
116116
name="My child can have either type of vaccine",
117117
)
118118
self.no_consent_radio = self.page.get_by_role("radio", name="No")
119+
self.follow_up_question_yes_radio = self.page.get_by_role(
120+
"radio",
121+
name="Yes, I would like someone to contact me",
122+
)
123+
self.follow_up_question_no_radio = self.page.get_by_role(
124+
"radio",
125+
name="No",
126+
)
119127

120128
@step("Click Continue")
121129
def click_continue(self) -> None:
@@ -318,6 +326,13 @@ def select_consent_not_given_reason(
318326

319327
self.click_continue()
320328

329+
def answer_follow_up_question(self, yes_to_follow_up_request: bool) -> None:
330+
if yes_to_follow_up_request:
331+
self.follow_up_question_yes_radio.check()
332+
else:
333+
self.follow_up_question_no_radio.check()
334+
self.click_continue()
335+
321336
def expect_confirmation_text(self, text: str) -> None:
322337
confirmation = self.page.locator(".nhsuk-panel.nhsuk-panel--confirmation")
323338
expect(confirmation).to_contain_text(text)

tests/test_online_consent_doubles.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,18 @@ def test_consent_refused_for_doubles_vaccination(
6868
[False, True],
6969
ids=lambda v: f"yes_to_health_questions: {v}",
7070
)
71+
@pytest.mark.parametrize(
72+
"yes_to_follow_up_request",
73+
[False, True],
74+
ids=lambda v: f"yes_to_follow_up_request: {v}",
75+
)
7176
def test_consent_given_for_doubles_vaccination(
7277
start_consent_with_session_scheduled,
7378
page,
7479
schools,
7580
programmes,
7681
yes_to_health_questions,
82+
yes_to_follow_up_request,
7783
children,
7884
):
7985
"""
@@ -85,7 +91,8 @@ def test_consent_given_for_doubles_vaccination(
8591
3. Fill in address details.
8692
4. Answer the required number of health questions, optionally marking one as 'yes'.
8793
5. If not both vaccines, select a reason for not giving consent to the other.
88-
6. Submit the consent form.
94+
6. Answer question about wanting a follow-up discussion for the refused vaccine.
95+
7. Submit the consent form.
8996
Verification:
9097
- Confirmation message is shown for the correct child, vaccines,
9198
and health question status.
@@ -110,11 +117,12 @@ def test_consent_given_for_doubles_vaccination(
110117
OnlineConsentWizardPage(page).select_consent_not_given_reason(
111118
ConsentRefusalReason.PERSONAL_CHOICE,
112119
)
120+
OnlineConsentWizardPage(page).answer_follow_up_question(yes_to_follow_up_request)
113121

114122
OnlineConsentWizardPage(page).click_confirm()
115123

116124
OnlineConsentWizardPage(page).check_final_consent_message(
117125
child,
118126
programmes=programmes,
119-
yes_to_health_questions=yes_to_health_questions,
127+
yes_to_health_questions=yes_to_health_questions
120128
)

0 commit comments

Comments
 (0)