From 31e9cc8d142cfa2e87a2ba740de26c1358eb664f Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Mon, 9 Oct 2023 12:26:34 +0100 Subject: [PATCH] Update system tests for verifying LoPS This updates the system tests for verifying LoPS to use the newer verify page and updates to use the right permissions. --- app/components/status_tag/component.rb | 2 +- .../review_verifications_controller.rb | 2 ++ app/models/concerns/requestable.rb | 2 +- ...edit_verify_professional_standing.html.erb | 2 +- .../edit_request.html.erb | 14 +++++----- .../show.html.erb | 2 +- .../review_verifications/index.html.erb | 8 +++++- .../assessor_interface/complete_assessment.rb | 6 +++++ spec/support/shared_examples/requestable.rb | 2 +- .../pre_assessment_tasks_spec.rb | 6 ++--- ...> reviewing_professional_standing_spec.rb} | 27 ++++++++++++++++--- .../verifying_professional_standing_spec.rb | 24 ++++++++--------- .../verifying_references_spec.rb | 2 +- 13 files changed, 67 insertions(+), 32 deletions(-) rename spec/system/assessor_interface/{reviewing_verifications_spec.rb => reviewing_professional_standing_spec.rb} (79%) diff --git a/app/components/status_tag/component.rb b/app/components/status_tag/component.rb index ce7498cc57..38d6365775 100644 --- a/app/components/status_tag/component.rb +++ b/app/components/status_tag/component.rb @@ -53,7 +53,7 @@ def tags received_reference: "purple", rejected: "red", requested: "yellow", - review: "purple", + review: "pink", submitted: "grey", valid: "green", verification: "yellow", diff --git a/app/controllers/assessor_interface/review_verifications_controller.rb b/app/controllers/assessor_interface/review_verifications_controller.rb index c50468cbe9..786f1c6f56 100644 --- a/app/controllers/assessor_interface/review_verifications_controller.rb +++ b/app/controllers/assessor_interface/review_verifications_controller.rb @@ -10,6 +10,8 @@ def index @professional_standing_request = assessment.professional_standing_request if assessment.professional_standing_request.verify_failed? + + render layout: "full_from_desktop" end private diff --git a/app/models/concerns/requestable.rb b/app/models/concerns/requestable.rb index 6889e0131d..bd4ebc49c8 100644 --- a/app/models/concerns/requestable.rb +++ b/app/models/concerns/requestable.rb @@ -60,7 +60,7 @@ def verify_failed? def status if verify_passed? || review_passed? - "accepted" + "completed" elsif review_failed? "rejected" elsif verify_failed? diff --git a/app/views/assessor_interface/assessment_recommendation_verify/edit_verify_professional_standing.html.erb b/app/views/assessor_interface/assessment_recommendation_verify/edit_verify_professional_standing.html.erb index 10c35c7457..39e008a565 100644 --- a/app/views/assessor_interface/assessment_recommendation_verify/edit_verify_professional_standing.html.erb +++ b/app/views/assessor_interface/assessment_recommendation_verify/edit_verify_professional_standing.html.erb @@ -6,7 +6,7 @@

<%= t(".heading") %>

-

If you choose to verify this applicant’s letter of professional standing, you’ll need to email the competent authority directly, then come back to record the outcome.

+

If you choose to verify this application's LoPS an admin will email the competent authority and record the response.

<%= f.govuk_collection_radio_buttons :verify_professional_standing, %i[true false], :itself, legend: nil %> diff --git a/app/views/assessor_interface/professional_standing_requests/edit_request.html.erb b/app/views/assessor_interface/professional_standing_requests/edit_request.html.erb index e9e5878e81..a3ea056716 100644 --- a/app/views/assessor_interface/professional_standing_requests/edit_request.html.erb +++ b/app/views/assessor_interface/professional_standing_requests/edit_request.html.erb @@ -5,23 +5,25 @@

<%= title %>

-

To verify the applications LoPS you need to:

+

To verify the application’s LoPS you need to:

-

+

Do you want to mark this task as completed and come back after you have sent the email from Zendesk?

<%= form_with model: @form, url: [:request, :assessor_interface, @application_form, @assessment, :professional_standing_request] do |f| %> - <%= f.govuk_radio_button :passed, :true, label: { text: "Yes, mark as completed" }, link_errors: true %> - <%= f.govuk_radio_button :passed, :false, label: { text: "No, come back later" } %> + <%= f.govuk_radio_buttons_fieldset :passed, legend: nil do %> + <%= f.govuk_radio_button :passed, :true, label: { text: "Yes, mark as completed" }, link_errors: true %> + <%= f.govuk_radio_button :passed, :false, label: { text: "No, come back later" } %> + <% end %> <%= f.govuk_submit do %> <%= govuk_link_to "Cancel", [:assessor_interface, @application_form, @assessment, :professional_standing_request] %> diff --git a/app/views/assessor_interface/professional_standing_requests/show.html.erb b/app/views/assessor_interface/professional_standing_requests/show.html.erb index 4b864737bd..cd21887ef4 100644 --- a/app/views/assessor_interface/professional_standing_requests/show.html.erb +++ b/app/views/assessor_interface/professional_standing_requests/show.html.erb @@ -4,7 +4,7 @@

Verify LoPS

- You need to request verification for this applications LoPS. Follow the steps below: + You need to request verification for this application’s LoPS.

<%= render(TaskList::Component.new( diff --git a/app/views/assessor_interface/review_verifications/index.html.erb b/app/views/assessor_interface/review_verifications/index.html.erb index 3afc20c8d4..413b5db8a8 100644 --- a/app/views/assessor_interface/review_verifications/index.html.erb +++ b/app/views/assessor_interface/review_verifications/index.html.erb @@ -3,6 +3,10 @@

Review verifications

+

+ The following verification tasks have been flagged for review: +

+ <%= govuk_table do |table| if @professional_standing_request.present? table.with_caption(text: "LoPS") @@ -15,4 +19,6 @@ end end %> -<%= govuk_button_link_to "Back to overview", [:assessor_interface, @application_form] %> +
+ <%= govuk_button_link_to "Back to overview", [:assessor_interface, @application_form] %> +
diff --git a/spec/support/autoload/page_objects/assessor_interface/complete_assessment.rb b/spec/support/autoload/page_objects/assessor_interface/complete_assessment.rb index 9372b58282..9a1e24be8b 100644 --- a/spec/support/autoload/page_objects/assessor_interface/complete_assessment.rb +++ b/spec/support/autoload/page_objects/assessor_interface/complete_assessment.rb @@ -20,6 +20,12 @@ def request_further_information def decline_qts new_states.find { |radio_item| radio_item.label.text == "Decline QTS" } end + + def send_for_review + new_states.find do |radio_item| + radio_item.label.text == "Send application for review" + end + end end end end diff --git a/spec/support/shared_examples/requestable.rb b/spec/support/shared_examples/requestable.rb index 9b8327d207..1adef3d687 100644 --- a/spec/support/shared_examples/requestable.rb +++ b/spec/support/shared_examples/requestable.rb @@ -52,7 +52,7 @@ it "is accepted when passed is true" do subject.review_passed = true subject.reviewed_at = Time.zone.now - expect(subject.status).to eq("accepted") + expect(subject.status).to eq("completed") end it "is rejected when passed is false" do diff --git a/spec/system/assessor_interface/pre_assessment_tasks_spec.rb b/spec/system/assessor_interface/pre_assessment_tasks_spec.rb index 536fe83fd0..87b300230c 100644 --- a/spec/system/assessor_interface/pre_assessment_tasks_spec.rb +++ b/spec/system/assessor_interface/pre_assessment_tasks_spec.rb @@ -43,8 +43,8 @@ end it "locate professional standing" do - when_i_visit_the(:assessor_application_page, application_id:) - then_i_see_the(:assessor_application_page, application_id:) + when_i_visit_the(:assessor_application_page, application_form_id:) + then_i_see_the(:assessor_application_page, application_form_id:) and_i_see_a_waiting_on_status and_i_click_awaiting_professional_standing then_i_see_the( @@ -53,7 +53,7 @@ ) when_i_fill_in_the_locate_form - then_i_see_the(:assessor_application_page, application_id:) + then_i_see_the(:assessor_application_page, application_form_id:) and_i_see_a_preliminary_check_status and_the_teacher_receives_a_professional_standing_received_email end diff --git a/spec/system/assessor_interface/reviewing_verifications_spec.rb b/spec/system/assessor_interface/reviewing_professional_standing_spec.rb similarity index 79% rename from spec/system/assessor_interface/reviewing_verifications_spec.rb rename to spec/system/assessor_interface/reviewing_professional_standing_spec.rb index 07c4ce1d13..f086b04ad5 100644 --- a/spec/system/assessor_interface/reviewing_verifications_spec.rb +++ b/spec/system/assessor_interface/reviewing_professional_standing_spec.rb @@ -14,6 +14,18 @@ then_i_see_the(:assessor_application_page, application_form_id:) when_i_click_on_verification_decision + then_i_see_the(:assessor_complete_assessment_page, application_form_id:) + + when_i_select_send_for_review + then_i_see_the( + :assessor_assessment_recommendation_review_page, + application_form_id:, + ) + + when_i_click_continue_from_review + then_i_see_the(:assessor_application_status_page, application_form_id:) + + when_i_click_on_overview_button then_i_see_the(:assessor_application_page, application_form_id:) when_i_click_on_review_verifications @@ -58,12 +70,19 @@ def given_there_is_an_application_form_with_failed_verifications def when_i_click_on_verification_decision assessor_application_page.verification_decision_task.click + end - # TODO: review functionality is not built yet, this page can never be reached - application_form.assessment.review! + def when_i_select_send_for_review + assessor_complete_assessment_page.send_for_review.choose + assessor_complete_assessment_page.continue_button.click + end - # TODO: reload the page - when_i_visit_the(:assessor_application_page, application_form_id:) + def when_i_click_continue_from_review + assessor_assessment_recommendation_review_page.continue_button.click + end + + def when_i_click_on_overview_button + assessor_application_status_page.button_group.overview_button.click end def when_i_click_on_review_verifications diff --git a/spec/system/assessor_interface/verifying_professional_standing_spec.rb b/spec/system/assessor_interface/verifying_professional_standing_spec.rb index cf451cdfe9..56ff10884d 100644 --- a/spec/system/assessor_interface/verifying_professional_standing_spec.rb +++ b/spec/system/assessor_interface/verifying_professional_standing_spec.rb @@ -43,18 +43,18 @@ ) and_the_request_lops_verification_status_is("COMPLETED") - # when_i_click_record_lops_verification - # then_i_see_the( - # :assessor_verify_professional_standing_request_page, - # application_form_id:, - # assessment_id:, - # ) - # and_i_fill_in_the_verify_form - # then_i_see_the( - # :assessor_professional_standing_request_page, - # application_form_id:, - # assessment_id:, - # ) + when_i_click_record_lops_verification + then_i_see_the( + :assessor_verify_professional_standing_request_page, + application_form_id:, + assessment_id:, + ) + and_i_fill_in_the_verify_form + then_i_see_the( + :assessor_professional_standing_request_page, + application_form_id:, + assessment_id:, + ) end private diff --git a/spec/system/assessor_interface/verifying_references_spec.rb b/spec/system/assessor_interface/verifying_references_spec.rb index a1a160b224..dcd3581696 100644 --- a/spec/system/assessor_interface/verifying_references_spec.rb +++ b/spec/system/assessor_interface/verifying_references_spec.rb @@ -117,7 +117,7 @@ def when_i_verify_the_reference_request def then_i_see_the_reference_request_status_is_accepted expect( assessor_reference_requests_page.task_list.status_tags.first.text, - ).to eq("ACCEPTED") + ).to eq("COMPLETED") end def when_i_verify_that_all_references_are_accepted