Commit 58485351 authored by Dallas Reedy's avatar Dallas Reedy

Run forcibly showing the trial status popover as its own experiment

- Create a new feature flag for the experiment
parent 55822d83
...@@ -21,7 +21,7 @@ module TrialStatusWidgetHelper ...@@ -21,7 +21,7 @@ module TrialStatusWidgetHelper
base_attrs.merge( base_attrs.merge(
group_name: group.name, group_name: group.name,
purchase_href: ultimate_subscription_path_for_group(group), purchase_href: ultimate_subscription_path_for_group(group),
start_initially_shown: force_popover_to_be_shown?(group.trial_days_remaining), start_initially_shown: in_forced_popover_experiment?(group) && force_popover_to_be_shown?(group.trial_days_remaining),
target_id: base_attrs[:container_id], target_id: base_attrs[:container_id],
trial_end_date: group.trial_ends_on trial_end_date: group.trial_ends_on
) )
...@@ -64,4 +64,8 @@ module TrialStatusWidgetHelper ...@@ -64,4 +64,8 @@ module TrialStatusWidgetHelper
def ultimate_subscription_path_for_group(group) def ultimate_subscription_path_for_group(group)
new_subscriptions_path(namespace_id: group.id, plan_id: ZUORA_ULTIMATE_PLAN_ID) new_subscriptions_path(namespace_id: group.id, plan_id: ZUORA_ULTIMATE_PLAN_ID)
end end
def in_forced_popover_experiment?(group)
experiment(:forcibly_show_trial_status_popover, group: group).variant.group == :experiment
end
end end
---
name: forcibly_show_trial_status_popover
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/65283
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/335043
milestone: '14.1'
type: experiment
group: group::conversion
default_enabled: false
...@@ -33,6 +33,7 @@ RSpec.describe TrialStatusWidgetHelper do ...@@ -33,6 +33,7 @@ RSpec.describe TrialStatusWidgetHelper do
before do before do
travel_to today_for_specs travel_to today_for_specs
stub_experiments(forcibly_show_trial_status_popover: :candidate)
end end
describe '#trial_status_popover_data_attrs' do describe '#trial_status_popover_data_attrs' do
...@@ -97,6 +98,18 @@ RSpec.describe TrialStatusWidgetHelper do ...@@ -97,6 +98,18 @@ RSpec.describe TrialStatusWidgetHelper do
include_examples 'returned data attributes' include_examples 'returned data attributes'
end end
end end
context 'when not part of the experiment' do
before do
stub_experiments(forcibly_show_trial_status_popover: :control)
end
where trial_days_remaining: [2, 5, 9, 14, 20]
with_them do
include_examples 'returned data attributes', shown: false
end
end
end end
describe '#trial_status_widget_data_attrs' do describe '#trial_status_widget_data_attrs' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment