Skip to content

Commit dfdb864

Browse files
committed
Add recruitment banner to guides and answers
As requested by AI team
1 parent bfdf7e0 commit dfdb864

File tree

4 files changed

+86
-1
lines changed

4 files changed

+86
-1
lines changed

app/views/content_items/answer.html.erb

+1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55

66
<%= @requested_variant.analytics_meta_tag.html_safe if @requested_variant.present? %>
77
<% end %>
8+
<%= render 'shared/intervention_banner' %>
89
<%= render 'content_items/body_with_related_links' %>

app/views/content_items/guide.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
<% content_for :simple_header, true %>
1919

2020
<div class="govuk-grid-row gem-print-columns-none">
21+
<%= render 'shared/intervention_banner' %>
2122
<div class="govuk-grid-column-two-thirds">
2223
<%= render 'govuk_publishing_components/components/title', { title: @content_item.content_title } %>
23-
2424
<% if @content_item.show_guide_navigation? %>
2525
<%= render "govuk_publishing_components/components/skip_link", {
2626
text: t("guide.skip_contents"),

lib/data/recruitment_banners.yml

+24
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,27 @@ banners:
1616
page_paths:
1717
- /guidance/keeping-your-hmrc-login-details-safe
1818
- /government/collections/hmrc-phishing-and-scams-detailed-information
19+
- name: AI banner 11/11/2024
20+
suggestion_text: "Help improve GOV.UK"
21+
suggestion_link_text: "Sign up to take part in user research (opens in a new tab)"
22+
survey_url: https://survey.take-part-in-research.service.gov.uk/jfe/form/SV_2bggmg6xlelrO0S
23+
page_paths:
24+
- /self-assessment-tax-returns
25+
- /working-for-yourself
26+
- /self-employed-records
27+
- /expenses-if-youre-self-employed
28+
- /first-company-accounts-and-return
29+
- /what-is-the-construction-industry-scheme
30+
- /capital-allowances
31+
- /simpler-income-tax-cash-basis
32+
- /expenses-and-benefits-a-to-z
33+
- /capital-gains-tax
34+
- /directors-loans
35+
- /self-assessment-tax-return-forms
36+
- /running-a-limited-company
37+
- /calculate-tax-on-company-cars
38+
- /introduction-to-business-rates
39+
- /calculate-your-business-rates
40+
- /apply-for-business-rate-relief
41+
- /stop-being-self-employed
42+
- /tax-codes

test/integration/recruitment_banner_test.rb

+60
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,64 @@ class RecruitmentBannerTest < ActionDispatch::IntegrationTest
3131

3232
assert_not page.has_css?(".gem-c-intervention")
3333
end
34+
35+
test "AI banner 11/11/2024 is displayed on guides of interest" do
36+
guide_paths = [
37+
"/self-assessment-tax-returns",
38+
"/self-employed-records",
39+
"/expenses-if-youre-self-employed",
40+
"/first-company-accounts-and-return",
41+
"/capital-allowances",
42+
"/simpler-income-tax-cash-basis",
43+
"/capital-gains-tax",
44+
"/directors-loans",
45+
"/running-a-limited-company",
46+
"/introduction-to-business-rates",
47+
"/apply-for-business-rate-relief",
48+
"/tax-codes",
49+
]
50+
51+
content_item = GovukSchemas::Example.find("guide", example_name: "guide")
52+
53+
guide_paths.each do |path|
54+
content_item["base_path"] = path
55+
stub_content_store_has_item(content_item["base_path"], content_item.to_json)
56+
visit content_item["base_path"]
57+
58+
assert page.has_css?(".gem-c-intervention")
59+
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")
60+
end
61+
end
62+
63+
test "AI banner 11/11/2024 is displayed on answers of interest" do
64+
answer_paths = [
65+
"/working-for-yourself",
66+
"/what-is-the-construction-industry-scheme",
67+
"/expenses-and-benefits-a-to-z",
68+
"/self-assessment-tax-return-forms",
69+
"/calculate-tax-on-company-cars",
70+
"/calculate-your-business-rates",
71+
"/stop-being-self-employed",
72+
]
73+
74+
content_item = GovukSchemas::Example.find("answer", example_name: "answer")
75+
76+
answer_paths.each do |path|
77+
content_item["base_path"] = path
78+
stub_content_store_has_item(content_item["base_path"], content_item.to_json)
79+
visit content_item["base_path"]
80+
81+
assert page.has_css?(".gem-c-intervention")
82+
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")
83+
end
84+
end
85+
86+
test "AI banner 11/11/2024 is not displayed on all pages" do
87+
detailed_guide = GovukSchemas::Example.find("detailed_guide", example_name: "detailed_guide")
88+
detailed_guide["base_path"] = "/nothing-to-see-here"
89+
stub_content_store_has_item(detailed_guide["base_path"], detailed_guide.to_json)
90+
visit detailed_guide["base_path"]
91+
92+
assert_not page.has_css?(".gem-c-intervention")
93+
end
3494
end

0 commit comments

Comments
 (0)