Skip to content

Commit

Permalink
Add a review recommendation test stub
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thomasleese committed Oct 6, 2023
1 parent 8e5c98b commit bcbf93d
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 0 deletions.
5 changes: 5 additions & 0 deletions spec/factories/assessments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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:)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions spec/support/page_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
51 changes: 51 additions & 0 deletions spec/system/assessor_interface/reviewing_verifications_spec.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bcbf93d

Please sign in to comment.