diff --git a/app/presenters/content_item/recruitment_banner.rb b/app/presenters/content_item/recruitment_banner.rb new file mode 100644 index 000000000..94042e421 --- /dev/null +++ b/app/presenters/content_item/recruitment_banner.rb @@ -0,0 +1,24 @@ +module ContentItem + module RecruitmentBanner + SURVEY_URL = "https://surveys.publishing.service.gov.uk/s/SNFVW1/".freeze + SURVEY_URL_MAPPINGS = { + "/log-in-register-hmrc-online-services" => SURVEY_URL, + "/log-in-file-self-assessment-tax-return" => SURVEY_URL, + "/self-assessment-tax-returns" => SURVEY_URL, + "/pay-self-assessment-tax-bill" => SURVEY_URL, + "/contact-hmrc" => SURVEY_URL, + "/log-in-register-hmrc-online-services/register" => SURVEY_URL, + "/dbs-update-service" => SURVEY_URL, + "/government/organisations/hm-revenue-customs/contact/self-assessment" => SURVEY_URL, + }.freeze + + def recruitment_survey_url + user_research_test_url + end + + def user_research_test_url + key = content_item["base_path"] + SURVEY_URL_MAPPINGS[key] + end + end +end diff --git a/app/presenters/content_item_presenter.rb b/app/presenters/content_item_presenter.rb index 850db6aa7..ca3151668 100644 --- a/app/presenters/content_item_presenter.rb +++ b/app/presenters/content_item_presenter.rb @@ -1,5 +1,6 @@ class ContentItemPresenter include ContentItem::Withdrawable + include ContentItem::RecruitmentBanner attr_reader :content_item, :requested_path, diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 8c3eee441..3c65343e4 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -28,6 +28,17 @@ <%= render 'govuk_publishing_components/components/contextual_breadcrumbs', content_item: @content_item.parsed_content_item, ga4_tracking: true %> <% end %> <% end %> + + <% if @content_item.recruitment_survey_url %> +
+ <%= render "govuk_publishing_components/components/intervention", { + suggestion_text: "Help improve a new GOV.UK tool", + suggestion_link_text: "Sign up to take part in user research", + suggestion_link_url: @content_item.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 new file mode 100644 index 000000000..82b74fabd --- /dev/null +++ b/test/integration/recruitment_banner_test.rb @@ -0,0 +1,38 @@ +require "test_helper" + +class RecruitmentBannerTest < ActionDispatch::IntegrationTest + test "User research banner is displayed on pages of interest" do + guide = GovukSchemas::Example.find("guide", example_name: "guide") + + pages_of_interest = + [ + "/log-in-register-hmrc-online-services", + "/log-in-file-self-assessment-tax-return", + "/self-assessment-tax-returns", + "/pay-self-assessment-tax-bill", + "/contact-hmrc", + "/log-in-register-hmrc-online-services/register", + "/dbs-update-service", + "/government/organisations/hm-revenue-customs/contact/self-assessment", + ] + + 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?("Sign up to take part in user research", href: "https://surveys.publishing.service.gov.uk/s/SNFVW1/") + 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" + stub_content_store_has_item(guide["base_path"], guide.to_json) + visit guide["base_path"] + + assert_not page.has_css?(".gem-c-intervention") + assert_not page.has_link?("Sign up to take part in user research", href: "https://gov.uk") + end +end