Skip to content

Commit 0cd023f

Browse files
committed
Update appointment note system spec
Include assertions covering: - the flash message appearing on note save - seeing the saved note rendered on the appointment details tab
1 parent b861151 commit 0cd023f

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

manage_breast_screening/tests/system/clinical/test_appointment_note.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@ def test_clinical_user_adds_and_updates_an_appointment_note(self):
2020

2121
self.when_i_enter_a_note()
2222
self.and_i_save_the_note()
23+
self.then_i_see_a_message_confirming_the_save()
2324
self.then_the_note_field_contains(self.initial_note_text)
25+
self.and_the_appointment_details_tab_shows_the_note(self.initial_note_text)
2426

2527
self.when_i_update_the_note()
2628
self.and_i_save_the_note()
29+
self.then_i_see_a_message_confirming_the_save()
2730
self.then_the_note_field_contains(self.updated_note_text)
31+
self.and_the_appointment_details_tab_shows_the_note(self.updated_note_text)
2832

2933
def and_there_is_an_appointment_for_my_provider(self):
3034
self.appointment = AppointmentFactory(
@@ -48,6 +52,10 @@ def when_i_enter_a_note(self):
4852
self.page.get_by_label("Note").fill(self.initial_note_text)
4953

5054
def when_i_update_the_note(self):
55+
secondary_nav = self.page.locator(".app-secondary-navigation")
56+
expect(secondary_nav).to_be_visible()
57+
note_tab = secondary_nav.get_by_text("Note")
58+
note_tab.click()
5159
field = self.page.get_by_label("Note")
5260
expect(field).to_have_value(self.initial_note_text)
5361
field.fill(self.updated_note_text)
@@ -61,3 +69,20 @@ def when_i_save_the_note(self):
6169

6270
def then_the_note_field_contains(self, text):
6371
expect(self.page.get_by_label("Note")).to_have_value(text)
72+
73+
def then_i_see_a_message_confirming_the_save(self):
74+
banner = self.page.locator(".nhsuk-notification-banner--success")
75+
expect(banner).to_be_visible()
76+
expect(banner).to_contain_text("Appointment note saved")
77+
78+
def and_the_appointment_details_tab_shows_the_note(self, text):
79+
secondary_nav = self.page.locator(".app-secondary-navigation")
80+
expect(secondary_nav).to_be_visible()
81+
appointment_details_tab = secondary_nav.get_by_text("Appointment details")
82+
appointment_details_tab.click()
83+
84+
note_container = self.page.locator(
85+
".nhsuk-warning-callout", has_text="Appointment note"
86+
)
87+
expect(note_container).to_be_visible()
88+
expect(note_container).to_contain_text(text)

0 commit comments

Comments
 (0)