Skip to content

Commit

Permalink
Update system tests for verifying LoPS
Browse files Browse the repository at this point in the history
This updates the system tests for verifying LoPS to use the newer verify
page and updates to use the right permissions.
  • Loading branch information
thomasleese committed Oct 9, 2023
1 parent b3966c9 commit ae94bff
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ def request_further_information
def decline_qts
new_states.find { |radio_item| radio_item.label.text == "Decline QTS" }
end

def send_for_review
new_states.find do |radio_item|
radio_item.label.text == "Send application for review"
end
end
end
end
end
11 changes: 11 additions & 0 deletions spec/support/system_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,17 @@ def given_i_am_authorized_as_an_assessor_user
given_i_am_authorized_as_a_user(user)
end

def given_i_am_authorized_as_an_admin_user
user =
create(
:staff,
:with_verify_permission,
:confirmed,
name: "Authorized User",
)
given_i_am_authorized_as_a_user(user)
end

def given_malware_scanning_is_enabled(scan_result: "No threats found")
FeatureFlags::FeatureFlag.activate(:fetch_malware_scan_result)
tags_url = "https://example.com/uploads/abc987xyz123?comp=tags"
Expand Down
36 changes: 29 additions & 7 deletions spec/system/assessor_interface/reviewing_verifications_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@
)

when_i_click_on_verification_decision
then_i_see_the(
:complete_assessment_page,
application_id: application_form_id,
)

when_i_select_send_for_review
then_i_see_the(
:assessor_assessment_recommendation_review_page,
application_form_id:,
)

when_i_click_continue_from_review
then_i_see_the(
:assessor_application_status_page,
application_id: application_form_id,
)

when_i_click_on_overview_button
then_i_see_the(
:assessor_application_page,
application_id: application_form_id,
Expand Down Expand Up @@ -70,15 +88,19 @@ def given_there_is_an_application_form_with_failed_verifications

def when_i_click_on_verification_decision
assessor_application_page.verification_decision_task.click
end

# TODO: review functionality is not built yet, this page can never be reached
application_form.assessment.review!
def when_i_select_send_for_review
complete_assessment_page.send_for_review.choose
complete_assessment_page.continue_button.click
end

# TODO: reload the page
when_i_visit_the(
:assessor_application_page,
application_id: application_form_id,
)
def when_i_click_continue_from_review
assessor_assessment_recommendation_review_page.continue_button.click
end

def when_i_click_on_overview_button
assessor_application_status_page.button_group.overview_button.click
end

def when_i_click_on_review_verifications
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
RSpec.describe "Assessor verifying professional standing", type: :system do
before do
given_the_service_is_open
given_i_am_authorized_as_an_assessor_user
given_i_am_authorized_as_an_admin_user
given_there_is_an_application_form_with_professional_standing_request
end

Expand All @@ -22,13 +22,13 @@
then_i_see_the(:assessor_application_page, application_id:)
and_i_see_a_received_status

when_i_click_review_professional_standing_task
when_i_click_verify_professional_standing_task
then_i_see_the(
:assessor_verify_professional_standing_request_page,
application_form_id:,
)

when_i_fill_in_the_review_form
when_i_fill_in_the_verify_form
then_i_see_the(:assessor_application_page, application_id:)
end

Expand All @@ -51,7 +51,7 @@ def and_i_click_record_professional_standing_task
.click
end

def when_i_click_review_professional_standing_task
def when_i_click_verify_professional_standing_task
assessor_application_page
.review_professional_standing_request_task
.link
Expand All @@ -66,7 +66,7 @@ def when_i_fill_in_the_location_form
form.submit_button.click
end

def when_i_fill_in_the_review_form
def when_i_fill_in_the_verify_form
form = assessor_verify_professional_standing_request_page.form

form.yes_radio_item.choose
Expand Down

0 comments on commit ae94bff

Please sign in to comment.