Skip to content

Commit 973ea36

Browse files
committed
Fix tests
1 parent 2098cf8 commit 973ea36

File tree

5 files changed

+39
-29
lines changed

5 files changed

+39
-29
lines changed

spec/support/autoload/page_objects/govuk_task_list.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class GovukTaskList < SitePrism::Section
1010
end
1111

1212
def find_item(text)
13-
items.find { |item| item.name_and_hint.text == text }
13+
items.find { |item| item.name_and_hint.text.include?(text) }
1414
end
1515

1616
def click_item(link_text)

spec/support/autoload/page_objects/teacher_interface/check_further_information_request_answers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class CheckFurtherInformationRequestAnswers < SitePrism::Page
66
set_url "/teacher/application/further_information_requests/{request_id}/edit"
77

88
element :heading, ".govuk-heading-xl"
9-
section :summary_list, GovukSummaryList, ".govuk-summary-list"
9+
sections :summary_lists, GovukSummaryList, ".govuk-summary-list"
1010
element :submit_button, ".govuk-button"
1111
end
1212
end

spec/support/autoload/page_objects/teacher_interface/further_information_requested.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class FurtherInformationRequested < SitePrism::Page
66
set_url "/teacher/application/further_information_requests/{request_id}"
77

88
element :heading, ".govuk-heading-l"
9-
section :task_list, GovukTaskList, ".govuk-task-list"
9+
sections :task_lists, GovukTaskList, ".govuk-task-list"
1010

1111
element :check_your_answers_button,
1212
".govuk-button:not(.govuk-button--secondary)"

spec/system/teacher_interface/further_information_spec.rb

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -151,22 +151,22 @@ def when_i_click_the_text_task_list_item
151151
expect(
152152
teacher_further_information_required_page.failure_reason_heading.text,
153153
).to eq(
154-
"The subjects you entered are acceptable for QTS, but the uploaded qualifications do not match them.",
154+
"The subjects you entered are acceptable for QTS, but the uploaded qualifications do not match them",
155155
)
156156
end
157157

158158
def when_i_click_the_work_history_contact_task_list_item
159159
work_history_task_list_item.click
160160
expect(
161161
teacher_further_information_required_page.failure_reason_heading.text,
162-
).to eq("We could not verify 1 or more references you provided.")
162+
).to eq("We could not verify 1 or more references you provided")
163163
end
164164

165165
def when_i_click_the_document_task_list_item
166166
document_task_list_item.click
167167
expect(
168168
teacher_further_information_required_page.failure_reason_heading.text,
169-
).to eq("Your ID document is illegible or in a format we cannot accept.")
169+
).to eq("Your ID document is illegible or in a format we cannot accept")
170170
end
171171

172172
def when_i_fill_in_the_response
@@ -208,25 +208,21 @@ def when_i_click_the_check_your_answers_task_list_item
208208
end
209209

210210
def check_your_answers_task_list_item
211-
teacher_further_information_requested_page.task_list.find_item(
211+
teacher_further_information_requested_page.task_lists.last.find_item(
212212
"Check your answers before submitting",
213213
)
214214
end
215215

216216
def and_i_see_the_check_your_answers_items
217-
rows =
218-
teacher_check_further_information_request_answers_page.summary_list.rows
217+
lists = teacher_check_further_information_request_answers_page.summary_lists
219218

220-
expect(rows.count).to eq(3)
219+
expect(lists.count).to eq(3)
221220

222-
expect(rows.first.key.text).to eq(
223-
"Tell us more about the subjects you can teach",
224-
)
225-
expect(rows.second.key.text).to eq(
226-
"Update reference details for #{application_form.work_histories.first.school_name}",
227-
)
228-
229-
expect(rows.last.key.text).to eq("Upload your identity document")
221+
expect(
222+
teacher_check_further_information_request_answers_page,
223+
).to have_content("Your response").and have_content(
224+
"Reference details",
225+
).and have_content("Identity documents")
230226
end
231227

232228
def when_i_click_the_text_check_your_answers_item
@@ -283,11 +279,21 @@ def application_form
283279
statuses: %w[waiting_on_further_information],
284280
teacher:,
285281
)
286-
create(
287-
:assessment,
288-
:with_further_information_request,
289-
application_form:,
290-
)
282+
assessment =
283+
create(
284+
:assessment,
285+
:with_further_information_request,
286+
application_form:,
287+
)
288+
assessment_section =
289+
create(:assessment_section, :personal_information, assessment:)
290+
assessment.further_information_requests.first.items.each do |item|
291+
create(
292+
:selected_failure_reason,
293+
assessment_section: assessment_section,
294+
key: item.failure_reason_key,
295+
)
296+
end
291297
application_form
292298
end
293299
end
@@ -297,35 +303,37 @@ def further_information_request
297303
end
298304

299305
def text_task_list_item
300-
teacher_further_information_requested_page.task_list.find_item(
306+
teacher_further_information_requested_page.task_lists.first.find_item(
301307
"Tell us more about the subjects you can teach",
302308
)
303309
end
304310

305311
def text_check_answers_item
306312
teacher_check_further_information_request_answers_page
307-
.summary_list
313+
.summary_lists
314+
.second
308315
.rows
309316
.first
310317
end
311318

312319
def work_history_task_list_item
313-
teacher_further_information_requested_page.task_list.find_item(
320+
teacher_further_information_requested_page.task_lists.first.find_item(
314321
"Update reference details for #{application_form.work_histories.first.school_name}",
315322
)
316323
end
317324

318325
def document_task_list_item
319-
teacher_further_information_requested_page.task_list.find_item(
326+
teacher_further_information_requested_page.task_lists.first.find_item(
320327
"Upload your identity document",
321328
)
322329
end
323330

324331
def document_check_answers_item
325332
teacher_check_further_information_request_answers_page
326-
.summary_list
333+
.summary_lists
334+
.first
327335
.rows
328-
.last
336+
.first
329337
end
330338

331339
def then_i_see_the_warning_text

spec/view_objects/teacher_interface/further_information_request_view_object_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
status: "not_started",
8686
value: nil,
8787
value_title: "Your response",
88+
assessor_note: text_item.failure_reason_assessor_feedback,
8889
],
8990
},
9091
)
@@ -108,6 +109,7 @@
108109
status: "not_started",
109110
value: document_item.document,
110111
value_title: "Identity documents",
112+
assessor_note: document_item.failure_reason_assessor_feedback,
111113
],
112114
},
113115
)

0 commit comments

Comments
 (0)