Skip to content

Commit 659a6bd

Browse files
committed
remove main text expectations in consent_page
1 parent fb7ed62 commit 659a6bd

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

mavis/test/pages/consent.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,12 @@ def select_consent_not_given_reason(
362362

363363
self.click_continue()
364364

365-
def expect_text_in_main(self, text: str) -> None:
366-
expect(self.page.get_by_role("main")).to_contain_text(text)
365+
def expect_text_in_alert(self, text: str) -> None:
366+
expect(self.page.get_by_role("alert")).to_contain_text(text)
367+
368+
def expect_confirmation_text(self, text: str) -> None:
369+
confirmation = self.page.locator(".nhsuk-panel.nhsuk-panel--confirmation")
370+
expect(confirmation).to_contain_text(text)
367371

368372
def change_parent_phone(self):
369373
self.fill_phone_number_and_receive_text_alerts("7700900000")
@@ -555,4 +559,4 @@ def programme_display(programme, consent_option) -> str:
555559
body = f"{child.first_name} {child.last_name} is due to get the {programmes_str} vaccination{'s' if len(programmes) > 1 else ''} at school"
556560

557561
final_message = "".join([title, body])
558-
self.expect_text_in_main(final_message)
562+
self.expect_confirmation_text(final_message)

tests/test_online_consent_doubles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_refused(consent_page, schools, children):
2929
details="Vaccine already received in previous school",
3030
)
3131
consent_page.click_confirm()
32-
consent_page.expect_text_in_main(
32+
consent_page.expect_confirmation_text(
3333
f"Consent refusedYou’ve told us that you do not want {child.first_name} {child.last_name} to get the MenACWY and Td/IPV vaccinations at school"
3434
)
3535

tests/test_online_consent_flu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def test_refused(start_consent, consent_page, schools, children):
5252
details="Vaccine already received in previous school",
5353
)
5454
consent_page.click_confirm()
55-
consent_page.expect_text_in_main(
55+
consent_page.expect_confirmation_text(
5656
f"Consent refusedYou’ve told us that you do not want {child.first_name} {child.last_name} to get the flu vaccination at school"
5757
)
5858

tests/test_online_consent_hpv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def test_refused(consent_page, schools, children):
2727
details="Vaccine already received in previous school",
2828
)
2929
consent_page.click_confirm()
30-
consent_page.expect_text_in_main(
30+
consent_page.expect_confirmation_text(
3131
f"Consent refusedYou’ve told us that you do not want {child.first_name} {child.last_name} to get the HPV vaccination at school"
3232
)
3333

tests/test_programmes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def test_rav_triage_consent_refused(
251251
sessions_page.navigate_to_consent_response(child, Programme.HPV)
252252

253253
consent_page.parent_paper_refuse_consent(child.parents[0])
254-
consent_page.expect_text_in_main(str(child))
254+
consent_page.expect_text_in_alert(str(child))
255255

256256
sessions_page.select_consent_refused()
257257
sessions_page.click_child(child)

0 commit comments

Comments
 (0)