Commit 7891b938 authored by Vitaly Slobodin's avatar Vitaly Slobodin

Merge branch...

Merge branch '323227-experiment-cleanup-experiment-with-adding-social-sign-in-options-to-trial-registration-page' into 'master'

Social sign in options to trial registration [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!55533
parents 4535ff55 16ceaddc
...@@ -16,6 +16,7 @@ module AuthHelper ...@@ -16,6 +16,7 @@ module AuthHelper
twitter twitter
).freeze ).freeze
LDAP_PROVIDER = /\Aldap/.freeze LDAP_PROVIDER = /\Aldap/.freeze
TRIAL_REGISTRATION_PROVIDERS = %w(google_oauth2 github).freeze
def ldap_enabled? def ldap_enabled?
Gitlab::Auth::Ldap::Config.enabled? Gitlab::Auth::Ldap::Config.enabled?
...@@ -126,8 +127,8 @@ module AuthHelper ...@@ -126,8 +127,8 @@ module AuthHelper
end end
end end
def experiment_enabled_button_based_providers def trial_enabled_button_based_providers
enabled_button_based_providers & %w(google_oauth2 github).freeze enabled_button_based_providers & TRIAL_REGISTRATION_PROVIDERS
end end
def button_based_providers_enabled? 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 .omniauth-divider.d-flex.align-items-center.text-center
= _("or") = _("or")
...@@ -57,10 +57,8 @@ module Registrations ...@@ -57,10 +57,8 @@ module Registrations
def apply_trial_for_trial_onboarding_flow def apply_trial_for_trial_onboarding_flow
if apply_trial if apply_trial
record_experiment_user(:remove_known_trial_form_fields, namespace_id: @group.id) 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_user(:trial_onboarding_issues, namespace_id: @group.id)
record_experiment_conversion_event(:remove_known_trial_form_fields) 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) record_experiment_conversion_event(:trial_onboarding_issues)
experiment(:registrations_group_invite, actor: current_user) do |experiment_instance| experiment(:registrations_group_invite, actor: current_user) do |experiment_instance|
......
...@@ -13,7 +13,6 @@ class TrialsController < ApplicationController ...@@ -13,7 +13,6 @@ class TrialsController < ApplicationController
def new def new
record_experiment_user(:remove_known_trial_form_fields, remove_known_trial_form_fields_context) 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 end
def select def select
...@@ -40,10 +39,8 @@ class TrialsController < ApplicationController ...@@ -40,10 +39,8 @@ class TrialsController < ApplicationController
if @result&.dig(:success) if @result&.dig(:success)
record_experiment_user(:remove_known_trial_form_fields, namespace_id: @namespace.id) 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_user(:trial_onboarding_issues, namespace_id: @namespace.id)
record_experiment_conversion_event(:remove_known_trial_form_fields) 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) record_experiment_conversion_event(:trial_onboarding_issues)
redirect_to group_url(@namespace, { trial: true }) redirect_to group_url(@namespace, { trial: true })
...@@ -127,13 +124,4 @@ class TrialsController < ApplicationController ...@@ -127,13 +124,4 @@ class TrialsController < ApplicationController
company_name_present: current_user.organization.present? company_name_present: current_user.organization.present?
} }
end 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 end
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
module EE module EE
module TrialRegistrationHelper module TrialRegistrationHelper
def social_signin_experiment_enabled? def social_signin_enabled?
::Gitlab.com? && ::Gitlab.com? &&
omniauth_enabled? && omniauth_enabled? &&
devise_mapping.omniauthable? && devise_mapping.omniauthable? &&
button_based_providers_enabled? && button_based_providers_enabled?
experiment_enabled?(:trial_registration_with_social_signin)
end end
end end
end end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
= render 'devise/shared/signup_box', = render 'devise/shared/signup_box',
url: trial_registrations_path, url: trial_registrations_path,
button_text: _('Continue'), button_text: _('Continue'),
show_omniauth_providers: social_signin_experiment_enabled?, show_omniauth_providers: social_signin_enabled?,
omniauth_providers_placement: :top omniauth_providers_placement: :top
= render 'devise/shared/sign_in_link' = 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 ...@@ -142,10 +142,8 @@ RSpec.describe Registrations::GroupsController do
expect(service).to receive(:execute).with(apply_trial_params).and_return({ success: true }) expect(service).to receive(:execute).with(apply_trial_params).and_return({ success: true })
end 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(: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_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(: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) expect(controller).to receive(:record_experiment_conversion_event).with(:trial_onboarding_issues)
end end
......
...@@ -12,13 +12,6 @@ RSpec.describe TrialsController do ...@@ -12,13 +12,6 @@ RSpec.describe TrialsController do
} }
end 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(:dev_env_or_com) { true }
let(:logged_in) { true } let(:logged_in) { true }
...@@ -63,7 +56,6 @@ RSpec.describe TrialsController do ...@@ -63,7 +56,6 @@ RSpec.describe TrialsController do
it 'calls record_experiment_user for the experiments' 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(: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 subject
end end
...@@ -198,10 +190,8 @@ RSpec.describe TrialsController do ...@@ -198,10 +190,8 @@ RSpec.describe TrialsController do
it { is_expected.to redirect_to("/#{namespace.path}?trial=true") } it { is_expected.to redirect_to("/#{namespace.path}?trial=true") }
it 'calls the record conversion method for the experiments' do 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(: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_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(: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) expect(controller).to receive(:record_experiment_conversion_event).with(:trial_onboarding_issues)
subject subject
...@@ -222,7 +212,6 @@ RSpec.describe TrialsController do ...@@ -222,7 +212,6 @@ RSpec.describe TrialsController do
it { is_expected.to render_template(:select) } it { is_expected.to render_template(:select) }
it 'does not call the record conversion method for the experiments' do 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(:remove_known_trial_form_fields)
expect(controller).not_to receive(:record_experiment_conversion_event).with(:trial_registration_with_social_signin)
subject subject
end end
......
...@@ -5,25 +5,23 @@ require 'spec_helper' ...@@ -5,25 +5,23 @@ require 'spec_helper'
RSpec.describe EE::TrialRegistrationHelper do RSpec.describe EE::TrialRegistrationHelper do
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
describe '#social_signin_experiment_enabled?' do describe '#social_signin_enabled?' do
before do before do
allow(::Gitlab).to receive(:com?).and_return(com) allow(::Gitlab).to receive(:com?).and_return(com)
allow(view).to receive(:omniauth_enabled?).and_return(omniauth_enabled) 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(: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)) allow(view).to receive(:devise_mapping).and_return(double(omniauthable?: omniauthable))
end end
subject { helper.social_signin_experiment_enabled? } subject { helper.social_signin_enabled? }
where com: [true, false], where com: [true, false],
omniauth_enabled: [true, false], omniauth_enabled: [true, false],
omniauthable: [true, false], omniauthable: [true, false],
button_based_providers_enabled: [true, false], button_based_providers_enabled: [true, false]
experiment_enabled: [true, false]
with_them do 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) } it { is_expected.to eq(result) }
end end
......
...@@ -53,9 +53,6 @@ module Gitlab ...@@ -53,9 +53,6 @@ module Gitlab
remove_known_trial_form_fields: { remove_known_trial_form_fields: {
tracking_category: 'Growth::Conversion::Experiment::RemoveKnownTrialFormFields' tracking_category: 'Growth::Conversion::Experiment::RemoveKnownTrialFormFields'
}, },
trial_registration_with_social_signin: {
tracking_category: 'Growth::Conversion::Experiment::TrialRegistrationWithSocialSigning'
},
invite_members_empty_project_version_a: { invite_members_empty_project_version_a: {
tracking_category: 'Growth::Expansion::Experiment::InviteMembersEmptyProjectVersionA' tracking_category: 'Growth::Expansion::Experiment::InviteMembersEmptyProjectVersionA'
}, },
......
...@@ -99,19 +99,19 @@ RSpec.describe AuthHelper do ...@@ -99,19 +99,19 @@ RSpec.describe AuthHelper do
end end
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 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) } 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) } 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) } 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
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