Commit bcbc7388 authored by Dallas Reedy's avatar Dallas Reedy

Skip onboarding issues exp. when in trial flow

Use the existing in_trial_flow? helper method to skip the onboarding
issues experiment when we’re coming from, and therefore returning to,
/-/trials/new
parent 3993753d
......@@ -216,7 +216,10 @@ class RegistrationsController < Devise::RegistrationsController
end
def show_onboarding_issues_experiment?
!helpers.in_subscription_flow? && !helpers.in_invitation_flow? && !helpers.in_oauth_flow?
!helpers.in_subscription_flow? &&
!helpers.in_invitation_flow? &&
!helpers.in_oauth_flow? &&
!helpers.in_trial_flow?
end
end
......
......@@ -4,7 +4,7 @@
.row.flex-grow-1.bg-gray-light
.d-flex.flex-column.align-items-center.w-100.gl-p-5
.edit-profile.login-page.d-flex.flex-column.align-items-center.pt-lg-3
- if in_subscription_flow? || (onboarding_issues_experiment_enabled && !in_invitation_flow? && !in_oauth_flow?)
- if in_subscription_flow? || (onboarding_issues_experiment_enabled && !in_invitation_flow? && !in_oauth_flow? && !in_trial_flow?)
#progress-bar{ data: { is_in_subscription_flow: in_subscription_flow?.to_s, is_onboarding_issues_experiment_enabled: onboarding_issues_experiment_enabled.to_s } }
%h2.center= html_escape(_('Welcome to GitLab.com%{br_tag}@%{name}!')) % { name: html_escape(current_user.first_name), br_tag: '<br/>'.html_safe }
%p
......
......@@ -87,29 +87,38 @@ RSpec.describe RegistrationsController do
it { is_expected.not_to redirect_to new_users_sign_up_group_path }
end
context 'when in trial flow' do
before do
allow(controller.helpers).to receive(:in_trial_flow?).and_return(true)
end
it { is_expected.not_to redirect_to new_users_sign_up_group_path }
end
end
describe 'recording experiment user and track for the onboarding issues experiment' do
using RSpec::Parameterized::TableSyntax
where(:on_gitlab_com, :experiment_enabled, :in_subscription_flow, :in_invitation_flow, :experiment_enabled_for_user, :experiment_group) do
false | false | false | false | true | nil
false | false | false | true | true | nil
false | false | true | false | true | nil
false | false | true | true | true | nil
false | true | false | false | true | nil
false | true | false | true | true | nil
false | true | true | false | true | nil
false | true | true | true | true | nil
true | false | false | false | true | nil
true | false | false | true | true | nil
true | false | true | false | true | nil
true | false | true | true | true | nil
true | true | false | false | true | :experimental
true | true | false | false | false | :control
true | true | false | true | true | nil
true | true | true | false | true | nil
true | true | true | true | true | nil
where(:on_gitlab_com, :experiment_enabled, :in_subscription_flow, :in_invitation_flow, :in_trial_flow, :experiment_enabled_for_user, :experiment_group) do
false | false | false | false | false | true | nil
false | false | false | true | false | true | nil
false | false | true | false | false | true | nil
false | false | true | true | false | true | nil
false | true | false | false | false | true | nil
false | true | false | true | false | true | nil
false | true | true | false | false | true | nil
false | true | true | true | false | true | nil
true | false | false | false | false | true | nil
true | false | false | true | false | true | nil
true | false | true | false | false | true | nil
true | false | true | true | false | true | nil
true | true | false | false | false | true | :experimental
true | true | false | false | false | false | :control
true | true | true | false | false | true | nil
true | true | false | true | false | true | nil
true | true | false | false | true | true | nil
true | true | true | true | true | true | nil
end
with_them do
......@@ -118,6 +127,7 @@ RSpec.describe RegistrationsController do
stub_experiment(onboarding_issues: experiment_enabled)
allow(controller.helpers).to receive(:in_subscription_flow?).and_return(in_subscription_flow)
allow(controller.helpers).to receive(:in_invitation_flow?).and_return(in_invitation_flow)
allow(controller.helpers).to receive(:in_trial_flow?).and_return(in_trial_flow)
stub_experiment_for_user(onboarding_issues: experiment_enabled_for_user)
end
......
......@@ -7,6 +7,7 @@ RSpec.describe 'Welcome screen', :js do
let(:in_invitation_flow) { false }
let(:in_subscription_flow) { false }
let(:in_trial_flow) { false }
let(:part_of_onboarding_issues_experiment) { false }
describe 'on GitLab.com' do
......@@ -15,6 +16,7 @@ RSpec.describe 'Welcome screen', :js do
gitlab_sign_in(user)
allow_any_instance_of(EE::RegistrationsHelper).to receive(:in_invitation_flow?).and_return(in_invitation_flow)
allow_any_instance_of(EE::RegistrationsHelper).to receive(:in_subscription_flow?).and_return(in_subscription_flow)
allow_any_instance_of(EE::RegistrationsHelper).to receive(:in_trial_flow?).and_return(in_trial_flow)
stub_experiment_for_user(onboarding_issues: part_of_onboarding_issues_experiment)
visit users_sign_up_welcome_path
......@@ -47,6 +49,14 @@ RSpec.describe 'Welcome screen', :js do
expect(page).not_to have_content('Your profile')
end
end
context 'when in the trial flow' do
let(:in_trial_flow) { true }
it 'does not show the progress bar' do
expect(page).not_to have_content('Your profile')
end
end
end
context 'when in the subscription flow and part of the onboarding issues experiment' do
......
......@@ -20,29 +20,27 @@ RSpec.describe 'registrations/welcome' do
subject { rendered }
where(:in_subscription_flow, :in_trial_flow, :in_invitation_flow, :in_oauth_flow, :onboarding_issues_experiment_enabled, :flow) do
false | false | false | false | false | :regular
true | false | false | false | false | :subscription
false | true | false | false | false | :trial
false | false | true | false | false | :invitation
false | false | false | true | false | :oauth
false | false | false | false | true | :onboarding
false | false | true | false | true | :onboarding_invitation
false | false | false | true | true | :onboarding_oauth
where(:in_subscription_flow, :in_trial_flow, :in_invitation_flow, :in_oauth_flow, :onboarding_issues_experiment_enabled, :shows_progress_bar, :label_key, :is_continue_btn) do
false | false | false | false | false | false | nil | false # regular
true | false | false | false | false | true | :subscription | true # subscription
false | true | false | false | false | false | :trial | true # trial
false | false | true | false | false | false | nil | false # invitation
false | false | false | true | false | false | nil | false # oauth
false | false | false | false | true | true | nil | true # onboarding
true | false | false | false | true | true | :subscription | true # onboarding + subscription
false | true | false | false | true | false | :trial | true # onboarding + trial
false | false | true | false | true | false | nil | false # onboarding + invitation
false | false | false | true | true | false | nil | false # onboarding + oauth
end
def button_text
if %i(subscription trial onboarding).include?(flow)
'Continue'
else
'Get started!'
end
is_continue_btn ? 'Continue' : 'Get started!'
end
def label_text
if flow == :subscription
if label_key == :subscription
'Who will be using this GitLab subscription?'
elsif flow == :trial
elsif label_key == :trial
'Who will be using this GitLab trial?'
else
'Who will be using GitLab?'
......@@ -53,7 +51,7 @@ RSpec.describe 'registrations/welcome' do
it { is_expected.to have_button(button_text) }
it { is_expected.to have_selector('label[for="user_setup_for_company"]', text: label_text) }
it do
if %i(subscription onboarding).include?(flow)
if shows_progress_bar
is_expected.to have_selector('#progress-bar')
else
is_expected.not_to have_selector('#progress-bar')
......
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