Skip to content

Commit 57afa07

Browse files
committed
Fix tests
1 parent 2098cf8 commit 57afa07

File tree

5 files changed

+43
-42
lines changed

5 files changed

+43
-42
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: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,17 @@
107107
end
108108

109109
def given_there_is_an_application_form
110-
application_form
110+
assessment =
111+
create(:assessment, :with_further_information_request, application_form:)
112+
assessment_section =
113+
create(:assessment_section, :personal_information, assessment:)
114+
assessment.further_information_requests.first.items.each do |item|
115+
create(
116+
:selected_failure_reason,
117+
assessment_section: assessment_section,
118+
key: item.failure_reason_key,
119+
)
120+
end
111121
end
112122

113123
def when_i_click_the_start_button
@@ -151,22 +161,22 @@ def when_i_click_the_text_task_list_item
151161
expect(
152162
teacher_further_information_required_page.failure_reason_heading.text,
153163
).to eq(
154-
"The subjects you entered are acceptable for QTS, but the uploaded qualifications do not match them.",
164+
"The subjects you entered are acceptable for QTS, but the uploaded qualifications do not match them",
155165
)
156166
end
157167

158168
def when_i_click_the_work_history_contact_task_list_item
159169
work_history_task_list_item.click
160170
expect(
161171
teacher_further_information_required_page.failure_reason_heading.text,
162-
).to eq("We could not verify 1 or more references you provided.")
172+
).to eq("We could not verify 1 or more references you provided")
163173
end
164174

165175
def when_i_click_the_document_task_list_item
166176
document_task_list_item.click
167177
expect(
168178
teacher_further_information_required_page.failure_reason_heading.text,
169-
).to eq("Your ID document is illegible or in a format we cannot accept.")
179+
).to eq("Your ID document is illegible or in a format we cannot accept")
170180
end
171181

172182
def when_i_fill_in_the_response
@@ -208,25 +218,21 @@ def when_i_click_the_check_your_answers_task_list_item
208218
end
209219

210220
def check_your_answers_task_list_item
211-
teacher_further_information_requested_page.task_list.find_item(
221+
teacher_further_information_requested_page.task_lists.last.find_item(
212222
"Check your answers before submitting",
213223
)
214224
end
215225

216226
def and_i_see_the_check_your_answers_items
217-
rows =
218-
teacher_check_further_information_request_answers_page.summary_list.rows
227+
lists = teacher_check_further_information_request_answers_page.summary_lists
219228

220-
expect(rows.count).to eq(3)
229+
expect(lists.count).to eq(3)
221230

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")
231+
expect(
232+
teacher_check_further_information_request_answers_page,
233+
).to have_content("Your response").and have_content(
234+
"Reference details",
235+
).and have_content("Identity documents")
230236
end
231237

232238
def when_i_click_the_text_check_your_answers_item
@@ -274,58 +280,51 @@ def teacher
274280

275281
def application_form
276282
@application_form ||=
277-
begin
278-
application_form =
279-
create(
280-
:application_form,
281-
:submitted,
282-
:with_work_history,
283-
statuses: %w[waiting_on_further_information],
284-
teacher:,
285-
)
286-
create(
287-
:assessment,
288-
:with_further_information_request,
289-
application_form:,
290-
)
291-
application_form
292-
end
283+
create(
284+
:application_form,
285+
:submitted,
286+
:with_work_history,
287+
statuses: %w[waiting_on_further_information],
288+
teacher:,
289+
)
293290
end
294291

295292
def further_information_request
296-
application_form.assessment.further_information_requests.first
293+
application_form.reload.assessment.further_information_requests.first
297294
end
298295

299296
def text_task_list_item
300-
teacher_further_information_requested_page.task_list.find_item(
297+
teacher_further_information_requested_page.task_lists.first.find_item(
301298
"Tell us more about the subjects you can teach",
302299
)
303300
end
304301

305302
def text_check_answers_item
306303
teacher_check_further_information_request_answers_page
307-
.summary_list
304+
.summary_lists
305+
.second
308306
.rows
309307
.first
310308
end
311309

312310
def work_history_task_list_item
313-
teacher_further_information_requested_page.task_list.find_item(
311+
teacher_further_information_requested_page.task_lists.first.find_item(
314312
"Update reference details for #{application_form.work_histories.first.school_name}",
315313
)
316314
end
317315

318316
def document_task_list_item
319-
teacher_further_information_requested_page.task_list.find_item(
317+
teacher_further_information_requested_page.task_lists.first.find_item(
320318
"Upload your identity document",
321319
)
322320
end
323321

324322
def document_check_answers_item
325323
teacher_check_further_information_request_answers_page
326-
.summary_list
324+
.summary_lists
325+
.first
327326
.rows
328-
.last
327+
.first
329328
end
330329

331330
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)