Skip to content

Commit

Permalink
Merge pull request #3412 from alphagov/AI_banner_11/11/2024
Browse files Browse the repository at this point in the history
Add recruitment banner to guides and answers
  • Loading branch information
hannako authored Nov 11, 2024
2 parents bfdf7e0 + dfdb864 commit 8c2cded
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/views/content_items/answer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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' %>
2 changes: 1 addition & 1 deletion app/views/content_items/guide.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
<% content_for :simple_header, true %>

<div class="govuk-grid-row gem-print-columns-none">
<%= render 'shared/intervention_banner' %>
<div class="govuk-grid-column-two-thirds">
<%= 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"),
Expand Down
24 changes: 24 additions & 0 deletions lib/data/recruitment_banners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
60 changes: 60 additions & 0 deletions test/integration/recruitment_banner_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 8c2cded

Please sign in to comment.