From 01e32888b6f2a6f231eff7a77e2a8a755dc1d8db Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Mon, 19 Feb 2024 19:22:38 +0100 Subject: [PATCH] Remove email previews We've decided to remove these emails previews as they're not useful and sometimes show inaccurate information. Rather than fixing the previews we will remove them. --- app/assets/stylesheets/_email_preview.scss | 20 ------- app/assets/stylesheets/application.sass.scss | 1 - .../preview_mailer/component.html.erb | 11 ---- app/components/preview_mailer/component.rb | 16 ----- ...essment_recommendation_award_controller.rb | 4 -- ...sment_recommendation_decline_controller.rb | 6 +- .../assessments_controller.rb | 4 +- ...further_information_requests_controller.rb | 28 ++++----- app/lib/mailer_preview.rb | 52 ---------------- .../further_information_request_policy.rb | 2 - .../age_range_subjects.html.erb | 7 +-- .../preview.html.erb | 17 ------ .../preview.html.erb | 17 ------ .../further_information_requests/new.html.erb | 49 +++++++++++---- .../preview.html.erb | 44 -------------- config/locales/assessor_interface.en.yml | 8 --- config/routes.rb | 8 +-- .../preview_mailer_component_spec.rb | 36 ----------- spec/lib/mailer_preview_spec.rb | 59 ------------------- ...further_information_request_policy_spec.rb | 5 -- ...ubjects_assessment_recommendation_award.rb | 2 +- .../further_information_request_preview.rb | 17 ------ .../preview_assessment_recommendation.rb | 16 ----- .../request_further_information.rb | 4 +- spec/support/page_helpers.rb | 5 -- .../completing_assessment_spec.rb | 38 ------------ .../requesting_further_information_spec.rb | 43 +------------- 27 files changed, 61 insertions(+), 458 deletions(-) delete mode 100644 app/assets/stylesheets/_email_preview.scss delete mode 100644 app/components/preview_mailer/component.html.erb delete mode 100644 app/components/preview_mailer/component.rb delete mode 100644 app/lib/mailer_preview.rb delete mode 100644 app/views/assessor_interface/assessment_recommendation_award/preview.html.erb delete mode 100644 app/views/assessor_interface/assessment_recommendation_decline/preview.html.erb delete mode 100644 app/views/assessor_interface/further_information_requests/preview.html.erb delete mode 100644 spec/components/preview_mailer_component_spec.rb delete mode 100644 spec/lib/mailer_preview_spec.rb delete mode 100644 spec/support/autoload/page_objects/assessor_interface/further_information_request_preview.rb delete mode 100644 spec/support/autoload/page_objects/assessor_interface/preview_assessment_recommendation.rb diff --git a/app/assets/stylesheets/_email_preview.scss b/app/assets/stylesheets/_email_preview.scss deleted file mode 100644 index 964b2ba753..0000000000 --- a/app/assets/stylesheets/_email_preview.scss +++ /dev/null @@ -1,20 +0,0 @@ -.app-email-preview__header { - background-color: govuk-colour("black"); - color: govuk-colour("white"); - padding: govuk-spacing(2); -} - -.app-email-preview__header__logo { - font-size: 28px; - font-weight: bold; - width: 580px; - margin-left: auto; - margin-right: auto; -} - -.app-email-preview__content { - border-top: 10px govuk-colour("blue") solid; - width: 580px; - margin-left: auto; - margin-right: auto; -} diff --git a/app/assets/stylesheets/application.sass.scss b/app/assets/stylesheets/application.sass.scss index 099d0a544d..36c4594cf1 100644 --- a/app/assets/stylesheets/application.sass.scss +++ b/app/assets/stylesheets/application.sass.scss @@ -12,7 +12,6 @@ $moj-images-path: "/"; @import "_application_forms"; @import "_checkbox_search_filter"; @import "_description_list"; -@import "_email_preview"; @import "_environments"; @import "_search_results"; @import "_support"; diff --git a/app/components/preview_mailer/component.html.erb b/app/components/preview_mailer/component.html.erb deleted file mode 100644 index ceb282683b..0000000000 --- a/app/components/preview_mailer/component.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -
-
- -
- -
- <%= preview.html_safe %> -
-
diff --git a/app/components/preview_mailer/component.rb b/app/components/preview_mailer/component.rb deleted file mode 100644 index a8a8e22a14..0000000000 --- a/app/components/preview_mailer/component.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class PreviewMailer::Component < ViewComponent::Base - def initialize(mailer_class:, name:, **params) - super - @mailer_class = mailer_class - @name = name - @params = params - end - - def preview - MailerPreview.with(mailer_class, **params).send(name) - end - - attr_reader :mailer_class, :name, :params -end diff --git a/app/controllers/assessor_interface/assessment_recommendation_award_controller.rb b/app/controllers/assessor_interface/assessment_recommendation_award_controller.rb index 004001a996..0924a788e2 100644 --- a/app/controllers/assessor_interface/assessment_recommendation_award_controller.rb +++ b/app/controllers/assessor_interface/assessment_recommendation_award_controller.rb @@ -92,10 +92,6 @@ def update_age_range_subjects end end - def preview - authorize %i[assessor_interface assessment_recommendation], :edit? - end - def edit_confirm authorize %i[assessor_interface assessment_recommendation], :edit? @form = AssessmentConfirmationForm.new diff --git a/app/controllers/assessor_interface/assessment_recommendation_decline_controller.rb b/app/controllers/assessor_interface/assessment_recommendation_decline_controller.rb index 59421cae59..3508fa2943 100644 --- a/app/controllers/assessor_interface/assessment_recommendation_decline_controller.rb +++ b/app/controllers/assessor_interface/assessment_recommendation_decline_controller.rb @@ -49,7 +49,7 @@ def update if @form.save redirect_to [ - :preview, + :confirm, :assessor_interface, application_form, assessment, @@ -60,10 +60,6 @@ def update end end - def preview - authorize %i[assessor_interface assessment_recommendation], :edit? - end - def edit_confirm authorize %i[assessor_interface assessment_recommendation], :edit? @form = AssessmentConfirmationForm.new diff --git a/app/controllers/assessor_interface/assessments_controller.rb b/app/controllers/assessor_interface/assessments_controller.rb index 8df872e1b8..22b7b82a0c 100644 --- a/app/controllers/assessor_interface/assessments_controller.rb +++ b/app/controllers/assessor_interface/assessments_controller.rb @@ -99,11 +99,11 @@ def assessment def update_redirect_path(recommendation) if recommendation == "request_further_information" [ - :preview, + :new, :assessor_interface, application_form, assessment, - :further_information_requests, + :further_information_request, ] else [ diff --git a/app/controllers/assessor_interface/further_information_requests_controller.rb b/app/controllers/assessor_interface/further_information_requests_controller.rb index d1a6cc0f08..3453cd5651 100644 --- a/app/controllers/assessor_interface/further_information_requests_controller.rb +++ b/app/controllers/assessor_interface/further_information_requests_controller.rb @@ -4,23 +4,25 @@ module AssessorInterface class FurtherInformationRequestsController < BaseController include HistoryTrackable - before_action only: %i[preview new create] do + before_action only: %i[new create] do authorize %i[assessor_interface further_information_request] end - before_action except: %i[preview new create] do + before_action except: %i[new create] do authorize [:assessor_interface, further_information_request] end - before_action :load_application_form_and_assessment, - only: %i[preview new edit] - before_action :load_new_further_information_request, only: %i[preview new] + before_action :load_application_form_and_assessment, only: %i[new edit] before_action :load_view_object, only: %i[edit update] - def preview - end - def new + @further_information_request = + assessment.further_information_requests.build( + items: + FurtherInformationRequestItemsFactory.call( + assessment_sections: assessment.sections, + ), + ) end def create @@ -70,16 +72,6 @@ def load_application_form_and_assessment @assessment = assessment end - def load_new_further_information_request - @further_information_request = - assessment.further_information_requests.build( - items: - FurtherInformationRequestItemsFactory.call( - assessment_sections: assessment.sections, - ), - ) - end - def load_view_object @view_object = view_object end diff --git a/app/lib/mailer_preview.rb b/app/lib/mailer_preview.rb deleted file mode 100644 index 51f0b98cff..0000000000 --- a/app/lib/mailer_preview.rb +++ /dev/null @@ -1,52 +0,0 @@ -# frozen_string_literal: true - -class MailerPreview - class << self - def with(mailer_class, **params) - new(mailer_class:, params:) - end - end - - def initialize(mailer_class:, params:) - @mailer_class = mailer_class - @params = params - end - - def respond_to_missing?(name) - mailer.respond_to?(name) - end - - def method_missing(name) - mail = mailer.send(name) - generate_preview(mail) - end - - private - - attr_reader :mailer_class, :params - - def client - @client ||= - begin - api_key = ENV["GOVUK_NOTIFY_API_KEY"] - Notifications::Client.new(api_key) if api_key.present? - end - end - - def mailer - @mailer ||= mailer_class.with(**params) - end - - def generate_preview(mail) - return "

Missing GOV.UK Notify API key.

" if client.nil? - - client.generate_template_preview( - ApplicationMailer::GOVUK_NOTIFY_TEMPLATE_ID, - personalisation: { - to: mail.to.first, - subject: mail.subject, - body: mail.body.encoded, - }, - ).html - end -end diff --git a/app/policies/assessor_interface/further_information_request_policy.rb b/app/policies/assessor_interface/further_information_request_policy.rb index 5138eb264e..ae4b255fae 100644 --- a/app/policies/assessor_interface/further_information_request_policy.rb +++ b/app/policies/assessor_interface/further_information_request_policy.rb @@ -5,8 +5,6 @@ def create? user.assess_permission end - alias_method :preview?, :new? - def update? user.assess_permission end diff --git a/app/views/assessor_interface/assessment_recommendation_award/age_range_subjects.html.erb b/app/views/assessor_interface/assessment_recommendation_award/age_range_subjects.html.erb index 7ed40ae40d..e510a46c30 100644 --- a/app/views/assessor_interface/assessment_recommendation_award/age_range_subjects.html.erb +++ b/app/views/assessor_interface/assessment_recommendation_award/age_range_subjects.html.erb @@ -38,7 +38,6 @@ end end %> -
- <%= govuk_button_link_to "Continue", [:preview, :assessor_interface, @application_form, @assessment, :assessment_recommendation_award] %> - <%= render "shared/assessor_interface/cancel_link" %> -
+<%= form_with url: [:confirm, :assessor_interface, @application_form, @assessment, :assessment_recommendation_award] do |f| %> + <% render "shared/assessor_interface/continue_cancel_button", f: %> +<% end %> diff --git a/app/views/assessor_interface/assessment_recommendation_award/preview.html.erb b/app/views/assessor_interface/assessment_recommendation_award/preview.html.erb deleted file mode 100644 index 4fdfb77c98..0000000000 --- a/app/views/assessor_interface/assessment_recommendation_award/preview.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -<% content_for :page_title, t(".heading") %> -<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %> - -

<%= t(".heading") %>

-

<%= t(".subheading") %>

-

<%= t(".description") %>

- -<%= render(PreviewMailer::Component.new( - mailer_class: TeacherMailer, - name: :application_awarded, - application_form: @application_form, -)) %> - -
- <%= govuk_button_link_to "Continue", [:confirm, :assessor_interface, @application_form, @assessment, :assessment_recommendation_award] %> - <%= render "shared/assessor_interface/cancel_link" %> -
diff --git a/app/views/assessor_interface/assessment_recommendation_decline/preview.html.erb b/app/views/assessor_interface/assessment_recommendation_decline/preview.html.erb deleted file mode 100644 index 8bc5fc6675..0000000000 --- a/app/views/assessor_interface/assessment_recommendation_decline/preview.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -<% content_for :page_title, t(".heading") %> -<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %> - -

<%= t(".heading") %>

-

<%= t(".subheading") %>

-

<%= t(".description") %>

- -<%= render(PreviewMailer::Component.new( - mailer_class: TeacherMailer, - name: :application_declined, - application_form: @application_form, -)) %> - -
- <%= govuk_button_link_to "Continue", [:confirm, :assessor_interface, @application_form, @assessment, :assessment_recommendation_decline] %> - <%= render "shared/assessor_interface/cancel_link" %> -
diff --git a/app/views/assessor_interface/further_information_requests/new.html.erb b/app/views/assessor_interface/further_information_requests/new.html.erb index 49a875b921..73627c54fc 100644 --- a/app/views/assessor_interface/further_information_requests/new.html.erb +++ b/app/views/assessor_interface/further_information_requests/new.html.erb @@ -1,16 +1,43 @@ -<% content_for :page_title, "Further information request email preview" %> -<% content_for :back_link_url, back_history_path(default: preview_assessor_interface_application_form_assessment_further_information_requests_path) %> +<% content_for :page_title, "Check the further information you’re asking the applicant for" %> +<% content_for :back_link_url, back_history_path(default: edit_assessor_interface_application_form_assessment_path(@application_form, @assessment)) %> -

Further information request email preview

+

Check the information you’re asking the applicant for

-<%= render(PreviewMailer::Component.new( - mailer_class: TeacherMailer, - name: :further_information_requested, - application_form: @application_form, -)) %> +<% @further_information_request.items.group_by(&:failure_reason_key).each do |failure_reason_key, items| %> + <% if failure_reason_key == "school_details_cannot_be_verified" %> +
+

Reason for request

+ <% if items.size == 1 %> +

We were unable to verify the details for <%= items.first.work_history.school_name %>.

+ <% else %> +

We were unable to verify the details for:

+ + <% end %> +

Note to applicant

-<%= form_with model: [:assessor_interface, @application_form, @assessment, @further_information_request] do |f| %> - <%= f.govuk_submit "Send email to applicant" do %> - <%= govuk_button_link_to "Back to overview", assessor_interface_application_form_path(@application_form), secondary: true %> + <%= govuk_inset_text do %> + <%= simple_format items.first.failure_reason_assessor_feedback %> + <% end %> +
+ <% else %> + <% items.each do |item| %> +
+

<%= t(item.failure_reason_key, scope: %i[assessor_interface assessment_sections failure_reasons as_statement]) %>

+ +

Note to applicant

+ + <%= govuk_inset_text do %> + <%= simple_format item.failure_reason_assessor_feedback %> + <% end %> +
+ <% end %> <% end %> <% end %> + +<%= form_with model: [:assessor_interface, @application_form, @assessment, @further_information_request] do |f| %> + <% render "shared/assessor_interface/continue_cancel_button", f: %> +<% end %> diff --git a/app/views/assessor_interface/further_information_requests/preview.html.erb b/app/views/assessor_interface/further_information_requests/preview.html.erb deleted file mode 100644 index 7d5535271b..0000000000 --- a/app/views/assessor_interface/further_information_requests/preview.html.erb +++ /dev/null @@ -1,44 +0,0 @@ -<% content_for :page_title, "Check the further information you’re asking the applicant for" %> -<% content_for :back_link_url, back_history_path(default: edit_assessor_interface_application_form_assessment_path(@application_form, @assessment)) %> - -

Check the information you’re asking the applicant for

- -<% @further_information_request.items.group_by(&:failure_reason_key).each do |failure_reason_key, items| %> - <% if failure_reason_key == "school_details_cannot_be_verified" %> -
-

Reason for request

- <% if items.size == 1 %> -

We were unable to verify the details for <%= items.first.work_history.school_name %>.

- <% else %> -

We were unable to verify the details for:

- - <% end %> -

Note to applicant

- - <%= govuk_inset_text do %> - <%= simple_format items.first.failure_reason_assessor_feedback %> - <% end %> -
- <% else %> - <% items.each do |item| %> -
-

<%= t(item.failure_reason_key, scope: %i[assessor_interface assessment_sections failure_reasons as_statement]) %>

- -

Note to applicant

- - <%= govuk_inset_text do %> - <%= simple_format item.failure_reason_assessor_feedback %> - <% end %> -
- <% end %> - <% end %> -<% end %> - -
- <%= govuk_button_link_to "Continue", new_assessor_interface_application_form_assessment_further_information_request_path(@application_form, @assessment) %> - <%= govuk_button_link_to "Back to overview", assessor_interface_application_form_path(@application_form), secondary: true %> -
diff --git a/config/locales/assessor_interface.en.yml b/config/locales/assessor_interface.en.yml index a3ac9e173a..2d25a8a5b5 100644 --- a/config/locales/assessor_interface.en.yml +++ b/config/locales/assessor_interface.en.yml @@ -55,10 +55,6 @@ en: heading: Confirm age range and subjects edit_age_range_subjects: heading: Edit age range and subjects - preview: - heading: Check the email - subheading: This screen shows how the email to the applicant will look. - description: Make sure you’re happy with the content, then select ‘Continue’, or select ‘Cancel’ to return to the application. edit_confirm: legend: Award this QTS application? hint: Select ‘Yes’ to confirm you want to award this application. If you’re not sure, or you need to check something, select ‘No’. @@ -73,10 +69,6 @@ en: english_language_proficiency: English language proficiency work_history: Work history professional_standing: Professional standing - preview: - heading: Check the email - subheading: This screen shows how the email to the applicant will look. - description: Make sure you’re happy with the content, then select ‘Continue’, or select ‘Cancel’ to return to the application. edit_confirm: legend: Decline this QTS application? hint: Select ‘Yes’ to confirm you want to decline this application. If you’re not sure, or you need to check something, select ‘No’. diff --git a/config/routes.rb b/config/routes.rb index 97d6f3b76c..63f6676006 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -62,7 +62,6 @@ to: "assessment_recommendation_award#edit_age_range_subjects" post "age-range-subjects/edit", to: "assessment_recommendation_award#update_age_range_subjects" - get "preview" get "confirm", to: "assessment_recommendation_award#edit_confirm" post "confirm", to: "assessment_recommendation_award#update_confirm" end @@ -71,7 +70,6 @@ controller: "assessment_recommendation_decline", path: "/recommendation/decline", only: %i[show edit update] do - get "preview" get "confirm", to: "assessment_recommendation_decline#edit_confirm" post "confirm", to: "assessment_recommendation_decline#update_confirm" end @@ -127,11 +125,7 @@ resources :further_information_requests, path: "/further-information-requests", - only: %i[new create edit update] do - get "preview", - to: "further_information_requests#preview", - on: :collection - end + only: %i[new create edit update] resource :professional_standing_request, path: "/professional-standing-request", diff --git a/spec/components/preview_mailer_component_spec.rb b/spec/components/preview_mailer_component_spec.rb deleted file mode 100644 index f90f6a4b30..0000000000 --- a/spec/components/preview_mailer_component_spec.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -require "rails_helper" - -RSpec.describe PreviewMailer::Component, type: :component do - let(:mailer_class) { TeacherMailer } - let(:name) { :name } - let(:teacher) { create(:teacher) } - let(:param) { "param" } - - subject(:component) do - render_inline(described_class.new(mailer_class:, name:, teacher:, param:)) - end - - let(:mailer) { double(name: "

Preview

") } - - before do - expect(MailerPreview).to receive(:with).with( - mailer_class, - teacher:, - param:, - ).and_return(mailer) - end - - it "renders the header" do - expect(component.css(".app-email-preview__header").text.strip).to eq( - "GOV.UK", - ) - end - - it "renders the content" do - expect(component.css(".app-email-preview__content").text.strip).to eq( - "Preview", - ) - end -end diff --git a/spec/lib/mailer_preview_spec.rb b/spec/lib/mailer_preview_spec.rb deleted file mode 100644 index 43744c554a..0000000000 --- a/spec/lib/mailer_preview_spec.rb +++ /dev/null @@ -1,59 +0,0 @@ -require "rails_helper" - -RSpec.describe MailerPreview do - let(:further_information_request) { create(:further_information_request) } - let(:application_form) do - further_information_request.assessment.application_form - end - let(:teacher) { application_form.teacher } - let(:notify_key) { "notify-key" } - let(:notify_client) do - double(generate_template_preview: notify_template_preview) - end - let(:notify_template_preview) { double(html: "email html") } - - around do |example| - ClimateControl.modify GOVUK_NOTIFY_API_KEY: notify_key do - example.run - end - end - - before do - allow(Notifications::Client).to receive(:new).with(notify_key).and_return( - notify_client, - ) - end - - describe "render preview" do - subject do - described_class.with( - TeacherMailer, - application_form:, - further_information_request:, - ).further_information_requested - end - - it { is_expected.to eq("email html") } - - it "renders the correct template" do - expect(notify_client).to receive(:generate_template_preview).with( - "95adafaf-0920-4623-bddc-340853c047af", - instance_of(Hash), - ) - subject - end - - it "passes the correct parameters" do - expect(notify_client).to receive(:generate_template_preview).with( - instance_of(String), - personalisation: { - to: teacher.email, - subject: - "We need some more information to progress your QTS application", - body: instance_of(String), - }, - ) - subject - end - end -end diff --git a/spec/policies/assessor_interface/further_information_request_policy_spec.rb b/spec/policies/assessor_interface/further_information_request_policy_spec.rb index 73f2065ee5..6f4b315999 100644 --- a/spec/policies/assessor_interface/further_information_request_policy_spec.rb +++ b/spec/policies/assessor_interface/further_information_request_policy_spec.rb @@ -20,11 +20,6 @@ it_behaves_like "a policy method without permission" end - describe "#preview?" do - subject(:preview?) { policy.preview? } - it_behaves_like "a policy method requiring the assess permission" - end - describe "#create?" do subject(:create?) { policy.create? } it_behaves_like "a policy method requiring the assess permission" diff --git a/spec/support/autoload/page_objects/assessor_interface/age_range_subjects_assessment_recommendation_award.rb b/spec/support/autoload/page_objects/assessor_interface/age_range_subjects_assessment_recommendation_award.rb index 622c8a726a..8b2a6eaa29 100644 --- a/spec/support/autoload/page_objects/assessor_interface/age_range_subjects_assessment_recommendation_award.rb +++ b/spec/support/autoload/page_objects/assessor_interface/age_range_subjects_assessment_recommendation_award.rb @@ -8,7 +8,7 @@ class AgeRangeSubjectsAssessmentRecommendationAward < SitePrism::Page element :heading, "h1" section :summary_list, GovukSummaryList, ".govuk-summary-list" - element :continue_button, "a.govuk-button" + element :continue_button, ".govuk-button" end end end diff --git a/spec/support/autoload/page_objects/assessor_interface/further_information_request_preview.rb b/spec/support/autoload/page_objects/assessor_interface/further_information_request_preview.rb deleted file mode 100644 index 36993df526..0000000000 --- a/spec/support/autoload/page_objects/assessor_interface/further_information_request_preview.rb +++ /dev/null @@ -1,17 +0,0 @@ -module PageObjects - module AssessorInterface - class FurtherInformationRequestPreview < SitePrism::Page - set_url "/assessor/applications/{reference}/assessments/{assessment_id}" \ - "/further-information-requests/new" - - element :email_preview, "div.app-email-preview" - - section :form, "form" do - element :send_to_applicant_button, - ".govuk-button:not(.govuk-button--secondary)" - element :back_to_overview_button, - ".govuk-button.govuk-button--secondary" - end - end - end -end diff --git a/spec/support/autoload/page_objects/assessor_interface/preview_assessment_recommendation.rb b/spec/support/autoload/page_objects/assessor_interface/preview_assessment_recommendation.rb deleted file mode 100644 index 1eb4369aa2..0000000000 --- a/spec/support/autoload/page_objects/assessor_interface/preview_assessment_recommendation.rb +++ /dev/null @@ -1,16 +0,0 @@ -module PageObjects - module AssessorInterface - class PreviewAssessmentRecommendation < SitePrism::Page - set_url "/assessor/applications/{reference}/assessments/{assessment_id}" \ - "/recommendation/{recommendation}/preview" - - element :heading, "h1" - - section :email_preview, ".app-email-preview" do - element :content, ".app-email-preview__content" - end - - element :send_button, ".govuk-button" - end - end -end diff --git a/spec/support/autoload/page_objects/assessor_interface/request_further_information.rb b/spec/support/autoload/page_objects/assessor_interface/request_further_information.rb index eb490f5079..04267511df 100644 --- a/spec/support/autoload/page_objects/assessor_interface/request_further_information.rb +++ b/spec/support/autoload/page_objects/assessor_interface/request_further_information.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + module PageObjects module AssessorInterface class RequestFurtherInformation < SitePrism::Page set_url "/assessor/applications/{reference}/assessments/{assessment_id}" \ - "/further-information-requests/preview" + "/further-information-requests/new" sections :items, ".app-further-information-request-item" do element :heading, ".govuk-heading-s" diff --git a/spec/support/page_helpers.rb b/spec/support/page_helpers.rb index 77cb01c8b8..8a452fc528 100644 --- a/spec/support/page_helpers.rb +++ b/spec/support/page_helpers.rb @@ -136,11 +136,6 @@ def assessor_login_page @assessor_login_page ||= PageObjects::AssessorInterface::Login.new end - def assessor_preview_assessment_recommendation_page - @assessor_preview_assessment_recommendation_page ||= - PageObjects::AssessorInterface::PreviewAssessmentRecommendation.new - end - def assessor_professional_standing_assessment_recommendation_verify_page @assessor_professional_standing_assessment_recommendation_verify_page ||= PageObjects::AssessorInterface::ProfessionalStandingAssessmentRecommendationVerify.new diff --git a/spec/system/assessor_interface/completing_assessment_spec.rb b/spec/system/assessor_interface/completing_assessment_spec.rb index 7b93531361..5c1b7a8ec6 100644 --- a/spec/system/assessor_interface/completing_assessment_spec.rb +++ b/spec/system/assessor_interface/completing_assessment_spec.rb @@ -3,27 +3,10 @@ require "rails_helper" RSpec.describe "Assessor completing assessment", type: :system do - let(:notify_key) { "notify-key" } - let(:notify_client) do - double(generate_template_preview: notify_template_preview) - end - let(:notify_template_preview) { double(html: "I am an email") } let(:assessor_user) do create(:staff, :with_assess_permission, name: "Authorized User") end - around do |example| - ClimateControl.modify GOVUK_NOTIFY_API_KEY: notify_key do - example.run - end - end - - before do - allow(Notifications::Client).to receive(:new).with(notify_key).and_return( - notify_client, - ) - end - it "award" do given_i_am_authorized_as_an_assessor_user given_there_is_an_awardable_application_form(%i[old_regs]) @@ -60,15 +43,6 @@ :assessor_age_range_subjects_assessment_recommendation_award_page, ) and_i_continue_from_age_range_subjects - - then_i_see_the( - :assessor_preview_assessment_recommendation_page, - reference:, - assessment_id:, - recommendation: "award", - ) - - when_i_send_the_email then_i_see_the( :assessor_confirm_assessment_recommendation_page, reference:, @@ -196,14 +170,6 @@ and_i_see_failure_reasons when_i_check_declaration - then_i_see_the( - :assessor_preview_assessment_recommendation_page, - reference:, - assessment_id:, - recommendation: "decline", - ) - - when_i_send_the_email then_i_see_the( :assessor_confirm_assessment_recommendation_page, reference:, @@ -404,10 +370,6 @@ def when_i_select_submit_verification_requests assessor_assessment_recommendation_verify_page.submit_button.click end - def when_i_send_the_email - assessor_preview_assessment_recommendation_page.send_button.click - end - def when_i_check_confirmation assessor_confirm_assessment_recommendation_page .form diff --git a/spec/system/assessor_interface/requesting_further_information_spec.rb b/spec/system/assessor_interface/requesting_further_information_spec.rb index 71e882fc89..21ee2134e1 100644 --- a/spec/system/assessor_interface/requesting_further_information_spec.rb +++ b/spec/system/assessor_interface/requesting_further_information_spec.rb @@ -3,24 +3,6 @@ require "rails_helper" RSpec.describe "Assessor requesting further information", type: :system do - let(:notify_key) { "notify-key" } - let(:notify_client) do - double(generate_template_preview: notify_template_preview) - end - let(:notify_template_preview) { double(html: "I am an email") } - - around do |example| - ClimateControl.modify GOVUK_NOTIFY_API_KEY: notify_key do - example.run - end - end - - before do - allow(Notifications::Client).to receive(:new).with(notify_key).and_return( - notify_client, - ) - end - it "completes an assessment" do given_i_am_authorized_as_an_assessor_user given_there_is_an_application_form_with_failure_reasons @@ -40,15 +22,7 @@ ) and_i_see_the_further_information_request_items - when_i_click_continue_to_email_button - then_i_see_the( - :assessor_further_information_request_preview_page, - reference:, - assessment_id:, - ) - and_i_see_the_email_preview - - when_i_click_send_to_applicant + when_i_click_the_continue_button then_i_see_the(:assessor_application_status_page, reference:) and_i_receive_a_further_information_requested_email end @@ -77,23 +51,10 @@ def and_i_see_the_further_information_request_items ).to eq("A note.") end - def when_i_click_continue_to_email_button + def when_i_click_the_continue_button assessor_request_further_information_page.continue_button.click end - def and_i_see_the_email_preview - expect( - assessor_further_information_request_preview_page.email_preview, - ).to have_content("I am an email") - end - - def when_i_click_send_to_applicant - assessor_further_information_request_preview_page - .form - .send_to_applicant_button - .click - end - def and_i_receive_a_further_information_requested_email message = ActionMailer::Base.deliveries.last expect(message).to_not be_nil