From bcbf93d1847d33888a947f0156cd129813035988 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Fri, 6 Oct 2023 12:07:56 +0100 Subject: [PATCH] Add a review recommendation test stub This starts a system test for the review recommendation journey. It can't be fully tested yet as the other parts of the journey aren't built yet and it's not possible to access this page yet. --- spec/factories/assessments.rb | 5 ++ .../assessment_recommendation_review.rb | 12 +++++ spec/support/page_helpers.rb | 5 ++ .../reviewing_verifications_spec.rb | 51 +++++++++++++++++++ 4 files changed, 73 insertions(+) create mode 100644 spec/support/autoload/page_objects/assessor_interface/assessment_recommendation_review.rb create mode 100644 spec/system/assessor_interface/reviewing_verifications_spec.rb diff --git a/spec/factories/assessments.rb b/spec/factories/assessments.rb index c9190ada00..3e07c547b0 100644 --- a/spec/factories/assessments.rb +++ b/spec/factories/assessments.rb @@ -57,6 +57,11 @@ recommended_at { Time.zone.now } end + trait :verify do + recommendation { "verify" } + recommended_at { Time.zone.now } + end + trait :with_preliminary_qualifications_section do after(:create) do |assessment, _evaulator| create(:assessment_section, :preliminary, :qualifications, assessment:) diff --git a/spec/support/autoload/page_objects/assessor_interface/assessment_recommendation_review.rb b/spec/support/autoload/page_objects/assessor_interface/assessment_recommendation_review.rb new file mode 100644 index 0000000000..9651d47fd5 --- /dev/null +++ b/spec/support/autoload/page_objects/assessor_interface/assessment_recommendation_review.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module PageObjects + module AssessorInterface + class AssessmentRecommendationReview < SitePrism::Page + set_url "/assessor/applications/{application_form_id}/assessments/{assessment_id}" \ + "/recommendation/review/edit" + + element :continue_button, ".govuk-button" + end + end +end diff --git a/spec/support/page_helpers.rb b/spec/support/page_helpers.rb index f67c1e11ab..15ac105c72 100644 --- a/spec/support/page_helpers.rb +++ b/spec/support/page_helpers.rb @@ -22,6 +22,11 @@ def assessor_application_status_page PageObjects::AssessorInterface::ApplicationStatus.new end + def assessor_assessment_recommendation_review_page + @assessor_assessment_recommendation_review_page ||= + PageObjects::AssessorInterface::AssessmentRecommendationReview.new + end + def assessor_assessment_section_page @assessor_assessment_section_page ||= PageObjects::AssessorInterface::AssessmentSection.new diff --git a/spec/system/assessor_interface/reviewing_verifications_spec.rb b/spec/system/assessor_interface/reviewing_verifications_spec.rb new file mode 100644 index 0000000000..8147908d1e --- /dev/null +++ b/spec/system/assessor_interface/reviewing_verifications_spec.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +require "rails_helper" + +RSpec.describe "Assessor reviewing verifications", 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_failed_verifications + 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, + application_form_id:, + assessment_id:, + ) + then_i_see_the( + :assessor_application_page, + application_id: application_form_id, + ) + end + + private + + def given_there_is_an_application_form_with_failed_verifications + application_form + end + + def application_form + @application_form ||= + create(:application_form, :submitted).tap do |application_form| + assessment = create(:assessment, :verify, application_form:) + create( + :professional_standing_request, + :received, + assessment:, + verify_passed: false, + ) + end + end + + def application_form_id + application_form.id + end + + def assessment_id + application_form.assessment.id + end +end