Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take down content list AB test #3559

Merged
merged 2 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions app/controllers/content_items_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require "slimmer/headers"

class ContentItemsController < ApplicationController
include ContentsListAbTestable
include GovukPersonalisation::ControllerConcern
include Slimmer::Headers
include Slimmer::Template
Expand All @@ -16,9 +15,6 @@ class ContentItemsController < ApplicationController
rescue_from PresenterBuilder::SpecialRouteReturned, with: :error_notfound
rescue_from PresenterBuilder::GovernmentReturned, with: :error_notfound

helper_method :contents_list_variant
helper_method :step_by_step_page_under_test?

attr_accessor :content_item, :taxonomy_navigation

content_security_policy do |p|
Expand All @@ -36,10 +32,6 @@ def show
elsif is_history_page?
show_history_page
else
if step_by_step_page_under_test?
set_contents_list_response_header
end

set_guide_draft_access_token if @content_item.is_a?(GuidePresenter)
render_template
end
Expand All @@ -65,8 +57,6 @@ def service_sign_in_options

private

helper_method :show_contents_list_ab_test?

def is_history_page?
@content_item.document_type == "history"
end
Expand Down
61 changes: 0 additions & 61 deletions app/helpers/contents_list_ab_testable.rb

This file was deleted.

29 changes: 10 additions & 19 deletions app/views/content_items/guide.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
canonical_url: @content_item.canonical_url,
body: @content_item.has_parts? ? @content_item.current_part_body : nil
) %>
<%= contents_list_variant.analytics_meta_tag.html_safe if step_by_step_page_under_test? %>

<%= @requested_variant.analytics_meta_tag.html_safe if @requested_variant.present? %>
<% end %>

Expand All @@ -19,22 +19,13 @@

<div class="govuk-grid-row gem-print-columns-none">
<div class="govuk-grid-column-two-thirds">
<% if show_contents_list_ab_test? %>
<%= render 'govuk_publishing_components/components/heading', {
text: @content_item.title,
heading_level: 1,
font_size: "xl",
margin_bottom: 8
} %>
<% else %>
<%= render 'govuk_publishing_components/components/heading', {
text: @content_item.content_title,
heading_level: 1,
font_size: "xl",
margin_bottom: 8
} %>
<% end %>
<% if show_contents_list_ab_test? || @content_item.show_guide_navigation? %>
<%= render 'govuk_publishing_components/components/heading', {
text: @content_item.content_title,
heading_level: 1,
font_size: "xl",
margin_bottom: 8
} %>
<% if @content_item.show_guide_navigation? %>
<%= render "govuk_publishing_components/components/skip_link", {
text: t("guide.skip_contents"),
href: "#guide-contents"
Expand All @@ -47,7 +38,7 @@

<div class="govuk-grid-column-two-thirds govuk-!-margin-top-6" id="guide-contents">
<% if @content_item.has_parts? %>
<% if show_contents_list_ab_test? || @content_item.show_guide_navigation? %>
<% if @content_item.show_guide_navigation? %>
<%= render 'govuk_publishing_components/components/heading', heading_level: 1, font_size: 'l', margin_bottom: 6, text: @content_item.current_part_title %>
<% end %>
<%
Expand All @@ -64,7 +55,7 @@
<%= raw(@content_item.current_part_body) %>
<% end %>

<% if show_contents_list_ab_test? || @content_item.show_guide_navigation? %>
<% if @content_item.show_guide_navigation? %>
<%= render 'govuk_publishing_components/components/previous_and_next_navigation', @content_item.previous_and_next_navigation %>

<div class="responsive-bottom-margin">
Expand Down
42 changes: 0 additions & 42 deletions test/controllers/content_items_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -368,48 +368,6 @@ class ContentItemsControllerTest < ActionController::TestCase
assert_equal "true", @response.headers[Slimmer::Headers::REMOVE_SEARCH_HEADER]
end

test "Contents List AB test variant A" do
content_item = content_store_has_schema_example("guide", "guide-with-step-navs")
content_item["base_path"] = "/help-with-childcare-costs/support-while-you-study"
content_item["details"]["hide_chapter_navigation"] = true

stub_content_store_has_item(content_item["base_path"], content_item)

with_variant ContentsList: "A" do
get :show, params: { path: "help-with-childcare-costs/support-while-you-study" }
assert_response :success
assert_not response.body.include?("contents-list")
end
end

test "Contents List AB test variant B" do
content_item = content_store_has_schema_example("guide", "guide-with-step-navs")
content_item["base_path"] = "/help-with-childcare-costs/support-while-you-study"
content_item["details"]["hide_chapter_navigation"] = true

stub_content_store_has_item(content_item["base_path"], content_item)

with_variant ContentsList: "B" do
get :show, params: { path: "help-with-childcare-costs/support-while-you-study" }
assert_response :success
assert response.body.include?("contents-list")
end
end

test "Contents List AB test variant Z" do
content_item = content_store_has_schema_example("guide", "guide-with-step-navs")
content_item["base_path"] = "/help-with-childcare-costs/support-while-you-study"
content_item["details"]["hide_chapter_navigation"] = true

stub_content_store_has_item(content_item["base_path"], content_item)

with_variant ContentsList: "Z" do
get :show, params: { path: "help-with-childcare-costs/support-while-you-study" }
assert_response :success
assert_not response.body.include?("contents-list")
end
end

def path_for(content_item, locale = nil)
base_path = content_item["base_path"].sub(/^\//, "")
base_path.gsub!(/\.#{locale}$/, "") if locale
Expand Down
Loading