From b38b7d5e9507246d7d2ce9cf73cf880a4a94822e Mon Sep 17 00:00:00 2001 From: Catalina Ilie Date: Thu, 5 Oct 2023 12:15:57 +0100 Subject: [PATCH] Add user research banner to benefits pages --- .../content_item/recruitment_banner.rb | 24 ++++++++++++++ app/views/layouts/application.html.erb | 9 ++++++ test/integration/recruitment_banner_test.rb | 32 +++++++++++++++++++ 3 files changed, 65 insertions(+) diff --git a/app/presenters/content_item/recruitment_banner.rb b/app/presenters/content_item/recruitment_banner.rb index 94042e421..25a4e6d35 100644 --- a/app/presenters/content_item/recruitment_banner.rb +++ b/app/presenters/content_item/recruitment_banner.rb @@ -12,10 +12,34 @@ module RecruitmentBanner "/government/organisations/hm-revenue-customs/contact/self-assessment" => SURVEY_URL, }.freeze + BENEFITS_SURVEY_URL = "https://signup.take-part-in-research.service.gov.uk/home?utm_campaign=Content_History&utm_source=Hold_gov_to_account&utm_medium=gov.uk&t=GDS&id=16".freeze + BENEFITS_SURVEY_URL_MAPPINGS = { + "/disability-living-allowance-children" => BENEFITS_SURVEY_URL, + "/help-with-childcare-costs" => BENEFITS_SURVEY_URL, + "/financial-help-disabled" => BENEFITS_SURVEY_URL, + "/pip" => BENEFITS_SURVEY_URL, + "/blind-persons-allowance" => BENEFITS_SURVEY_URL, + "/dla-disability-living-allowance-benefit" => BENEFITS_SURVEY_URL, + "/carers-allowance" => BENEFITS_SURVEY_URL, + "/carers-credit" => BENEFITS_SURVEY_URL, + "/maternity-pay-leave" => BENEFITS_SURVEY_URL, + "/paternity-pay-leave" => BENEFITS_SURVEY_URL, + "/child-benefit" => BENEFITS_SURVEY_URL, + "/jobseekers-allowance" => BENEFITS_SURVEY_URL, + "/universal-credit" => BENEFITS_SURVEY_URL, + "/employment-support-allowance" => BENEFITS_SURVEY_URL, + "/benefits-calculators" => BENEFITS_SURVEY_URL, + }.freeze + def recruitment_survey_url user_research_test_url end + def benefits_recruitment_survey_url + key = content_item["base_path"] + BENEFITS_SURVEY_URL_MAPPINGS[key] + end + def user_research_test_url key = content_item["base_path"] SURVEY_URL_MAPPINGS[key] diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 3c65343e4..ad263732f 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -38,6 +38,15 @@ new_tab: true, } %> + <% elsif @content_item.benefits_recruitment_survey_url %> +
+ <%= render "govuk_publishing_components/components/intervention", { + suggestion_text: "Help improve GOV.UK", + suggestion_link_text: "Take part in user research", + suggestion_link_url: @content_item.benefits_recruitment_survey_url, + new_tab: true, + } %> +
<% end %> <%= yield :header %> diff --git a/test/integration/recruitment_banner_test.rb b/test/integration/recruitment_banner_test.rb index 82b74fabd..e368dfbd7 100644 --- a/test/integration/recruitment_banner_test.rb +++ b/test/integration/recruitment_banner_test.rb @@ -26,6 +26,38 @@ class RecruitmentBannerTest < ActionDispatch::IntegrationTest end end + test "Benefits user research banner is displayed on pages of interest" do + guide = GovukSchemas::Example.find("guide", example_name: "guide") + + pages_of_interest = + [ + "/disability-living-allowance-children", + "/help-with-childcare-costs", + "/financial-help-disabled", + "/pip", + "/blind-persons-allowance", + "/dla-disability-living-allowance-benefit", + "/carers-allowance", + "/carers-credit", + "/maternity-pay-leave", + "/paternity-pay-leave", + "/child-benefit", + "/jobseekers-allowance", + "/universal-credit", + "/employment-support-allowance", + "/benefits-calculators", + ] + + pages_of_interest.each do |path| + guide["base_path"] = path + stub_content_store_has_item(guide["base_path"], guide.to_json) + visit guide["base_path"] + + assert page.has_css?(".gem-c-intervention") + assert page.has_link?("Take part in user research", href: "https://signup.take-part-in-research.service.gov.uk/home?utm_campaign=Content_History&utm_source=Hold_gov_to_account&utm_medium=gov.uk&t=GDS&id=16") + end + end + test "User research banner is not displayed on all pages" do guide = GovukSchemas::Example.find("guide", example_name: "guide") guide["base_path"] = "/nothing-to-see-here"