From c7a88f45bbf32a4b32c59c9d25b7231dd1f2ea3f Mon Sep 17 00:00:00 2001 From: Richard Pattinson Date: Mon, 9 Oct 2023 14:06:45 +0100 Subject: [PATCH] Add "Verify LoPS" page This adds the views and controller actions to implement the new "Verify LoPS" page according to the new designs of the verification journey. Co-authored-by: Shujat Khalid --- ...ofessional_standing_requests_controller.rb | 71 ++++++++--- .../requestable_request_form.rb | 22 ++++ app/lib/application_form_status_updater.rb | 11 +- .../application_forms_show_view_object.rb | 12 +- .../edit_locate.html.erb | 24 +--- .../edit_request.html.erb | 29 +++++ .../show.html.erb | 44 +++++++ config/locales/assessor_interface.en.yml | 4 + config/locales/helpers.en.yml | 13 -- config/routes.rb | 4 +- spec/factories/assessments.rb | 6 + .../professional_standing_request.rb | 21 ++++ .../request_professional_standing_request.rb | 20 +++ spec/support/page_helpers.rb | 20 ++- spec/support/system_helpers.rb | 11 ++ .../awaiting_professional_standing_spec.rb | 85 ------------- .../pre_assessment_tasks_spec.rb | 54 +++++++- .../verifying_professional_standing_spec.rb | 115 +++++++++++------- 18 files changed, 368 insertions(+), 198 deletions(-) create mode 100644 app/forms/assessor_interface/requestable_request_form.rb create mode 100644 app/views/assessor_interface/professional_standing_requests/edit_request.html.erb create mode 100644 app/views/assessor_interface/professional_standing_requests/show.html.erb create mode 100644 spec/support/autoload/page_objects/assessor_interface/professional_standing_request.rb create mode 100644 spec/support/autoload/page_objects/assessor_interface/request_professional_standing_request.rb delete mode 100644 spec/system/assessor_interface/awaiting_professional_standing_spec.rb diff --git a/app/controllers/assessor_interface/professional_standing_requests_controller.rb b/app/controllers/assessor_interface/professional_standing_requests_controller.rb index 157245e9c5..9fd7709c8f 100644 --- a/app/controllers/assessor_interface/professional_standing_requests_controller.rb +++ b/app/controllers/assessor_interface/professional_standing_requests_controller.rb @@ -4,6 +4,10 @@ module AssessorInterface class ProfessionalStandingRequestsController < BaseController before_action :set_variables + def show + authorize [:assessor_interface, professional_standing_request] + end + def edit_locate authorize [:assessor_interface, professional_standing_request] @@ -32,32 +36,27 @@ def update_locate end end - def edit_verify - authorize [:assessor_interface, professional_standing_request], - :edit_review? + def edit_request + authorize [:assessor_interface, professional_standing_request] - @form = - RequestableReviewForm.new( - requestable:, - user: current_staff, - passed: requestable.review_passed, - note: requestable.review_note, - ) + @form = RequestableRequestForm.new(requestable:, user: current_staff) end - def update_verify - authorize [:assessor_interface, professional_standing_request], - :update_review? + def update_request + authorize [:assessor_interface, professional_standing_request] @form = - RequestableReviewForm.new( - review_form_params.merge(requestable:, user: current_staff), + RequestableRequestForm.new( + request_form_params.merge(user: current_staff, requestable:), ) if @form.save - redirect_to [:assessor_interface, application_form] - else - render :edit_verify, status: :unprocessable_entity + redirect_to [ + :assessor_interface, + application_form, + assessment, + :professional_standing_request, + ] end end @@ -93,6 +92,35 @@ def update_review end end + def edit_verify + authorize [:assessor_interface, professional_standing_request], + :edit_review? + + @form = + RequestableReviewForm.new( + requestable:, + user: current_staff, + passed: requestable.review_passed, + note: requestable.review_note, + ) + end + + def update_verify + authorize [:assessor_interface, professional_standing_request], + :update_review? + + @form = + RequestableReviewForm.new( + review_form_params.merge(requestable:, user: current_staff), + ) + + if @form.save + redirect_to [:assessor_interface, application_form] + else + render :edit_verify, status: :unprocessable_entity + end + end + private def set_variables @@ -107,9 +135,14 @@ def location_form_params ).permit(:received, :ready_for_review, :location_note) end + def request_form_params + params.require(:assessor_interface_requestable_request_form).permit( + :passed, + ) + end + def review_form_params params.require(:assessor_interface_requestable_review_form).permit( - :reviewed, :passed, :note, ) diff --git a/app/forms/assessor_interface/requestable_request_form.rb b/app/forms/assessor_interface/requestable_request_form.rb new file mode 100644 index 0000000000..c4b57a6bd8 --- /dev/null +++ b/app/forms/assessor_interface/requestable_request_form.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class AssessorInterface::RequestableRequestForm + include ActiveModel::Model + include ActiveModel::Attributes + + attr_accessor :requestable, :user, :application_form, :assessment + validates :requestable, :user, presence: true + + attribute :passed, :boolean + validates :passed, inclusion: [true, false] + + delegate :application_form, :assessment, to: :requestable + + def save + return false if invalid? + + RequestRequestable.call(requestable:, user:) if passed + + true + end +end diff --git a/app/lib/application_form_status_updater.rb b/app/lib/application_form_status_updater.rb index 5ad4f692cc..943a8de542 100644 --- a/app/lib/application_form_status_updater.rb +++ b/app/lib/application_form_status_updater.rb @@ -89,7 +89,7 @@ def received_lops return false if teaching_authority_provides_written_statement professional_standing_requests - .reject(&:reviewed?) + .reject(&:verified?) .any? do |requestable| requestable.received? || requestable.ready_for_review end @@ -312,11 +312,12 @@ def reference_requests end def overdue?(requestables:) - requestables.reject(&:reviewed?).any?(&:expired?) + requestables.reject(&:verified?).reject(&:reviewed?).any?(&:expired?) end def waiting_on?(requestables:) requestables + .reject(&:verified?) .reject(&:reviewed?) .reject(&:expired?) .reject(&:received?) @@ -324,7 +325,11 @@ def waiting_on?(requestables:) end def received?(requestables:) - requestables.reject(&:reviewed?).reject(&:expired?).any?(&:received?) + requestables + .reject(&:verified?) + .reject(&:reviewed?) + .reject(&:expired?) + .any?(&:received?) end def create_timeline_event(event_type:, **kwargs) diff --git a/app/view_objects/assessor_interface/application_forms_show_view_object.rb b/app/view_objects/assessor_interface/application_forms_show_view_object.rb index 9e19d48864..a2e457fe9a 100644 --- a/app/view_objects/assessor_interface/application_forms_show_view_object.rb +++ b/app/view_objects/assessor_interface/application_forms_show_view_object.rb @@ -327,20 +327,18 @@ def professional_standing_request_task_list_item "assessor_interface.application_forms.show.assessment_tasks.items.professional_standing_request", ), link: [ - :locate, :assessor_interface, application_form, assessment, :professional_standing_request, ], status: - if professional_standing_request.ready_for_review || - professional_standing_request.received? - :completed - elsif professional_standing_request.expired? - :overdue + if professional_standing_request.verified? + "completed" + elsif professional_standing_request.requested? + "waiting_on" else - :waiting_on + "not_started" end, } end diff --git a/app/views/assessor_interface/professional_standing_requests/edit_locate.html.erb b/app/views/assessor_interface/professional_standing_requests/edit_locate.html.erb index 092c822d38..740c2da54c 100644 --- a/app/views/assessor_interface/professional_standing_requests/edit_locate.html.erb +++ b/app/views/assessor_interface/professional_standing_requests/edit_locate.html.erb @@ -16,26 +16,14 @@ This screen is not an assessment of the letter of professional standing, it just confirms that a response has been received.

- <% if @application_form.teaching_authority_provides_written_statement %> - <%= f.govuk_check_boxes_fieldset :received, multiple: false, legend: nil do %> - <%= f.govuk_check_box :received, true, false, multiple: false, link_errors: true, - label: { text: "The letter of professional standing has been received.", size: "s" } %> - <% end %> - - <%= f.govuk_text_area :location_note, label: { text: "Where to find the response", size: "m" }, hint: nil %> - <% else %> - <%= f.govuk_radio_buttons_fieldset :received, legend: { size: "s" } do %> - <%= f.govuk_radio_button :received, :true, link_errors: true %> - - <%= f.govuk_radio_button :received, :false, link_errors: true do %> - <%= f.govuk_collection_radio_buttons :ready_for_review, %i[true false], :itself, legend: { size: "s" } %> - <% end %> - <% end %> - - <%= f.govuk_text_area :location_note, label: { size: "s" } %> + <%= f.govuk_check_boxes_fieldset :received, multiple: false, legend: nil do %> + <%= f.govuk_check_box :received, true, false, multiple: false, link_errors: true, + label: { text: "The letter of professional standing has been received.", size: "s" } %> <% end %> - <%= f.govuk_submit "Save and continue" do %> + <%= f.govuk_text_area :location_note, label: { text: "Where to find the response", size: "m" }, hint: nil %> + + <%= f.govuk_submit do %> <%= govuk_link_to "Cancel", assessor_interface_application_form_path(@application_form) %> <% end %> <% end %> 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 new file mode 100644 index 0000000000..e9e5878e81 --- /dev/null +++ b/app/views/assessor_interface/professional_standing_requests/edit_request.html.erb @@ -0,0 +1,29 @@ +<% title = "Request LoPS verification" %> + +<% content_for :page_title, "#{"Error: " if @form.errors.any?}#{title}" %> +<% content_for :back_link_url, assessor_interface_application_form_path(@application_form) %> + +

<%= title %>

+ +

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) %> + +

Verify LoPS

+ +

+ 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