From c7a88f45bbf32a4b32c59c9d25b7231dd1f2ea3f Mon Sep 17 00:00:00 2001
From: Richard Pattinson
To verify the applications 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_submit do %> + <%= govuk_link_to "Cancel", [:assessor_interface, @application_form, @assessment, :professional_standing_request] %> + <% end %> +<% end %> diff --git a/app/views/assessor_interface/professional_standing_requests/show.html.erb b/app/views/assessor_interface/professional_standing_requests/show.html.erb new file mode 100644 index 0000000000..5f93a2ffb8 --- /dev/null +++ b/app/views/assessor_interface/professional_standing_requests/show.html.erb @@ -0,0 +1,44 @@ +<% content_for :page_title, "Verify LoPS" %> +<% content_for :back_link_url, assessor_interface_application_form_path(@application_form) %> + ++ You need to request verification for this applications LoPS. Follow the steps below: +
+ +<%= render(TaskList::Component.new( + [ + { + title: "", + items: [ + { + name: "Request LoPS verification", + link: unless @professional_standing_request.requested? + [ + :request, + :assessor_interface, + @application_form, + @assessment, + :professional_standing_request, + ] + end, + status: @professional_standing_request.requested? ? "completed" : "not_started" + }, + { + name: "Record LoPS verification", + link: [ + :review, + :assessor_interface, + @application_form, + @assessment, + :professional_standing_request + ], + status: @professional_standing_request.status, + } + ], + } + ] +)) %> + +<%= govuk_button_link_to "Back to overview", [:assessor_interface, @application_form] %> diff --git a/config/locales/assessor_interface.en.yml b/config/locales/assessor_interface.en.yml index 77c257b56a..86b684b439 100644 --- a/config/locales/assessor_interface.en.yml +++ b/config/locales/assessor_interface.en.yml @@ -392,6 +392,10 @@ en: blank: Enter why you selected ‘No’ failed: inclusion: Select whether you want to mark this qualification as ‘Rejected’ + assessor_interface/requestable_request_form: + attributes: + passed: + inclusion: Select whether you are satisfied that this is completed assessor_interface/requestable_review_form: attributes: passed: diff --git a/config/locales/helpers.en.yml b/config/locales/helpers.en.yml index 36f91f592f..7c19b18e1a 100644 --- a/config/locales/helpers.en.yml +++ b/config/locales/helpers.en.yml @@ -15,8 +15,6 @@ en: text: Use the text box to add a note to the application history. Other assessors will be able to see any notes you add, but they will not be visible to the applicant. assessor_interface_filter_form: reference: "Example: 210245" - assessor_interface_professional_standing_request_location_form: - location_note: Use this space to add any useful notes, for example, where to locate the response. assessor_interface_work_history_contact_form: name: Type the updated full name in the text box below job: Type the updated job title in the text box below @@ -106,14 +104,6 @@ en: location: Country trained in name: Applicant name reference: Application reference number - assessor_interface_professional_standing_request_location_form: - received_options: - true: "Yes" - false: "No" - ready_for_review_options: - true: "Yes, move to review" - false: "No, allow more time for a response" - location_note: Your notes (optional) assessor_interface_qualification_request_form: received_options: true: "Yes" @@ -286,9 +276,6 @@ en: submitted_at: Created date submitted_at_after: Start date submitted_at_before: End date - assessor_interface_professional_standing_request_location_form: - received: Have you received a response about this letter of professional standing? - ready_for_review: Do you want to mark this for review? assessor_interface_qualification_request_form: received: Have you received a response about this qualification? passed: Does the response show that the qualification is legitimate? diff --git a/config/routes.rb b/config/routes.rb index 004633a752..cd65988e79 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -111,10 +111,12 @@ resource :professional_standing_request, path: "/professional-standing-request", - only: [] do + only: [:show] do member do get "locate", to: "professional_standing_requests#edit_locate" post "locate", to: "professional_standing_requests#update_locate" + get "request", to: "professional_standing_requests#edit_request" + post "request", to: "professional_standing_requests#update_request" get "review", to: "professional_standing_requests#edit_review" post "review", to: "professional_standing_requests#update_review" get "verify", to: "professional_standing_requests#edit_verify" diff --git a/spec/factories/assessments.rb b/spec/factories/assessments.rb index 3e07c547b0..1ea36cb5cc 100644 --- a/spec/factories/assessments.rb +++ b/spec/factories/assessments.rb @@ -80,6 +80,12 @@ end trait :with_professional_standing_request do + after(:create) do |assessment, _evaluator| + create(:professional_standing_request, assessment:) + end + end + + trait :with_requested_professional_standing_request do after(:create) do |assessment, _evaluator| create(:professional_standing_request, :requested, assessment:) end diff --git a/spec/support/autoload/page_objects/assessor_interface/professional_standing_request.rb b/spec/support/autoload/page_objects/assessor_interface/professional_standing_request.rb new file mode 100644 index 0000000000..a8930584ea --- /dev/null +++ b/spec/support/autoload/page_objects/assessor_interface/professional_standing_request.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module PageObjects + module AssessorInterface + class ProfessionalStandingRequest < SitePrism::Page + set_url "/assessor/applications/{application_form_id}/assessments/{assessment_id}" \ + "/professional-standing-request" + + section :task_list, TaskList, ".app-task-list" + element :status_tag, ".govuk-tag" + + def request_lops_verification_task + task_list.find_item("Request LoPS verification") + end + + def record_lops_verification_task + task_list.find_item("Record LoPS verification") + end + end + end +end diff --git a/spec/support/autoload/page_objects/assessor_interface/request_professional_standing_request.rb b/spec/support/autoload/page_objects/assessor_interface/request_professional_standing_request.rb new file mode 100644 index 0000000000..1f1d6eee95 --- /dev/null +++ b/spec/support/autoload/page_objects/assessor_interface/request_professional_standing_request.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module PageObjects + module AssessorInterface + class RequestProfessionalStandingRequest < SitePrism::Page + set_url "/assessor/applications/{application_form_id}/assessments/{assessment_id}" \ + "/professional-standing-request/request" + + section :form, "form" do + element :yes_radio_item, + "#assessor-interface-requestable-request-form-passed-true-field", + visible: false + element :no_radio_item, + "#assessor-interface-requestable-request-form-passed-false-field", + visible: false + element :continue_button, "button" + end + end + end +end diff --git a/spec/support/page_helpers.rb b/spec/support/page_helpers.rb index 67efc39e6a..3ded556910 100644 --- a/spec/support/page_helpers.rb +++ b/spec/support/page_helpers.rb @@ -151,6 +151,11 @@ def assessor_preview_teacher_assessment_recommendation_award_page PageObjects::AssessorInterface::PreviewTeacherAssessmentRecommendationAward.new end + def assessor_professional_standing_request_page + @assessor_professional_standing_request_page ||= + PageObjects::AssessorInterface::ProfessionalStandingRequest.new + end + def assessor_qualification_requests_assessment_recommendation_verify_page @assessor_qualification_requests_assessment_recommendation_verify_page ||= PageObjects::AssessorInterface::QualificationRequestsAssessmentRecommendationVerify.new @@ -161,6 +166,11 @@ def assessor_qualification_requests_page PageObjects::AssessorInterface::QualificationRequests.new end + def assessor_qualified_for_subject_page + @assessor_qualified_for_subject_page ||= + PageObjects::AssessorInterface::CreateNote.new + end + def assessor_reference_requests_assessment_recommendation_verify_page @assessor_reference_requests_assessment_recommendation_verify_page ||= PageObjects::AssessorInterface::ReferenceRequestsAssessmentRecommendationVerify.new @@ -176,6 +186,11 @@ def assessor_request_further_information_page PageObjects::AssessorInterface::RequestFurtherInformation.new end + def assessor_request_professional_standing_request_page + @assessor_request_professional_standing_request_page ||= + PageObjects::AssessorInterface::RequestProfessionalStandingRequest.new + end + def assessor_reverse_decision_page @assessor_reverse_decision_page ||= PageObjects::AssessorInterface::ReverseDecision.new @@ -196,11 +211,6 @@ def assessor_review_verifications_page PageObjects::AssessorInterface::ReviewVerifications.new end - def assessor_qualified_for_subject_page - @assessor_qualified_for_subject_page ||= - PageObjects::AssessorInterface::CreateNote.new - end - def assessor_timeline_page @assessor_timeline_page ||= PageObjects::AssessorInterface::Timeline.new end diff --git a/spec/support/system_helpers.rb b/spec/support/system_helpers.rb index 999f818182..94e8ac5165 100644 --- a/spec/support/system_helpers.rb +++ b/spec/support/system_helpers.rb @@ -87,6 +87,17 @@ def given_i_am_authorized_as_an_assessor_user given_i_am_authorized_as_a_user(user) end + def given_i_am_authorized_as_an_admin_user + user = + create( + :staff, + :with_verify_permission, + :confirmed, + name: "Authorized User", + ) + given_i_am_authorized_as_a_user(user) + end + def given_malware_scanning_is_enabled(scan_result: "No threats found") FeatureFlags::FeatureFlag.activate(:fetch_malware_scan_result) tags_url = "https://example.com/uploads/abc987xyz123?comp=tags" diff --git a/spec/system/assessor_interface/awaiting_professional_standing_spec.rb b/spec/system/assessor_interface/awaiting_professional_standing_spec.rb deleted file mode 100644 index ab05bbc847..0000000000 --- a/spec/system/assessor_interface/awaiting_professional_standing_spec.rb +++ /dev/null @@ -1,85 +0,0 @@ -# frozen_string_literal: true - -require "rails_helper" - -RSpec.describe "Assessor awaiting professional standing", type: :system do - before do - given_the_service_is_open - given_i_am_authorized_as_an_assessor_user - given_there_is_an_application_form_with_professional_standing_request - end - - it "review complete" do - when_i_visit_the(:assessor_application_page, application_id:) - and_i_see_a_waiting_on_status - and_i_click_awaiting_professional_standing - then_i_see_the( - :assessor_locate_professional_standing_request_page, - application_form_id:, - ) - - when_i_fill_in_the_form - then_i_see_the(:assessor_application_page, application_id:) - and_i_see_a_not_started_status - and_the_teacher_receives_a_professional_standing_received_email - end - - private - - def given_there_is_an_application_form_with_professional_standing_request - application_form - end - - def and_i_see_a_waiting_on_status - expect(assessor_application_page.status_summary.value).to have_text( - "WAITING ON LOPS", - ) - end - - def and_i_click_awaiting_professional_standing - assessor_application_page.awaiting_professional_standing_task.link.click - end - - def when_i_fill_in_the_form - form = assessor_locate_professional_standing_request_page.form - - form.received_checkbox.click - form.note_textarea.fill_in with: "Note." - form.submit_button.click - end - - def and_i_see_a_not_started_status - expect(assessor_application_page.status_summary.value).to have_text( - "NOT STARTED", - ) - end - - def and_the_teacher_receives_a_professional_standing_received_email - message = ActionMailer::Base.deliveries.last - expect(message).to_not be_nil - - expect(message.subject).to eq( - "Your qualified teacher status application – we’ve received " \ - "your letter that proves you’re recognised as a teacher", - ) - expect(message.to).to include(application_form.teacher.email) - end - - def application_form - @application_form ||= - create( - :application_form, - :waiting_on, - waiting_on_professional_standing: true, - statuses: %w[waiting_on_lops], - assessment: create(:assessment, :with_professional_standing_request), - teaching_authority_provides_written_statement: true, - ) - end - - def application_form_id - application_form.id - end - - alias_method :application_id, :application_form_id -end diff --git a/spec/system/assessor_interface/pre_assessment_tasks_spec.rb b/spec/system/assessor_interface/pre_assessment_tasks_spec.rb index adc52b7444..b4c786d2cc 100644 --- a/spec/system/assessor_interface/pre_assessment_tasks_spec.rb +++ b/spec/system/assessor_interface/pre_assessment_tasks_spec.rb @@ -19,7 +19,7 @@ and_i_choose_yes_to_both_questions then_i_see_the(:assessor_application_page, application_id:) and_i_see_a_completed_preliminary_check_task - and_an_email_has_been_sent_to_the_teacher + and_the_teacher_receives_a_checks_passed_email and_the_assessor_is_unassigned end @@ -42,6 +42,22 @@ and_i_see_the_failure_reasons end + it "locate professional standing" do + when_i_visit_the(:assessor_application_page, application_id:) + then_i_see_the(:assessor_application_page, application_id:) + and_i_see_a_waiting_on_status + and_i_click_awaiting_professional_standing + then_i_see_the( + :assessor_locate_professional_standing_request_page, + application_form_id:, + ) + + when_i_fill_in_the_locate_form + then_i_see_the(:assessor_application_page, application_id:) + and_i_see_a_preliminary_check_status + and_the_teacher_receives_a_professional_standing_received_email + end + private def given_there_is_an_application_form_with_professional_standing_request @@ -117,7 +133,7 @@ def and_i_see_a_completed_preliminary_check_task ).to have_content("WAITING ON") end - def and_an_email_has_been_sent_to_the_teacher + def and_the_teacher_receives_a_checks_passed_email expect(TeacherMailer.deliveries.count).to eq(1) expect(TeacherMailer.deliveries.first.subject).to eq( I18n.t("mailer.teacher.initial_checks_passed.subject"), @@ -128,6 +144,34 @@ def and_the_assessor_is_unassigned expect(application_form.reload.assessor).to be_nil end + def and_i_click_awaiting_professional_standing + assessor_application_page.awaiting_professional_standing_task.link.click + end + + def when_i_fill_in_the_locate_form + form = assessor_locate_professional_standing_request_page.form + + form.received_checkbox.click + form.note_textarea.fill_in with: "Note." + form.submit_button.click + end + + def and_i_see_a_preliminary_check_status + expect(assessor_application_page.status_summary.value).to have_text( + "PRELIMINARY CHECK", + ) + end + + def and_the_teacher_receives_a_professional_standing_received_email + expect(TeacherMailer.deliveries.count).to eq(1) + expect(TeacherMailer.deliveries.first.subject).to eq( + I18n.t( + "mailer.teacher.professional_standing_received.subject", + certificate: "letter that proves you’re recognised as a teacher", + ), + ) + end + def application_form @application_form ||= begin @@ -142,7 +186,7 @@ def application_form create( :assessment, :with_preliminary_qualifications_section, - :with_professional_standing_request, + :with_requested_professional_standing_request, application_form:, ) application_form.region.update!( @@ -153,7 +197,9 @@ def application_form end end - def application_id + def application_form_id application_form.id end + + alias_method :application_id, :application_form_id end diff --git a/spec/system/assessor_interface/verifying_professional_standing_spec.rb b/spec/system/assessor_interface/verifying_professional_standing_spec.rb index 84f109b5ce..9ff0094435 100644 --- a/spec/system/assessor_interface/verifying_professional_standing_spec.rb +++ b/spec/system/assessor_interface/verifying_professional_standing_spec.rb @@ -5,31 +5,56 @@ RSpec.describe "Assessor verifying professional standing", type: :system do before do given_the_service_is_open - given_i_am_authorized_as_an_assessor_user + given_i_am_authorized_as_an_admin_user given_there_is_an_application_form_with_professional_standing_request end - it "record location and review" do + it "verify" do when_i_visit_the(:assessor_application_page, application_id:) - and_i_see_a_waiting_on_status and_i_click_professional_standing_task then_i_see_the( - :assessor_locate_professional_standing_request_page, + :assessor_professional_standing_request_page, application_form_id:, + assessment_id:, ) + and_the_request_lops_verification_status_is("NOT STARTED") - when_i_fill_in_the_location_form - then_i_see_the(:assessor_application_page, application_id:) - and_i_see_a_received_status - - when_i_click_review_professional_standing_task + when_i_click_request_lops_verification + then_i_see_the( + :assessor_request_professional_standing_request_page, + application_form_id:, + assessment_id:, + ) + then_i_select_no + and_i_submit then_i_see_the( - :assessor_verify_professional_standing_request_page, + :assessor_professional_standing_request_page, application_form_id:, + assessment_id:, ) - when_i_fill_in_the_review_form - then_i_see_the(:assessor_application_page, application_id:) + when_i_click_request_lops_verification + then_i_select_yes + and_i_submit + then_i_see_the( + :assessor_professional_standing_request_page, + application_form_id:, + assessment_id:, + ) + 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:, + # ) end private @@ -38,55 +63,59 @@ def given_there_is_an_application_form_with_professional_standing_request application_form end - def and_i_see_a_waiting_on_status - expect(assessor_application_page.status_summary.value).to have_text( - "WAITING ON LOPS", - ) - end - def and_i_click_professional_standing_task assessor_application_page.verify_professional_standing_task.link.click end - def when_i_click_review_professional_standing_task - when_i_visit_the( - :assessor_verify_professional_standing_request_page, - application_form_id:, - assessment_id:, - ) + def when_i_click_request_lops_verification + assessor_professional_standing_request_page.request_lops_verification_task.click end - def when_i_fill_in_the_location_form - form = assessor_locate_professional_standing_request_page.form + def when_i_click_record_lops_verification + assessor_professional_standing_request_page.record_lops_verification_task.click + end - form.received_yes_radio_item.choose - form.note_textarea.fill_in with: "Note." - form.submit_button.click + def and_the_request_lops_verification_status_is(status) + expect( + assessor_professional_standing_request_page + .request_lops_verification_task + .status_tag + .text, + ).to eq(status) end - def when_i_fill_in_the_review_form + def and_i_fill_in_the_verify_form form = assessor_verify_professional_standing_request_page.form form.yes_radio_item.choose form.submit_button.click end - def and_i_see_a_received_status - expect(assessor_application_page.status_summary.value).to have_text( - "RECEIVED LOPS", - ) + def then_i_select_no + assessor_request_professional_standing_request_page + .form + .no_radio_item + .choose + end + + def then_i_select_yes + assessor_request_professional_standing_request_page + .form + .yes_radio_item + .choose + end + + def and_i_submit + assessor_request_professional_standing_request_page + .form + .continue_button + .click end def application_form @application_form ||= begin - application_form = - create( - :application_form, - :waiting_on, - waiting_on_professional_standing: true, - statuses: %w[waiting_on_lops], - ) + application_form = create(:application_form, :submitted) create( :assessment, :with_professional_standing_request, @@ -96,7 +125,7 @@ def application_form end end - def application_id + def application_form_id application_form.id end @@ -104,5 +133,5 @@ def assessment_id application_form.assessment.id end - alias_method :application_form_id, :application_id + alias_method :application_id, :application_form_id end