|
34 | 34 | then_i_see_patients_by_date_of_birth
|
35 | 35 | end
|
36 | 36 |
|
| 37 | + scenario "Search result returns no patients" do |
| 38 | + given_that_i_am_signed_in |
| 39 | + |
| 40 | + when_i_visit_the_session_consent_tab |
| 41 | + and_i_search_for_a_name_that_doesnt_exist |
| 42 | + then_i_see_no_results |
| 43 | + |
| 44 | + when_i_visit_the_session_triage_tab |
| 45 | + and_i_search_for_a_name_that_doesnt_exist |
| 46 | + then_i_see_no_results |
| 47 | + |
| 48 | + when_i_visit_the_session_register_tab |
| 49 | + and_i_search_for_a_name_that_doesnt_exist |
| 50 | + then_i_see_no_results |
| 51 | + |
| 52 | + when_i_visit_the_session_record_tab |
| 53 | + and_i_search_for_a_name_that_doesnt_exist |
| 54 | + then_i_see_no_results |
| 55 | + |
| 56 | + when_i_visit_the_session_outcome_tab |
| 57 | + and_i_search_for_a_name_that_doesnt_exist |
| 58 | + then_i_see_no_results |
| 59 | + end |
| 60 | + |
37 | 61 | def given_that_i_am_signed_in
|
38 | 62 | organisation = create(:organisation, :with_one_nurse)
|
39 | 63 |
|
| 64 | + location = create(:school, name: "Waterloo Road") |
| 65 | + @session = create(:session, location:, organisation:) |
| 66 | + |
40 | 67 | [
|
41 | 68 | %w[Aaron Smith],
|
42 | 69 | %w[Aardvark Jones],
|
43 | 70 | %w[Casey Brown],
|
44 | 71 | %w[Cassidy Wilson],
|
45 | 72 | %w[Bob Taylor]
|
46 | 73 | ].each do |(given_name, family_name)|
|
47 |
| - create(:patient, given_name:, family_name:, organisation:) |
| 74 | + create(:patient, given_name:, family_name:, session: @session) |
48 | 75 | end
|
49 | 76 |
|
50 | 77 | create(
|
51 | 78 | :patient,
|
52 | 79 | given_name: "Salvor",
|
53 | 80 | family_name: "Hardin",
|
54 |
| - organisation:, |
| 81 | + session: @session, |
55 | 82 | nhs_number: nil
|
56 | 83 | )
|
57 | 84 |
|
58 | 85 | create(
|
59 | 86 | :patient,
|
60 | 87 | given_name: "Hari",
|
61 | 88 | family_name: "Seldon",
|
62 |
| - organisation:, |
| 89 | + session: @session, |
63 | 90 | date_of_birth: Date.new(2013, 1, 1)
|
64 | 91 | )
|
65 | 92 |
|
@@ -172,4 +199,33 @@ def then_i_see_patients_by_date_of_birth
|
172 | 199 | expect(page).not_to have_content("HARDIN, Salvor")
|
173 | 200 | expect(page).to have_content("SELDON, Hari")
|
174 | 201 | end
|
| 202 | + |
| 203 | + def when_i_visit_the_session_consent_tab |
| 204 | + visit session_consent_path(@session) |
| 205 | + end |
| 206 | + |
| 207 | + def when_i_visit_the_session_triage_tab |
| 208 | + visit session_triage_path(@session) |
| 209 | + end |
| 210 | + |
| 211 | + def when_i_visit_the_session_register_tab |
| 212 | + visit session_register_path(@session) |
| 213 | + end |
| 214 | + |
| 215 | + def when_i_visit_the_session_record_tab |
| 216 | + visit session_record_path(@session) |
| 217 | + end |
| 218 | + |
| 219 | + def when_i_visit_the_session_outcome_tab |
| 220 | + visit session_outcome_path(@session) |
| 221 | + end |
| 222 | + |
| 223 | + def and_i_search_for_a_name_that_doesnt_exist |
| 224 | + fill_in "Search", with: "Name doesn't exist" |
| 225 | + click_on "Search" |
| 226 | + end |
| 227 | + |
| 228 | + def then_i_see_no_results |
| 229 | + expect(page).to have_content("No children matching search criteria found") |
| 230 | + end |
175 | 231 | end
|
0 commit comments