From ae94bffdf0584592441a676ad44b07cce697d5ce Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Mon, 9 Oct 2023 12:26:34 +0100 Subject: [PATCH] Update system tests for verifying LoPS This updates the system tests for verifying LoPS to use the newer verify page and updates to use the right permissions. --- .../assessor_interface/complete_assessment.rb | 6 ++++ spec/support/system_helpers.rb | 11 ++++++ .../reviewing_verifications_spec.rb | 36 +++++++++++++++---- .../verifying_professional_standing_spec.rb | 10 +++--- 4 files changed, 51 insertions(+), 12 deletions(-) diff --git a/spec/support/autoload/page_objects/assessor_interface/complete_assessment.rb b/spec/support/autoload/page_objects/assessor_interface/complete_assessment.rb index f8f3dac3c5..847408f481 100644 --- a/spec/support/autoload/page_objects/assessor_interface/complete_assessment.rb +++ b/spec/support/autoload/page_objects/assessor_interface/complete_assessment.rb @@ -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 diff --git a/spec/support/system_helpers.rb b/spec/support/system_helpers.rb index 96756e91d3..c05332f37e 100644 --- a/spec/support/system_helpers.rb +++ b/spec/support/system_helpers.rb @@ -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" diff --git a/spec/system/assessor_interface/reviewing_verifications_spec.rb b/spec/system/assessor_interface/reviewing_verifications_spec.rb index 628562a2de..0f378a7021 100644 --- a/spec/system/assessor_interface/reviewing_verifications_spec.rb +++ b/spec/system/assessor_interface/reviewing_verifications_spec.rb @@ -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, @@ -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 diff --git a/spec/system/assessor_interface/verifying_professional_standing_spec.rb b/spec/system/assessor_interface/verifying_professional_standing_spec.rb index b46eb8bf67..d40b76006a 100644 --- a/spec/system/assessor_interface/verifying_professional_standing_spec.rb +++ b/spec/system/assessor_interface/verifying_professional_standing_spec.rb @@ -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 @@ -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 @@ -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 @@ -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