Commit 16ceaddc authored by Alper Akgun's avatar Alper Akgun

Social sign in options to trial registration

parent bcb7a223
......@@ -16,6 +16,7 @@ module AuthHelper
twitter
).freeze
LDAP_PROVIDER = /\Aldap/.freeze
TRIAL_REGISTRATION_PROVIDERS = %w(google_oauth2 github).freeze
def ldap_enabled?
Gitlab::Auth::Ldap::Config.enabled?
......@@ -126,8 +127,8 @@ module AuthHelper
end
end
def experiment_enabled_button_based_providers
enabled_button_based_providers & %w(google_oauth2 github).freeze
def trial_enabled_button_based_providers
enabled_button_based_providers & TRIAL_REGISTRATION_PROVIDERS
end
def button_based_providers_enabled?
......
= render 'devise/shared/signup_omniauth_provider_list', providers: experiment_enabled_button_based_providers
= render 'devise/shared/signup_omniauth_provider_list', providers: trial_enabled_button_based_providers
.omniauth-divider.d-flex.align-items-center.text-center
= _("or")
......@@ -57,10 +57,8 @@ module Registrations
def apply_trial_for_trial_onboarding_flow
if apply_trial
record_experiment_user(:remove_known_trial_form_fields, namespace_id: @group.id)
record_experiment_user(:trial_registration_with_social_signin, namespace_id: @group.id)
record_experiment_user(:trial_onboarding_issues, namespace_id: @group.id)
record_experiment_conversion_event(:remove_known_trial_form_fields)
record_experiment_conversion_event(:trial_registration_with_social_signin)
record_experiment_conversion_event(:trial_onboarding_issues)
experiment(:registrations_group_invite, actor: current_user) do |experiment_instance|
......
......@@ -13,7 +13,6 @@ class TrialsController < ApplicationController
def new
record_experiment_user(:remove_known_trial_form_fields, remove_known_trial_form_fields_context)
record_experiment_user(:trial_registration_with_social_signin, trial_registration_with_social_signin_context)
end
def select
......@@ -40,10 +39,8 @@ class TrialsController < ApplicationController
if @result&.dig(:success)
record_experiment_user(:remove_known_trial_form_fields, namespace_id: @namespace.id)
record_experiment_user(:trial_registration_with_social_signin, namespace_id: @namespace.id)
record_experiment_user(:trial_onboarding_issues, namespace_id: @namespace.id)
record_experiment_conversion_event(:remove_known_trial_form_fields)
record_experiment_conversion_event(:trial_registration_with_social_signin)
record_experiment_conversion_event(:trial_onboarding_issues)
redirect_to group_url(@namespace, { trial: true })
......@@ -127,13 +124,4 @@ class TrialsController < ApplicationController
company_name_present: current_user.organization.present?
}
end
def trial_registration_with_social_signin_context
identities = current_user.identities.map(&:provider)
{
google_signon: identities.include?('google_oauth2'),
github_signon: identities.include?('github')
}
end
end
......@@ -2,12 +2,11 @@
module EE
module TrialRegistrationHelper
def social_signin_experiment_enabled?
def social_signin_enabled?
::Gitlab.com? &&
omniauth_enabled? &&
devise_mapping.omniauthable? &&
button_based_providers_enabled? &&
experiment_enabled?(:trial_registration_with_social_signin)
button_based_providers_enabled?
end
end
end
......@@ -11,7 +11,7 @@
= render 'devise/shared/signup_box',
url: trial_registrations_path,
button_text: _('Continue'),
show_omniauth_providers: social_signin_experiment_enabled?,
show_omniauth_providers: social_signin_enabled?,
omniauth_providers_placement: :top
= render 'devise/shared/sign_in_link'
---
title: Social sign in options to trial registration
merge_request: 55533
author:
type: added
---
name: trial_registration_with_social_signin_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45633
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/262853
milestone: '13.7'
type: experiment
group: group::conversion
default_enabled: false
......@@ -142,10 +142,8 @@ RSpec.describe Registrations::GroupsController do
expect(service).to receive(:execute).with(apply_trial_params).and_return({ success: true })
end
expect(controller).to receive(:record_experiment_user).with(:remove_known_trial_form_fields, namespace_id: group.id)
expect(controller).to receive(:record_experiment_user).with(:trial_registration_with_social_signin, namespace_id: group.id)
expect(controller).to receive(:record_experiment_user).with(:trial_onboarding_issues, namespace_id: group.id)
expect(controller).to receive(:record_experiment_conversion_event).with(:remove_known_trial_form_fields)
expect(controller).to receive(:record_experiment_conversion_event).with(:trial_registration_with_social_signin)
expect(controller).to receive(:record_experiment_conversion_event).with(:trial_onboarding_issues)
end
......
......@@ -12,13 +12,6 @@ RSpec.describe TrialsController do
}
end
let_it_be(:trial_registration_with_social_signin_context) do
{
google_signon: user.identities.select { |id| id.provider == 'google_auth2'}.present?,
github_signon: user.identities.select { |id| id.provider == 'github' }.present?
}
end
let(:dev_env_or_com) { true }
let(:logged_in) { true }
......@@ -63,7 +56,6 @@ RSpec.describe TrialsController do
it 'calls record_experiment_user for the experiments' do
expect(controller).to receive(:record_experiment_user).with(:remove_known_trial_form_fields, remove_known_trial_form_fields_context)
expect(controller).to receive(:record_experiment_user).with(:trial_registration_with_social_signin, trial_registration_with_social_signin_context)
subject
end
......@@ -198,10 +190,8 @@ RSpec.describe TrialsController do
it { is_expected.to redirect_to("/#{namespace.path}?trial=true") }
it 'calls the record conversion method for the experiments' do
expect(controller).to receive(:record_experiment_user).with(:remove_known_trial_form_fields, namespace_id: namespace.id)
expect(controller).to receive(:record_experiment_user).with(:trial_registration_with_social_signin, namespace_id: namespace.id)
expect(controller).to receive(:record_experiment_user).with(:trial_onboarding_issues, namespace_id: namespace.id)
expect(controller).to receive(:record_experiment_conversion_event).with(:remove_known_trial_form_fields)
expect(controller).to receive(:record_experiment_conversion_event).with(:trial_registration_with_social_signin)
expect(controller).to receive(:record_experiment_conversion_event).with(:trial_onboarding_issues)
subject
......@@ -222,7 +212,6 @@ RSpec.describe TrialsController do
it { is_expected.to render_template(:select) }
it 'does not call the record conversion method for the experiments' do
expect(controller).not_to receive(:record_experiment_conversion_event).with(:remove_known_trial_form_fields)
expect(controller).not_to receive(:record_experiment_conversion_event).with(:trial_registration_with_social_signin)
subject
end
......
......@@ -5,25 +5,23 @@ require 'spec_helper'
RSpec.describe EE::TrialRegistrationHelper do
using RSpec::Parameterized::TableSyntax
describe '#social_signin_experiment_enabled?' do
describe '#social_signin_enabled?' do
before do
allow(::Gitlab).to receive(:com?).and_return(com)
allow(view).to receive(:omniauth_enabled?).and_return(omniauth_enabled)
allow(view).to receive(:button_based_providers_enabled?).and_return(button_based_providers_enabled)
allow(view).to receive(:experiment_enabled?).with(:trial_registration_with_social_signin).and_return(experiment_enabled)
allow(view).to receive(:devise_mapping).and_return(double(omniauthable?: omniauthable))
end
subject { helper.social_signin_experiment_enabled? }
subject { helper.social_signin_enabled? }
where com: [true, false],
omniauth_enabled: [true, false],
omniauthable: [true, false],
button_based_providers_enabled: [true, false],
experiment_enabled: [true, false]
button_based_providers_enabled: [true, false]
with_them do
let(:result) { com && omniauth_enabled && button_based_providers_enabled && experiment_enabled && omniauthable }
let(:result) { com && omniauth_enabled && button_based_providers_enabled && omniauthable }
it { is_expected.to eq(result) }
end
......
......@@ -53,9 +53,6 @@ module Gitlab
remove_known_trial_form_fields: {
tracking_category: 'Growth::Conversion::Experiment::RemoveKnownTrialFormFields'
},
trial_registration_with_social_signin: {
tracking_category: 'Growth::Conversion::Experiment::TrialRegistrationWithSocialSigning'
},
invite_members_empty_project_version_a: {
tracking_category: 'Growth::Expansion::Experiment::InviteMembersEmptyProjectVersionA'
},
......
......@@ -99,19 +99,19 @@ RSpec.describe AuthHelper do
end
end
describe 'experiment_enabled_button_based_providers' do
describe 'trial_enabled_button_based_providers' do
it 'returns the intersection set of github & google_oauth2 with enabled providers' do
allow(helper).to receive(:enabled_button_based_providers) { %w(twitter github google_oauth2) }
expect(helper.experiment_enabled_button_based_providers).to eq(%w(github google_oauth2))
expect(helper.trial_enabled_button_based_providers).to eq(%w(github google_oauth2))
allow(helper).to receive(:enabled_button_based_providers) { %w(google_oauth2 bitbucket) }
expect(helper.experiment_enabled_button_based_providers).to eq(%w(google_oauth2))
expect(helper.trial_enabled_button_based_providers).to eq(%w(google_oauth2))
allow(helper).to receive(:enabled_button_based_providers) { %w(bitbucket) }
expect(helper.experiment_enabled_button_based_providers).to be_empty
expect(helper.trial_enabled_button_based_providers).to be_empty
end
end
......
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