|
263 | 263 | then_i_should_see_the_vaccination_record |
264 | 264 | and_i_should_see_parent_details |
265 | 265 | end |
| 266 | + |
| 267 | + scenario "Breadcrumb shows session-specific path for POC team" do |
| 268 | + given_i_am_signed_in |
| 269 | + and_an_administered_vaccination_record_exists |
| 270 | + |
| 271 | + when_i_visit_the_vaccination_record_directly |
| 272 | + then_i_should_see_the_vaccination_record |
| 273 | + and_i_should_see_the_session_specific_breadcrumb |
| 274 | + end |
266 | 275 | end |
267 | 276 |
|
268 | 277 | context "in bulk upload Mavis" do |
|
296 | 305 | then_i_should_see_the_vaccination_record |
297 | 306 | and_i_should_not_see_parent_details |
298 | 307 | end |
| 308 | + |
| 309 | + scenario "Breadcrumb shows patient-based path when viewing session-based vaccination record" do |
| 310 | + given_i_am_signed_in |
| 311 | + and_a_vaccination_record_with_a_session_exists |
| 312 | + and_the_patient_is_accessible_to_the_upload_only_team |
| 313 | + |
| 314 | + when_i_visit_the_vaccination_record_directly |
| 315 | + then_i_should_see_the_vaccination_record |
| 316 | + and_i_should_see_the_patient_based_breadcrumb |
| 317 | + end |
299 | 318 | end |
300 | 319 |
|
301 | 320 | def given_an_hpv_programme_is_underway |
@@ -709,4 +728,43 @@ def and_i_should_not_see_parent_details |
709 | 728 | expect(page).not_to have_content("First parent or guardian") |
710 | 729 | expect(page).not_to have_content("Second parent or guardian") |
711 | 730 | end |
| 731 | + |
| 732 | + def when_i_visit_the_vaccination_record_directly |
| 733 | + visit vaccination_record_path(@vaccination_record) |
| 734 | + end |
| 735 | + |
| 736 | + def and_i_should_see_the_session_specific_breadcrumb |
| 737 | + breadcrumb = page.find(".nhsuk-breadcrumb") |
| 738 | + expect(breadcrumb).to have_content("Sessions") |
| 739 | + expect(breadcrumb).to have_content(@session.location.name) |
| 740 | + end |
| 741 | + |
| 742 | + def and_a_vaccination_record_with_a_session_exists |
| 743 | + location = create(:school, urn: 100_001) |
| 744 | + |
| 745 | + @session = create(:session, :completed, programmes: [@programme], location:) |
| 746 | + |
| 747 | + @vaccination_record = |
| 748 | + create( |
| 749 | + :vaccination_record, |
| 750 | + batch: @batch, |
| 751 | + patient: @patient, |
| 752 | + session: @session, |
| 753 | + programme: @programme |
| 754 | + ) |
| 755 | + end |
| 756 | + |
| 757 | + def and_the_patient_is_accessible_to_the_upload_only_team |
| 758 | + # Patient is already part of the upload-only team from the before block |
| 759 | + # Just ensure patient_team association exists |
| 760 | + PatientTeam.find_or_create_by!(patient: @patient, team: @team) |
| 761 | + end |
| 762 | + |
| 763 | + def and_i_should_see_the_patient_based_breadcrumb |
| 764 | + # Patient-based breadcrumb should include: Home → Children → Patient name |
| 765 | + # Should NOT include session-specific links (Sessions, Location name) |
| 766 | + breadcrumb = page.find(".nhsuk-breadcrumb") |
| 767 | + expect(breadcrumb).to have_content("Children") |
| 768 | + expect(breadcrumb).not_to have_content("Sessions") |
| 769 | + end |
712 | 770 | end |
0 commit comments