diff --git a/app/controllers/assessor_interface/professional_standing_requests_controller.rb b/app/controllers/assessor_interface/professional_standing_requests_controller.rb index 071c7a4bb9..803eada52e 100644 --- a/app/controllers/assessor_interface/professional_standing_requests_controller.rb +++ b/app/controllers/assessor_interface/professional_standing_requests_controller.rb @@ -4,15 +4,15 @@ module AssessorInterface class ProfessionalStandingRequestsController < BaseController before_action :set_variables - def show + before_action do authorize [:assessor_interface, professional_standing_request] + end + def show render layout: "full_from_desktop" end def edit_locate - authorize [:assessor_interface, professional_standing_request] - @form = ProfessionalStandingRequestLocationForm.new( requestable:, @@ -24,8 +24,6 @@ def edit_locate end def update_locate - authorize [:assessor_interface, professional_standing_request] - @form = ProfessionalStandingRequestLocationForm.new( location_form_params.merge(requestable:, user: current_staff), @@ -39,14 +37,10 @@ def update_locate end def edit_request - authorize [:assessor_interface, professional_standing_request] - @form = RequestableRequestForm.new(requestable:, user: current_staff) end def update_request - authorize [:assessor_interface, professional_standing_request] - @form = RequestableRequestForm.new( request_form_params.merge(user: current_staff, requestable:), @@ -63,8 +57,6 @@ def update_request end def edit_review - authorize [:assessor_interface, professional_standing_request] - @form = RequestableReviewForm.new( requestable:, @@ -75,8 +67,6 @@ def edit_review end def update_review - authorize [:assessor_interface, professional_standing_request] - @form = RequestableReviewForm.new( review_form_params.merge(requestable:, user: current_staff), @@ -95,23 +85,55 @@ def update_review end def edit_verify - authorize [:assessor_interface, professional_standing_request] - @form = - RequestableVerifyForm.new( + RequestableVerifyPassedForm.new( requestable:, user: current_staff, passed: requestable.verify_passed, - note: requestable.verify_note, ) end def update_verify - authorize [:assessor_interface, professional_standing_request] + @form = + RequestableVerifyPassedForm.new( + verify_passed_form_params.merge(requestable:, user: current_staff), + ) + + if @form.save + if @form.passed + redirect_to [ + :assessor_interface, + application_form, + assessment, + :professional_standing_request, + ] + else + redirect_to [ + :verify_failed, + :assessor_interface, + application_form, + assessment, + :professional_standing_request, + ] + end + else + render :edit_verify, status: :unprocessable_entity + end + end + def edit_verify_failed @form = - RequestableVerifyForm.new( - verify_form_params.merge(requestable:, user: current_staff), + RequestableVerifyFailedForm.new( + requestable:, + user: current_staff, + note: requestable.verify_note, + ) + end + + def update_verify_failed + @form = + RequestableVerifyFailedForm.new( + verify_failed_form_params.merge(requestable:, user: current_staff), ) if @form.save @@ -122,7 +144,7 @@ def update_verify :professional_standing_request, ] else - render :edit_verify, status: :unprocessable_entity + render :edit_verify_failed, status: :unprocessable_entity end end @@ -153,9 +175,14 @@ def review_form_params ) end - def verify_form_params - params.require(:assessor_interface_requestable_verify_form).permit( + def verify_passed_form_params + params.require(:assessor_interface_requestable_verify_passed_form).permit( :passed, + ) + end + + def verify_failed_form_params + params.require(:assessor_interface_requestable_verify_failed_form).permit( :note, ) end diff --git a/app/forms/assessor_interface/requestable_verify_failed_form.rb b/app/forms/assessor_interface/requestable_verify_failed_form.rb new file mode 100644 index 0000000000..69bcd83062 --- /dev/null +++ b/app/forms/assessor_interface/requestable_verify_failed_form.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AssessorInterface::RequestableVerifyFailedForm + include ActiveModel::Model + include ActiveModel::Attributes + + attr_accessor :requestable, :user + validates :requestable, :user, presence: true + + attribute :note, :string + validates :note, presence: true + + def save + return false if invalid? + + VerifyRequestable.call(requestable:, user:, passed: false, note:) + + true + end +end diff --git a/app/forms/assessor_interface/requestable_verify_form.rb b/app/forms/assessor_interface/requestable_verify_passed_form.rb similarity index 66% rename from app/forms/assessor_interface/requestable_verify_form.rb rename to app/forms/assessor_interface/requestable_verify_passed_form.rb index 3fd8ad7306..2630f08bd1 100644 --- a/app/forms/assessor_interface/requestable_verify_form.rb +++ b/app/forms/assessor_interface/requestable_verify_passed_form.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class AssessorInterface::RequestableVerifyForm +class AssessorInterface::RequestableVerifyPassedForm include ActiveModel::Model include ActiveModel::Attributes @@ -10,14 +10,12 @@ class AssessorInterface::RequestableVerifyForm attribute :passed, :boolean validates :passed, inclusion: [true, false] - attribute :note, :string - validates :note, presence: true, if: -> { passed == false } - def save return false if invalid? ReceiveRequestable.call(requestable:, user:) unless requestable.received? - VerifyRequestable.call(requestable:, user:, passed:, note:) + + VerifyRequestable.call(requestable:, user:, passed:, note: "") if passed true end diff --git a/app/policies/assessor_interface/professional_standing_request_policy.rb b/app/policies/assessor_interface/professional_standing_request_policy.rb index 7091033b31..b40fa6fd4f 100644 --- a/app/policies/assessor_interface/professional_standing_request_policy.rb +++ b/app/policies/assessor_interface/professional_standing_request_policy.rb @@ -23,6 +23,12 @@ def update_verify? alias_method :edit_verify?, :update_verify? + def update_verify_failed? + user.verify_permission + end + + alias_method :edit_verify_failed?, :update_verify_failed? + def update_review? user.assess_permission end diff --git a/app/views/assessor_interface/professional_standing_requests/edit_verify.html.erb b/app/views/assessor_interface/professional_standing_requests/edit_verify.html.erb index 816f027fba..b5e8ef79c7 100644 --- a/app/views/assessor_interface/professional_standing_requests/edit_verify.html.erb +++ b/app/views/assessor_interface/professional_standing_requests/edit_verify.html.erb @@ -6,12 +6,8 @@
You have opted to send this LoPS for review.
+ + <%= f.govuk_text_area :note, label: { text: "Internal note: briefly explain to the assessor why you are sending this LoPS for review." } %> + + <%= f.govuk_submit do %> + <%= govuk_link_to "Cancel", [:assessor_interface, @application_form] %> + <% 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 index cd21887ef4..e15958bf5a 100644 --- a/app/views/assessor_interface/professional_standing_requests/show.html.erb +++ b/app/views/assessor_interface/professional_standing_requests/show.html.erb @@ -26,15 +26,17 @@ status: @professional_standing_request.requested? ? "completed" : "not_started" }, { - name: "Record LoPS verification", - link: [ - :verify, - :assessor_interface, - @application_form, - @assessment, - :professional_standing_request - ], - status: @professional_standing_request.status, + name: "Record LoPS response", + link: if @professional_standing_request.requested? + [ + :verify, + :assessor_interface, + @application_form, + @assessment, + :professional_standing_request + ] + end, + status: @professional_standing_request.requested? ? @professional_standing_request.status : "cannot_start" } ], } diff --git a/config/locales/assessor_interface.en.yml b/config/locales/assessor_interface.en.yml index f1056f0c0b..2a20b53590 100644 --- a/config/locales/assessor_interface.en.yml +++ b/config/locales/assessor_interface.en.yml @@ -397,12 +397,14 @@ en: inclusion: Select whether you are satisfied with the request note: blank: Enter why you are not satisfied - assessor_interface/requestable_verify_form: + assessor_interface/requestable_verify_failed_form: attributes: - passed: - inclusion: Select whether you are satisfied with the request note: blank: Enter why you are not satisfied + assessor_interface/requestable_verify_passed_form: + attributes: + passed: + inclusion: Select whether you are satisfied with the request assessor_interface/select_qualifications_form: attributes: qualification_ids: diff --git a/config/locales/helpers.en.yml b/config/locales/helpers.en.yml index bd3ac8ef42..50100f51fb 100644 --- a/config/locales/helpers.en.yml +++ b/config/locales/helpers.en.yml @@ -119,10 +119,10 @@ en: passed_options: true: "Yes" false: "No" - assessor_interface_requestable_verify_form: + assessor_interface_requestable_verify_passed_form: passed_options: - true: "Yes" - false: "No" + true: "Yes, mark as completed" + false: "No, send for review" assessor_interface_verify_professional_standing_form: verify_professional_standing_options: true: Yes, verify letter of professional standing diff --git a/config/routes.rb b/config/routes.rb index cd65988e79..904c750ec7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -121,6 +121,10 @@ post "review", to: "professional_standing_requests#update_review" get "verify", to: "professional_standing_requests#edit_verify" post "verify", to: "professional_standing_requests#update_verify" + get "verify-failed", + to: "professional_standing_requests#edit_verify_failed" + post "verify-failed", + to: "professional_standing_requests#update_verify_failed" end end diff --git a/spec/forms/assessor_interface/requestable_verify_failed_form_spec.rb b/spec/forms/assessor_interface/requestable_verify_failed_form_spec.rb new file mode 100644 index 0000000000..19db4517a7 --- /dev/null +++ b/spec/forms/assessor_interface/requestable_verify_failed_form_spec.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +require "rails_helper" + +RSpec.describe AssessorInterface::RequestableVerifyFailedForm, type: :model do + let(:requestable) { create(:reference_request, :received) } + let(:user) { create(:staff) } + let(:note) { "" } + + subject(:form) { described_class.new(requestable:, user:, note:) } + + describe "validations" do + it { is_expected.to validate_presence_of(:note) } + end + + describe "#save" do + subject(:save) { form.save } + + context "when passed is false" do + let(:note) { "Note." } + + it "sets verify_passed" do + expect { save }.to change(requestable, :verify_passed).from(nil).to( + false, + ) + end + + it "sets verify_note" do + expect { save }.to change(requestable, :verify_note).from("").to( + "Note.", + ) + end + + it "sets verified_at" do + freeze_time do + expect { save }.to change(requestable, :verified_at).from(nil).to( + Time.zone.now, + ) + end + end + + it "updates induction required" do + expect(UpdateAssessmentInductionRequired).to receive(:call) + save # rubocop:disable Rails/SaveBang + end + end + end +end diff --git a/spec/forms/assessor_interface/requestable_verify_form_spec.rb b/spec/forms/assessor_interface/requestable_verify_passed_form_spec.rb similarity index 51% rename from spec/forms/assessor_interface/requestable_verify_form_spec.rb rename to spec/forms/assessor_interface/requestable_verify_passed_form_spec.rb index bf71b3890d..3fcc061979 100644 --- a/spec/forms/assessor_interface/requestable_verify_form_spec.rb +++ b/spec/forms/assessor_interface/requestable_verify_passed_form_spec.rb @@ -2,22 +2,17 @@ require "rails_helper" -RSpec.describe AssessorInterface::RequestableVerifyForm, type: :model do - let(:requestable) { create(:reference_request, :received) } +RSpec.describe AssessorInterface::RequestableVerifyPassedForm, type: :model do + let(:requestable) do + create(:reference_request, :received, verify_note: "Old note") + end let(:user) { create(:staff) } let(:passed) { nil } - let(:note) { "" } - subject(:form) { described_class.new(requestable:, user:, passed:, note:) } + subject(:form) { described_class.new(requestable:, user:, passed:) } describe "validations" do it { is_expected.to allow_values(true, false).for(:passed) } - - context "when not passed" do - let(:passed) { "false" } - - it { is_expected.to validate_presence_of(:note) } - end end describe "#save" do @@ -26,13 +21,17 @@ context "when passed is true" do let(:passed) { true } - it "updates review passed field" do + it "sets verify_passed" do expect { save }.to change(requestable, :verify_passed).from(nil).to( true, ) end - it "sets reviewed at" do + it "sets verify_note" do + expect { save }.to change(requestable, :verify_note).to("") + end + + it "sets verified_at" do freeze_time do expect { save }.to change(requestable, :verified_at).from(nil).to( Time.zone.now, @@ -48,30 +47,21 @@ context "when passed is false" do let(:passed) { false } - let(:note) { "Note." } - it "updates review passed field" do - expect { save }.to change(requestable, :verify_passed).from(nil).to( - false, - ) + it "doesn't set verify_passed" do + expect { save }.to_not change(requestable, :verify_passed) end - it "updates review note field" do - expect { save }.to change(requestable, :verify_note).from("").to( - "Note.", - ) + it "doesn't set verify_note" do + expect { save }.to_not change(requestable, :verify_note) end - it "sets reviewed at" do - freeze_time do - expect { save }.to change(requestable, :verified_at).from(nil).to( - Time.zone.now, - ) - end + it "doesn't set verified_at" do + expect { save }.to_not change(requestable, :verified_at) end - it "updates induction required" do - expect(UpdateAssessmentInductionRequired).to receive(:call) + it "doesn't update induction required" do + expect(UpdateAssessmentInductionRequired).to_not receive(:call) save # rubocop:disable Rails/SaveBang end end diff --git a/spec/policies/assessor_interface/assessment_policy_spec.rb b/spec/policies/assessor_interface/assessment_policy_spec.rb index d6654cd0d9..a4c9e89656 100644 --- a/spec/policies/assessor_interface/assessment_policy_spec.rb +++ b/spec/policies/assessor_interface/assessment_policy_spec.rb @@ -40,12 +40,12 @@ describe "#update?" do subject(:update?) { policy.update? } - it_behaves_like "a policy method requiring the award decline permission" + it_behaves_like "a policy method requiring the assess permission" end describe "#edit?" do subject(:edit?) { policy.edit? } - it_behaves_like "a policy method requiring the award decline permission" + it_behaves_like "a policy method requiring the assess permission" end describe "#destroy?" do diff --git a/spec/policies/assessor_interface/assessment_recommendation_policy_spec.rb b/spec/policies/assessor_interface/assessment_recommendation_policy_spec.rb index 4514388be7..05685972a7 100644 --- a/spec/policies/assessor_interface/assessment_recommendation_policy_spec.rb +++ b/spec/policies/assessor_interface/assessment_recommendation_policy_spec.rb @@ -40,13 +40,13 @@ describe "#update?" do subject(:update?) { policy.update? } - it_behaves_like "a policy method requiring the award decline permission" + it_behaves_like "a policy method requiring the assess permission" it_behaves_like "a policy method requiring the verify permission" end describe "#edit?" do subject(:edit?) { policy.edit? } - it_behaves_like "a policy method requiring the award decline permission" + it_behaves_like "a policy method requiring the assess permission" it_behaves_like "a policy method requiring the verify permission" end diff --git a/spec/policies/assessor_interface/professional_standing_request_policy_spec.rb b/spec/policies/assessor_interface/professional_standing_request_policy_spec.rb index 1e6a8b37c6..a39ca0933a 100644 --- a/spec/policies/assessor_interface/professional_standing_request_policy_spec.rb +++ b/spec/policies/assessor_interface/professional_standing_request_policy_spec.rb @@ -86,14 +86,24 @@ it_behaves_like "a policy method requiring the verify permission" end + describe "#update_verify_failed?" do + subject(:update_verify_failed?) { policy.update_verify_failed? } + it_behaves_like "a policy method requiring the verify permission" + end + + describe "#edit_verify_failed?" do + subject(:edit_verify_failed?) { policy.edit_verify_failed? } + it_behaves_like "a policy method requiring the verify permission" + end + describe "#update_review?" do subject(:update_review?) { policy.update_review? } - it_behaves_like "a policy method requiring the award decline permission" + it_behaves_like "a policy method requiring the assess permission" end describe "#edit_review?" do subject(:edit_review?) { policy.edit_review? } - it_behaves_like "a policy method requiring the award decline permission" + it_behaves_like "a policy method requiring the assess permission" end describe "#destroy?" do diff --git a/spec/policies/assessor_policy_spec.rb b/spec/policies/assessor_policy_spec.rb index 440858c59b..8ef8d99f96 100644 --- a/spec/policies/assessor_policy_spec.rb +++ b/spec/policies/assessor_policy_spec.rb @@ -21,26 +21,26 @@ describe "#create?" do subject(:create?) { policy.create? } - it_behaves_like "a policy method requiring the award decline permission" + it_behaves_like "a policy method requiring the assess permission" end describe "#new?" do subject(:new?) { policy.new? } - it_behaves_like "a policy method requiring the award decline permission" + it_behaves_like "a policy method requiring the assess permission" end describe "#update?" do subject(:update?) { policy.update? } - it_behaves_like "a policy method requiring the award decline permission" + it_behaves_like "a policy method requiring the assess permission" end describe "#edit?" do subject(:edit?) { policy.edit? } - it_behaves_like "a policy method requiring the award decline permission" + it_behaves_like "a policy method requiring the assess permission" end describe "#destroy?" do subject(:destroy?) { policy.destroy? } - it_behaves_like "a policy method requiring the award decline permission" + it_behaves_like "a policy method requiring the assess permission" end 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 index a8930584ea..d6dbb1ff71 100644 --- a/spec/support/autoload/page_objects/assessor_interface/professional_standing_request.rb +++ b/spec/support/autoload/page_objects/assessor_interface/professional_standing_request.rb @@ -13,8 +13,8 @@ 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") + def record_lops_response_task + task_list.find_item("Record LoPS response") 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 index 1f1d6eee95..4b6d5deaf9 100644 --- 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 @@ -13,7 +13,17 @@ class RequestProfessionalStandingRequest < SitePrism::Page element :no_radio_item, "#assessor-interface-requestable-request-form-passed-false-field", visible: false - element :continue_button, "button" + element :submit_button, ".govuk-button" + end + + def submit_yes + form.yes_radio_item.click + form.submit_button.click + end + + def submit_no + form.no_radio_item.click + form.submit_button.click end end end diff --git a/spec/support/autoload/page_objects/assessor_interface/review_professional_standing_request.rb b/spec/support/autoload/page_objects/assessor_interface/review_professional_standing_request.rb index 3e79c583a7..0ca1663c95 100644 --- a/spec/support/autoload/page_objects/assessor_interface/review_professional_standing_request.rb +++ b/spec/support/autoload/page_objects/assessor_interface/review_professional_standing_request.rb @@ -13,9 +13,20 @@ class ReviewProfessionalStandingRequest < SitePrism::Page section :no_radio_item, PageObjects::GovukRadioItem, ".govuk-radios__item:nth-of-type(2)" - element :failure_reason_textarea, ".govuk-textarea" + element :note_textarea, ".govuk-textarea" element :submit_button, ".govuk-button" end + + def submit_yes + form.yes_radio_item.choose + form.submit_button.click + end + + def submit_no(note:) + form.no_radio_item.choose + form.note_textarea.fill_in with: note + form.submit_button.click + end end end end diff --git a/spec/support/autoload/page_objects/assessor_interface/verify_failed_professional_standing_request.rb b/spec/support/autoload/page_objects/assessor_interface/verify_failed_professional_standing_request.rb new file mode 100644 index 0000000000..24984a8995 --- /dev/null +++ b/spec/support/autoload/page_objects/assessor_interface/verify_failed_professional_standing_request.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module PageObjects + module AssessorInterface + class VerifyFailedProfessionalStandingRequest < SitePrism::Page + set_url "/assessor/applications/{application_form_id}/assessments/{assessment_id}" \ + "/professional-standing-request/verify-failed" + + section :form, "form" do + element :note_textarea, ".govuk-textarea" + element :submit_button, ".govuk-button" + end + + def submit(note:) + form.note_textarea.fill_in with: note + form.submit_button.click + end + end + end +end diff --git a/spec/support/autoload/page_objects/assessor_interface/verify_professional_standing_request.rb b/spec/support/autoload/page_objects/assessor_interface/verify_professional_standing_request.rb index 251d571f85..456c76eea6 100644 --- a/spec/support/autoload/page_objects/assessor_interface/verify_professional_standing_request.rb +++ b/spec/support/autoload/page_objects/assessor_interface/verify_professional_standing_request.rb @@ -13,9 +13,18 @@ class VerifyProfessionalStandingRequest < SitePrism::Page section :no_radio_item, PageObjects::GovukRadioItem, ".govuk-radios__item:nth-of-type(2)" - element :failure_reason_textarea, ".govuk-textarea" element :submit_button, ".govuk-button" end + + def submit_yes + form.yes_radio_item.choose + form.submit_button.click + end + + def submit_no + form.no_radio_item.choose + form.submit_button.click + end end end end diff --git a/spec/support/page_helpers.rb b/spec/support/page_helpers.rb index b0d4ded5f5..e2a5427706 100644 --- a/spec/support/page_helpers.rb +++ b/spec/support/page_helpers.rb @@ -220,6 +220,11 @@ def assessor_verify_age_range_subjects_page PageObjects::AssessorInterface::VerifyAgeRangeSubjectsPage.new end + def assessor_verify_failed_professional_standing_request_page + @assessor_verify_failed_professional_standing_request_page ||= + PageObjects::AssessorInterface::VerifyFailedProfessionalStandingRequest.new + end + def assessor_verify_professional_standing_assessment_recommendation_verify_page @assessor_verify_professional_standing_assessment_recommendation_verify_page ||= PageObjects::AssessorInterface::VerifyProfessionalStandingAssessmentRecommendationVerify.new diff --git a/spec/support/shared_examples/policy.rb b/spec/support/shared_examples/policy.rb index 096c7b18bc..625c23ebde 100644 --- a/spec/support/shared_examples/policy.rb +++ b/spec/support/shared_examples/policy.rb @@ -16,7 +16,7 @@ end end -RSpec.shared_examples "a policy method requiring the award decline permission" do +RSpec.shared_examples "a policy method requiring the assess permission" do context "without permission" do let(:user) { create(:staff) } it { is_expected.to be false } diff --git a/spec/system/assessor_interface/reviewing_professional_standing_spec.rb b/spec/system/assessor_interface/reviewing_professional_standing_spec.rb index 490d2b54cd..349dcb50e3 100644 --- a/spec/system/assessor_interface/reviewing_professional_standing_spec.rb +++ b/spec/system/assessor_interface/reviewing_professional_standing_spec.rb @@ -43,7 +43,7 @@ assessment_id:, ) - when_i_fill_in_the_review_lops_form + when_i_submit_yes_on_the_review_form then_i_see_the( :assessor_review_verifications_page, application_form_id:, @@ -51,6 +51,21 @@ ) and_i_see_the_lops_accepted + when_i_click_on_lops + then_i_see_the( + :assessor_review_professional_standing_request_page, + application_form_id:, + assessment_id:, + ) + + when_i_submit_no_on_the_review_form + then_i_see_the( + :assessor_review_verifications_page, + application_form_id:, + assessment_id:, + ) + and_i_see_the_lops_rejected + when_i_click_on_back_to_overview then_i_see_the(:assessor_application_page, application_form_id:) @@ -99,11 +114,14 @@ def when_i_click_on_lops ) end - def when_i_fill_in_the_review_lops_form - form = assessor_review_professional_standing_request_page.form + def when_i_submit_yes_on_the_review_form + assessor_review_professional_standing_request_page.submit_yes + end - form.yes_radio_item.choose - form.submit_button.click + def when_i_submit_no_on_the_review_form + assessor_review_professional_standing_request_page.submit_no( + note: "A note.", + ) end def when_i_click_on_back_to_overview @@ -126,6 +144,12 @@ def and_i_see_the_lops_accepted expect(item.status_tag.text).to eq("ACCEPTED") end + def and_i_see_the_lops_rejected + expect(assessor_review_verifications_page.rows.first.tag.text).to eq( + "REJECTED", + ) + end + def application_form @application_form ||= create(:application_form, :submitted).tap do |application_form| diff --git a/spec/system/assessor_interface/verifying_professional_standing_spec.rb b/spec/system/assessor_interface/verifying_professional_standing_spec.rb index 56ff10884d..20b946467c 100644 --- a/spec/system/assessor_interface/verifying_professional_standing_spec.rb +++ b/spec/system/assessor_interface/verifying_professional_standing_spec.rb @@ -18,6 +18,7 @@ assessment_id:, ) and_the_request_lops_verification_status_is("NOT STARTED") + and_the_record_lops_response_status_is("CANNOT START") when_i_click_request_lops_verification then_i_see_the( @@ -25,8 +26,7 @@ application_form_id:, assessment_id:, ) - then_i_select_no - and_i_submit + and_i_submit_no_on_the_request_form then_i_see_the( :assessor_professional_standing_request_page, application_form_id:, @@ -34,27 +34,48 @@ ) when_i_click_request_lops_verification - then_i_select_yes - and_i_submit + and_i_submit_yes_on_the_request_form then_i_see_the( :assessor_professional_standing_request_page, application_form_id:, assessment_id:, ) and_the_request_lops_verification_status_is("COMPLETED") + and_the_record_lops_response_status_is("WAITING ON") - when_i_click_record_lops_verification + when_i_click_record_lops_response then_i_see_the( :assessor_verify_professional_standing_request_page, application_form_id:, assessment_id:, ) - and_i_fill_in_the_verify_form + and_i_submit_yes_on_the_verify_form then_i_see_the( :assessor_professional_standing_request_page, application_form_id:, assessment_id:, ) + and_the_record_lops_response_status_is("COMPLETED") + + when_i_click_record_lops_response + then_i_see_the( + :assessor_verify_professional_standing_request_page, + application_form_id:, + assessment_id:, + ) + and_i_submit_no_on_the_verify_form + then_i_see_the( + :assessor_verify_failed_professional_standing_request_page, + application_form_id:, + assessment_id:, + ) + and_i_submit_an_internal_note + then_i_see_the( + :assessor_professional_standing_request_page, + application_form_id:, + assessment_id:, + ) + and_the_record_lops_response_status_is("REVIEW") end private @@ -71,8 +92,8 @@ def when_i_click_request_lops_verification assessor_professional_standing_request_page.request_lops_verification_task.click end - def when_i_click_record_lops_verification - assessor_professional_standing_request_page.record_lops_verification_task.click + def when_i_click_record_lops_response + assessor_professional_standing_request_page.record_lops_response_task.click end def and_the_request_lops_verification_status_is(status) @@ -84,32 +105,35 @@ def and_the_request_lops_verification_status_is(status) ).to eq(status) end - def and_i_fill_in_the_verify_form - form = assessor_verify_professional_standing_request_page.form + def and_the_record_lops_response_status_is(status) + expect( + assessor_professional_standing_request_page + .record_lops_response_task + .status_tag + .text, + ).to eq(status) + end + + def and_i_submit_yes_on_the_verify_form + assessor_verify_professional_standing_request_page.submit_yes + end - form.yes_radio_item.choose - form.submit_button.click + def and_i_submit_no_on_the_verify_form + assessor_verify_professional_standing_request_page.submit_no end - def then_i_select_no - assessor_request_professional_standing_request_page - .form - .no_radio_item - .choose + def and_i_submit_yes_on_the_request_form + assessor_request_professional_standing_request_page.submit_yes end - def then_i_select_yes - assessor_request_professional_standing_request_page - .form - .yes_radio_item - .choose + def and_i_submit_no_on_the_request_form + assessor_request_professional_standing_request_page.submit_no end - def and_i_submit - assessor_request_professional_standing_request_page - .form - .continue_button - .click + def and_i_submit_an_internal_note + assessor_verify_failed_professional_standing_request_page.submit( + note: "A note.", + ) end def application_form