Skip to content

Commit 4181047

Browse files
authored
Merge pull request #462 from NHSDigital/fix-titles
[DTOSS-11153] Fix a few cases where the page title wasn't being set
2 parents 20b6538 + 1354d47 commit 4181047

12 files changed

+44
-5
lines changed

manage_breast_screening/mammograms/views/special_appointment_views.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def get_context_data(self, **kwargs):
3737
"text": "Back to appointment",
3838
},
3939
"caption": self.participant.full_name,
40+
"page_title": "Provide special appointment details",
4041
"heading": "Provide special appointment details",
4142
},
4243
)
@@ -91,6 +92,7 @@ def get_context_data(self, **kwargs):
9192
"text": "Back",
9293
},
9394
"caption": self.participant.full_name,
95+
"page_title": "Which of these reasons are temporary?",
9496
"heading": "Which of these reasons are temporary?",
9597
},
9698
)

manage_breast_screening/mammograms/views/symptom_views.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def get_context_data(self, **kwargs):
4545
"back_link_params": self.get_back_link_params(),
4646
"caption": participant.full_name,
4747
"heading": f"Details of the {self.symptom_type_name}",
48+
"page_title": f"Details of the {self.symptom_type_name}",
4849
},
4950
)
5051

@@ -143,6 +144,7 @@ def get(self, request, *args, **kwargs):
143144
symptom = get_object_or_404(Symptom, pk=kwargs["symptom_pk"])
144145

145146
context = {
147+
"page_title": "Are you sure you want to delete this symptom?",
146148
"heading": "Are you sure you want to delete this symptom?",
147149
"confirm_action": {
148150
"text": "Delete symptom",

manage_breast_screening/tests/system/administrative/test_participant_record.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ def then_i_should_be_on_the_participant_record_page(self):
111111
kwargs={"pk": self.participant.pk},
112112
)
113113
expect(self.page).to_have_url(re.compile(path))
114+
self.assert_page_title_contains("Participant")
114115

115116
def and_i_should_see_the_participant_record(self):
116117
main = self.page.get_by_role("main")

manage_breast_screening/tests/system/clinical/test_adding_previous_mammograms.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ def then_i_should_be_on_the_add_previous_mammogram_form(self):
9595
kwargs={"pk": self.participant.pk},
9696
)
9797
expect(self.page).to_have_url(re.compile(path))
98+
self.assert_page_title_contains("Add details of a previous mammogram")
9899

99100
def then_i_should_be_back_on_the_appointment(self):
100101
path = reverse(

manage_breast_screening/tests/system/clinical/test_editing_special_appointments.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ def test_setting_up_a_special_appointment(self):
3030
self.given_i_am_logged_in_as_a_clinical_user()
3131
self.and_i_am_on_the_appointment_show_page()
3232
self.when_i_click_on_make_special_appointment()
33-
self.and_i_add_a_reason()
33+
self.then_i_am_on_the_special_appointment_form()
34+
35+
self.when_i_add_a_reason()
3436
self.and_i_select_no_reasons_are_temporary()
3537
self.and_i_submit_the_form()
3638
self.then_i_am_back_on_the_appointment()
@@ -158,11 +160,16 @@ def when_i_click_on_the_change_link(self):
158160
banner = self.page.locator(".nhsuk-warning-callout")
159161
banner.get_by_text("Change").click()
160162

163+
def then_i_am_on_the_special_appointment_form(self):
164+
self.assert_page_title_contains("Provide special appointment details")
165+
161166
def and_i_add_a_reason(self):
162167
self.page.get_by_label("Hearing").click()
163168
self.page.keyboard.press("Tab")
164169
self.page.locator("*:focus").fill("Deaf in one ear")
165170

171+
when_i_add_a_reason = and_i_add_a_reason
172+
166173
def and_i_add_another_reason(self):
167174
self.page.get_by_label("Gender identity").click()
168175
self.page.keyboard.press("Tab")

manage_breast_screening/tests/system/clinical/test_ethnicity_details_form.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_entering_ethnicity_details_for_a_participant(self):
2424
self.given_i_am_logged_in_as_a_clinical_user()
2525
self.and_i_am_viewing_an_appointment()
2626
self.when_i_click_on_enter_ethnicity_details()
27-
self.then_i_should_be_on_the_ethnicity_details_form()
27+
self.then_i_am_on_the_ethnicity_details_form()
2828

2929
self.when_i_submit_the_form()
3030
self.then_i_see_an_error()
@@ -35,7 +35,7 @@ def test_entering_ethnicity_details_for_a_participant(self):
3535
self.and_the_ethnicity_is_updated_to("Asian or Asian British (Chinese)")
3636

3737
self.when_i_click_the_change_ethnicity_link()
38-
self.then_i_should_be_on_the_ethnicity_details_form()
38+
self.then_i_am_on_the_ethnicity_details_form()
3939
self.and_the_saved_ethnicity_is_selected("Chinese")
4040
self.when_i_select_an_ethnicity("Any other White background")
4141
self.and_i_submit_the_form()
@@ -52,7 +52,7 @@ def test_entering_ethnicity_description_provided_by_the_participant(self):
5252
self.given_i_am_logged_in_as_a_clinical_user()
5353
self.and_i_am_viewing_an_appointment()
5454
self.when_i_click_on_enter_ethnicity_details()
55-
self.then_i_should_be_on_the_ethnicity_details_form()
55+
self.then_i_am_on_the_ethnicity_details_form()
5656

5757
self.when_i_select_an_ethnicity("Any other White background")
5858
self.and_i_enter_an_ethnicity_description_provided_by_the_participant(
@@ -83,7 +83,7 @@ def and_i_am_viewing_an_appointment(self):
8383
def when_i_click_on_enter_ethnicity_details(self):
8484
self.page.get_by_role("link", name="Enter ethnicity details").click()
8585

86-
def then_i_should_be_on_the_ethnicity_details_form(self):
86+
def then_i_am_on_the_ethnicity_details_form(self):
8787
expect(self.page).to_have_url(
8888
re.compile(
8989
reverse(
@@ -92,6 +92,7 @@ def then_i_should_be_on_the_ethnicity_details_form(self):
9292
)
9393
)
9494
)
95+
self.assert_page_title_contains("Ethnicity")
9596

9697
def when_i_submit_the_form(self):
9798
self.page.get_by_role("button", name="Save and continue").click()

manage_breast_screening/tests/system/clinical/test_recording_a_mammogram.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,15 @@ def then_i_should_be_on_the_medical_information_page(self):
121121
kwargs={"pk": self.appointment.pk},
122122
)
123123
expect(self.page).to_have_url(re.compile(path))
124+
self.assert_page_title_contains("Medical information")
124125

125126
def then_i_should_be_on_the_record_medical_information_page(self):
126127
path = reverse(
127128
"mammograms:record_medical_information",
128129
kwargs={"pk": self.appointment.pk},
129130
)
130131
expect(self.page).to_have_url(re.compile(path))
132+
self.assert_page_title_contains("Record medical information")
131133

132134
def and_i_should_be_prompted_to_ask_about_relevant_medical_information(self):
133135
expect(
@@ -156,6 +158,7 @@ def then_the_screen_should_show_that_it_is_awaiting_images_from_the_PACS(self):
156158
kwargs={"pk": self.appointment.pk},
157159
)
158160
expect(self.page).to_have_url(re.compile(path))
161+
self.assert_page_title_contains("Awaiting images")
159162

160163
def then_i_am_prompted_to_answer_can_the_screening_go_ahead(self):
161164
self.expect_validation_error(

manage_breast_screening/tests/system/clinical/test_recording_symptoms.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ def when_i_click_on_add_a_lump(self):
9292

9393
def then_i_see_the_add_a_lump_form(self):
9494
expect(self.page.get_by_text("Details of the lump")).to_be_visible()
95+
self.assert_page_title_contains("Details of the lump")
9596

9697
def when_i_select_right_breast(self):
9798
self.page.get_by_label("Right breast").click()

manage_breast_screening/tests/system/clinical/test_user_submits_cannot_go_ahead_form.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def and_i_am_on_the_cannot_go_ahead_form(self):
5151
kwargs={"pk": self.appointment.pk},
5252
)
5353
)
54+
self.assert_page_title_contains("Appointment cannot go ahead")
5455

5556
def when_i_submit_the_form(self):
5657
self.page.get_by_role("button", name="Continue").click()

manage_breast_screening/tests/system/general/test_user_views_clinic_show_page.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from django.urls import reverse
66
from playwright.sync_api import expect
77

8+
from manage_breast_screening.clinics.models import Clinic
89
from manage_breast_screening.clinics.tests.factories import ClinicFactory
910
from manage_breast_screening.core.utils.date_formatting import format_date, format_time
1011
from manage_breast_screening.core.utils.string_formatting import (
@@ -66,6 +67,7 @@ def and_a_clinic_exists_that_is_run_by_my_provider(self):
6667
starts_at=self.clinic_start_time,
6768
setting__name="West London BSS",
6869
setting__provider=user_assignment.provider,
70+
risk_type=Clinic.RiskType.ROUTINE_RISK,
6971
)
7072

7173
def and_there_are_appointments(self):
@@ -100,12 +102,14 @@ def and_there_are_appointments(self):
100102

101103
def and_i_am_on_the_clinic_list(self):
102104
self.page.goto(self.live_server_url + reverse("clinics:index"))
105+
self.assert_page_title_contains("Today’s clinics")
103106

104107
def and_i_am_on_the_clinic_show_page(self):
105108
self.page.goto(
106109
self.live_server_url
107110
+ reverse("clinics:show", kwargs={"pk": self.clinic.pk})
108111
)
112+
self.assert_page_title_contains("Routine risk screening clinic")
109113

110114
def when_i_click_on_the_clinic(self):
111115
self.page.get_by_role("link", name="West London BSS").click()

0 commit comments

Comments
 (0)