diff --git a/app/views/content_items/service_manual_homepage.html.erb b/app/views/content_items/service_manual_homepage.html.erb index a2cc0f035..3b635e6cc 100644 --- a/app/views/content_items/service_manual_homepage.html.erb +++ b/app/views/content_items/service_manual_homepage.html.erb @@ -20,7 +20,14 @@

Helping teams to create and run great public services that meet the <%= link_to 'Service Standard', '/service-manual/service-standard', class: 'govuk-link govuk-link--inverse' %>.

-
+ <%= render "govuk_publishing_components/components/search", { label_text: "Search the service manual", diff --git a/test/integration/service_manual_homepage_test.rb b/test/integration/service_manual_homepage_test.rb index f464aed01..b17e0e66e 100644 --- a/test/integration/service_manual_homepage_test.rb +++ b/test/integration/service_manual_homepage_test.rb @@ -50,4 +50,13 @@ class ServiceManualHomepageTest < ActionDispatch::IntegrationTest assert page.has_link? "communities of practice", href: "/service-manual/communities" end + + test "the homepage includes GA4 form tracking on the search form" do + setup_and_visit_content_item("service_manual_homepage") + + assert page.has_selector?("[data-module='ga4-form-tracker']") + assert page.has_selector?("[data-ga4-form='{\"event_name\": \"search\", \"type\": \"content\", \"url\": \"/search/all\", \"section\": \"Service Manual\", \"action\": \"search\"}']") + assert page.has_selector?("[data-ga4-form-include-text]") + assert page.has_selector?("[data-ga4-form-no-answer-undefined]") + end end