Skip to content

Commit

Permalink
Add system test for review verifications
Browse files Browse the repository at this point in the history
This adds a system test for the review verifications journey to ensure
that it works as expected.
  • Loading branch information
thomasleese committed Oct 9, 2023
1 parent 65ef8d2 commit e640b77
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions spec/support/page_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
100 changes: 97 additions & 3 deletions spec/system/assessor_interface/reviewing_verifications_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit e640b77

Please sign in to comment.