diff --git a/spec/support/autoload/page_objects/assessor_interface/application.rb b/spec/support/autoload/page_objects/assessor_interface/application.rb index 7539de9b6b..ed36a6b6f1 100644 --- a/spec/support/autoload/page_objects/assessor_interface/application.rb +++ b/spec/support/autoload/page_objects/assessor_interface/application.rb @@ -74,10 +74,6 @@ def review_qualification_requests_task task_list.find_item("Review qualifications responses") end - def assessment_recommendation_task - task_list.find_item("Assessment recommendation") - end - def verify_references_task task_list.find_item("Verify reference requests") end @@ -89,6 +85,18 @@ def record_professional_standing_request_task def review_professional_standing_request_task task_list.find_item("Review LOPS response") end + + def assessment_decision_task + task_list.find_item("Assessment decision") + end + + def review_verifications_task + task_list.find_item("Review verifications") + end + + def verification_decision_task + task_list.find_item("Verification decision") + end 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 new file mode 100644 index 0000000000..3e79c583a7 --- /dev/null +++ b/spec/support/autoload/page_objects/assessor_interface/review_professional_standing_request.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module PageObjects + module AssessorInterface + class ReviewProfessionalStandingRequest < SitePrism::Page + set_url "/assessor/applications/{application_form_id}/assessments/{assessment_id}" \ + "/professional-standing-request/review" + + section :form, "form" do + section :yes_radio_item, + PageObjects::GovukRadioItem, + ".govuk-radios__item:nth-of-type(1)" + 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 + end + end +end diff --git a/spec/support/autoload/page_objects/assessor_interface/review_verifications.rb b/spec/support/autoload/page_objects/assessor_interface/review_verifications.rb new file mode 100644 index 0000000000..9543f0947d --- /dev/null +++ b/spec/support/autoload/page_objects/assessor_interface/review_verifications.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module PageObjects + module AssessorInterface + class ReviewVerifications < SitePrism::Page + set_url "/assessor/applications/{application_form_id}/assessments/{assessment_id}" \ + "/review-verifications" + + sections :rows, ".govuk-table__row" do + element :link, ".govuk-link" + element :tag, ".govuk-tag" + end + + element :back_to_overview_button, ".govuk-button" + end + end +end diff --git a/spec/support/page_helpers.rb b/spec/support/page_helpers.rb index f30b80c0d2..54bd63aed3 100644 --- a/spec/support/page_helpers.rb +++ b/spec/support/page_helpers.rb @@ -72,6 +72,16 @@ def assessor_reverse_decision_page PageObjects::AssessorInterface::ReverseDecision.new end + def assessor_review_professional_standing_request_page + @assessor_review_professional_standing_request_page ||= + PageObjects::AssessorInterface::ReviewProfessionalStandingRequest.new + end + + def assessor_review_verifications_page + @assessor_review_verifications_page ||= + PageObjects::AssessorInterface::ReviewVerifications.new + end + def assessor_verify_professional_standing_request_page @assessor_verify_professional_standing_request_page ||= PageObjects::AssessorInterface::VerifyProfessionalStandingRequest.new diff --git a/spec/system/assessor_interface/reviewing_verifications_spec.rb b/spec/system/assessor_interface/reviewing_verifications_spec.rb index 8147908d1e..628562a2de 100644 --- a/spec/system/assessor_interface/reviewing_verifications_spec.rb +++ b/spec/system/assessor_interface/reviewing_verifications_spec.rb @@ -10,16 +10,56 @@ end it "sends for review" do - # TODO: review functionality is not built yet, this page can never be reached when_i_visit_the( - :assessor_assessment_recommendation_review_page, + :assessor_application_page, + application_id: application_form_id, + ) + then_i_see_the( + :assessor_application_page, + application_id: application_form_id, + ) + + when_i_click_on_verification_decision + then_i_see_the( + :assessor_application_page, + application_id: application_form_id, + ) + + when_i_click_on_review_verifications + then_i_see_the( + :assessor_review_verifications_page, application_form_id:, assessment_id:, ) + and_i_see_the_lops_not_started + + when_i_click_on_lops + then_i_see_the( + :assessor_review_professional_standing_request_page, + application_form_id:, + assessment_id:, + ) + + when_i_fill_in_the_review_lops_form + then_i_see_the( + :assessor_review_verifications_page, + application_form_id:, + assessment_id:, + ) + and_i_see_the_lops_accepted + + when_i_click_on_back_to_overview then_i_see_the( :assessor_application_page, application_id: application_form_id, ) + + when_i_click_on_assessment_decision + then_i_see_the( + :complete_assessment_page, + application_id: application_form_id, + assessment_id:, + ) end private @@ -28,10 +68,64 @@ def given_there_is_an_application_form_with_failed_verifications application_form end + def when_i_click_on_verification_decision + assessor_application_page.verification_decision_task.click + + # TODO: review functionality is not built yet, this page can never be reached + application_form.assessment.review! + + # TODO: reload the page + when_i_visit_the( + :assessor_application_page, + application_id: application_form_id, + ) + end + + def when_i_click_on_review_verifications + assessor_application_page.review_verifications_task.click + end + + def when_i_click_on_assessment_decision + assessor_application_page.assessment_decision_task.click + end + + def when_i_click_on_lops + assessor_review_verifications_page.rows.first.link.click + end + + def when_i_fill_in_the_review_lops_form + form = assessor_review_professional_standing_request_page.form + + form.yes_radio_item.choose + form.submit_button.click + end + + def when_i_click_on_back_to_overview + assessor_review_verifications_page.back_to_overview_button.click + end + + def and_i_see_the_lops_not_started + expect(assessor_review_verifications_page.rows.first.tag.text).to eq( + "NOT STARTED", + ) + end + + def and_i_see_the_lops_accepted + expect(assessor_review_verifications_page.rows.first.tag.text).to eq( + "ACCEPTED", + ) + end + def application_form @application_form ||= create(:application_form, :submitted).tap do |application_form| - assessment = create(:assessment, :verify, application_form:) + assessment = + create( + :assessment, + :verify, + application_form:, + induction_required: false, + ) create( :professional_standing_request, :received,