From 780aa399dd1835d3b97e62dbdd82442b2ddf99d2 Mon Sep 17 00:00:00 2001 From: Jessica Jones Date: Tue, 20 Aug 2024 12:49:17 +0100 Subject: [PATCH] Add user research banner As requested by MOD via our normal processes https://trello.com/c/2RgPDQf8/2800-govuk-user-research-banner-requests-mod --- .../content_items/detailed_guide.html.erb | 1 + lib/data/recruitment_banners.yml | 8 +++++- test/integration/recruitment_banner_test.rb | 25 +++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 test/integration/recruitment_banner_test.rb diff --git a/app/views/content_items/detailed_guide.html.erb b/app/views/content_items/detailed_guide.html.erb index 2ec31a688..f62f9e50e 100644 --- a/app/views/content_items/detailed_guide.html.erb +++ b/app/views/content_items/detailed_guide.html.erb @@ -3,6 +3,7 @@ schema: :faq ) %> <% end %> +<%= render 'shared/intervention_banner' %> <%= render 'shared/email_subscribe_unsubscribe_flash', { title: @content_item.title_and_context[:title] } %> diff --git a/lib/data/recruitment_banners.yml b/lib/data/recruitment_banners.yml index 76192b13a..fc6c4f413 100644 --- a/lib/data/recruitment_banners.yml +++ b/lib/data/recruitment_banners.yml @@ -4,8 +4,14 @@ # 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://google.com - # page_paths: + # page_paths: # - / # - /foreign-travel-advice banners: +- name: MOD banner 20/08/2024 + suggestion_text: "Help improve GOV.UK" + suggestion_link_text: "Take part in user research (opens in a new tab)" + survey_url: https://submit.forms.service.gov.uk/form/3874/give-feedback-on-medals-information-on-gov-uk/13188 + page_paths: + - /guidance/medals-campaigns-descriptions-and-eligibility diff --git a/test/integration/recruitment_banner_test.rb b/test/integration/recruitment_banner_test.rb new file mode 100644 index 000000000..744c69438 --- /dev/null +++ b/test/integration/recruitment_banner_test.rb @@ -0,0 +1,25 @@ +require "test_helper" + +class RecruitmentBannerTest < ActionDispatch::IntegrationTest + test "MOD banner 20/08/2024 is displayed on page of interest" do + detailed_guide = GovukSchemas::Example.find("detailed_guide", example_name: "detailed_guide") + path = "/guidance/medals-campaigns-descriptions-and-eligibility" + + detailed_guide["base_path"] = path + stub_content_store_has_item(detailed_guide["base_path"], detailed_guide.to_json) + visit detailed_guide["base_path"] + + assert page.has_css?(".gem-c-intervention") + assert page.has_link?("Take part in user research", href: "https://submit.forms.service.gov.uk/form/3874/give-feedback-on-medals-information-on-gov-uk/13188") + end + + test "MOD banner 20/08/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") + assert_not page.has_link?("Take part in user research", href: "https://submit.forms.service.gov.uk/form/3874/give-feedback-on-medals-information-on-gov-uk/13188") + end +end