From dfdb8643f146a9bdfdfe335b5c7c5ad1d87d3de0 Mon Sep 17 00:00:00 2001 From: Jessica Jones Date: Mon, 11 Nov 2024 11:48:09 +0000 Subject: [PATCH] Add recruitment banner to guides and answers As requested by AI team --- app/views/content_items/answer.html.erb | 1 + app/views/content_items/guide.html.erb | 2 +- lib/data/recruitment_banners.yml | 24 +++++++++ test/integration/recruitment_banner_test.rb | 60 +++++++++++++++++++++ 4 files changed, 86 insertions(+), 1 deletion(-) diff --git a/app/views/content_items/answer.html.erb b/app/views/content_items/answer.html.erb index 8f0ba9500..f581b025d 100644 --- a/app/views/content_items/answer.html.erb +++ b/app/views/content_items/answer.html.erb @@ -5,4 +5,5 @@ <%= @requested_variant.analytics_meta_tag.html_safe if @requested_variant.present? %> <% end %> +<%= render 'shared/intervention_banner' %> <%= render 'content_items/body_with_related_links' %> diff --git a/app/views/content_items/guide.html.erb b/app/views/content_items/guide.html.erb index 0d2e04ae9..36be7b1b6 100644 --- a/app/views/content_items/guide.html.erb +++ b/app/views/content_items/guide.html.erb @@ -18,9 +18,9 @@ <% content_for :simple_header, true %>
+ <%= render 'shared/intervention_banner' %>
<%= render 'govuk_publishing_components/components/title', { title: @content_item.content_title } %> - <% if @content_item.show_guide_navigation? %> <%= render "govuk_publishing_components/components/skip_link", { text: t("guide.skip_contents"), diff --git a/lib/data/recruitment_banners.yml b/lib/data/recruitment_banners.yml index 32c4121eb..a6379b50e 100644 --- a/lib/data/recruitment_banners.yml +++ b/lib/data/recruitment_banners.yml @@ -16,3 +16,27 @@ banners: page_paths: - /guidance/keeping-your-hmrc-login-details-safe - /government/collections/hmrc-phishing-and-scams-detailed-information +- name: AI banner 11/11/2024 + suggestion_text: "Help improve GOV.UK" + suggestion_link_text: "Sign up to take part in user research (opens in a new tab)" + survey_url: https://survey.take-part-in-research.service.gov.uk/jfe/form/SV_2bggmg6xlelrO0S + page_paths: + - /self-assessment-tax-returns + - /working-for-yourself + - /self-employed-records + - /expenses-if-youre-self-employed + - /first-company-accounts-and-return + - /what-is-the-construction-industry-scheme + - /capital-allowances + - /simpler-income-tax-cash-basis + - /expenses-and-benefits-a-to-z + - /capital-gains-tax + - /directors-loans + - /self-assessment-tax-return-forms + - /running-a-limited-company + - /calculate-tax-on-company-cars + - /introduction-to-business-rates + - /calculate-your-business-rates + - /apply-for-business-rate-relief + - /stop-being-self-employed + - /tax-codes diff --git a/test/integration/recruitment_banner_test.rb b/test/integration/recruitment_banner_test.rb index 86cf5ac48..489af10b5 100644 --- a/test/integration/recruitment_banner_test.rb +++ b/test/integration/recruitment_banner_test.rb @@ -31,4 +31,64 @@ class RecruitmentBannerTest < ActionDispatch::IntegrationTest assert_not page.has_css?(".gem-c-intervention") end + + test "AI banner 11/11/2024 is displayed on guides of interest" do + guide_paths = [ + "/self-assessment-tax-returns", + "/self-employed-records", + "/expenses-if-youre-self-employed", + "/first-company-accounts-and-return", + "/capital-allowances", + "/simpler-income-tax-cash-basis", + "/capital-gains-tax", + "/directors-loans", + "/running-a-limited-company", + "/introduction-to-business-rates", + "/apply-for-business-rate-relief", + "/tax-codes", + ] + + content_item = GovukSchemas::Example.find("guide", example_name: "guide") + + guide_paths.each do |path| + content_item["base_path"] = path + stub_content_store_has_item(content_item["base_path"], content_item.to_json) + visit content_item["base_path"] + + assert page.has_css?(".gem-c-intervention") + assert page.has_link?("Sign up to take part in user research (opens in a new tab)", href: "https://survey.take-part-in-research.service.gov.uk/jfe/form/SV_2bggmg6xlelrO0S") + end + end + + test "AI banner 11/11/2024 is displayed on answers of interest" do + answer_paths = [ + "/working-for-yourself", + "/what-is-the-construction-industry-scheme", + "/expenses-and-benefits-a-to-z", + "/self-assessment-tax-return-forms", + "/calculate-tax-on-company-cars", + "/calculate-your-business-rates", + "/stop-being-self-employed", + ] + + content_item = GovukSchemas::Example.find("answer", example_name: "answer") + + answer_paths.each do |path| + content_item["base_path"] = path + stub_content_store_has_item(content_item["base_path"], content_item.to_json) + visit content_item["base_path"] + + assert page.has_css?(".gem-c-intervention") + assert page.has_link?("Sign up to take part in user research (opens in a new tab)", href: "https://survey.take-part-in-research.service.gov.uk/jfe/form/SV_2bggmg6xlelrO0S") + end + end + + test "AI banner 11/11/2024 is not displayed on all pages" do + detailed_guide = GovukSchemas::Example.find("detailed_guide", example_name: "detailed_guide") + detailed_guide["base_path"] = "/nothing-to-see-here" + stub_content_store_has_item(detailed_guide["base_path"], detailed_guide.to_json) + visit detailed_guide["base_path"] + + assert_not page.has_css?(".gem-c-intervention") + end end