Commit b036184a authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch '202632-change-copy-of-welcome-screen' into 'master'

Change copy of Welcome screen

Closes #202632

See merge request gitlab-org/gitlab!25526
parents 5d67a9c8 c7699877
......@@ -2,10 +2,33 @@
module EE
module RegistrationsHelper
def in_paid_signup_flow?
experiment_enabled?(:paid_signup_flow) &&
(redirect_to = session['user_return_to']) &&
URI.parse(redirect_to).path == new_subscriptions_path
include ::Gitlab::Utils::StrongMemoize
def in_subscription_flow?
redirect_path == new_subscriptions_path
end
def in_trial_flow?
redirect_path == new_trial_path
end
def setup_for_company_label_text
if in_subscription_flow?
_('Who will be using this GitLab subscription?')
elsif in_trial_flow?
_('Who will be using this GitLab trial?')
else
_('Who will be using GitLab?')
end
end
private
def redirect_path
strong_memoize(:redirect_path) do
redirect_to = session['user_return_to']
URI.parse(redirect_to).path if redirect_to
end
end
end
end
......@@ -3,7 +3,7 @@
.row.flex-grow-1.bg-gray-light
.d-flex.flex-column.align-items-center.w-100.gl-p-3
.edit-profile.login-page.d-flex.flex-column.align-items-center.pt-lg-3
- if in_paid_signup_flow?
- if in_subscription_flow?
#progress-bar
%h2.center= _('Welcome to GitLab.com<br>@%{name}!').html_safe % { name: html_escape(current_user.first_name) }
%p
......@@ -19,7 +19,7 @@
.form-text.text-muted= _('This will help us personalize your onboarding experience.')
.row
.form-group.col-sm-12
= f.label :setup_for_company, _('Who will be using this GitLab subscription?'), class: 'label-bold'
= f.label :setup_for_company, setup_for_company_label_text, class: 'label-bold'
.d-flex.flex-column.flex-lg-row
.flex-grow-1
= f.radio_button :setup_for_company, true
......@@ -30,4 +30,4 @@
.row
.form-group.col-sm-12.mb-0
= button_tag class: %w[btn btn-success w-100] do
= in_paid_signup_flow? ? _('Continue') : _('Get started!')
= in_subscription_flow? || in_trial_flow? ? _('Continue') : _('Get started!')
---
title: Change copy of Welcome screen
merge_request: 25526
author:
type: fixed
......@@ -5,22 +5,34 @@ require 'spec_helper'
describe EE::RegistrationsHelper do
using RSpec::Parameterized::TableSyntax
describe '#in_paid_signup_flow?' do
where(:user_return_to_path, :paid_signup_flow_enabled, :expected_result) do
'/-/subscriptions/new?plan_id=bronze_plan' | true | true
'/-/subscriptions/new?plan_id=bronze_plan' | false | false
'/foo' | true | false
'/foo' | false | false
nil | true | nil
nil | false | false
describe '#in_subscription_flow?' do
where(:user_return_to_path, :expected_result) do
'/-/subscriptions/new?plan_id=bronze_plan' | true
'/foo' | false
nil | false
end
with_them do
it 'returns the expected_result' do
allow(helper).to receive(:experiment_enabled?).with(:paid_signup_flow).and_return(paid_signup_flow_enabled)
allow(helper).to receive(:session).and_return('user_return_to' => user_return_to_path)
expect(helper.in_paid_signup_flow?).to eq(expected_result)
expect(helper.in_subscription_flow?).to eq(expected_result)
end
end
end
describe '#in_trial_flow?' do
where(:user_return_to_path, :expected_result) do
'/-/trials/new?glm_content=free-trial&glm_source=about.gitlab.com' | true
'/foo' | false
nil | false
end
with_them do
it 'returns the expected_result' do
allow(helper).to receive(:session).and_return('user_return_to' => user_return_to_path)
expect(helper.in_trial_flow?).to eq(expected_result)
end
end
end
......
......@@ -7,24 +7,38 @@ describe 'registrations/welcome' do
before do
allow(view).to receive(:current_user).and_return(user)
allow(view).to receive(:in_paid_signup_flow?).and_return(in_paid_signup_flow)
allow(view).to receive(:in_subscription_flow?).and_return(in_subscription_flow)
allow(view).to receive(:in_trial_flow?).and_return(in_trial_flow)
render
end
subject { rendered }
context 'in paid_signup_flow' do
let(:in_paid_signup_flow) { true }
context 'in subscription flow' do
let(:in_subscription_flow) { true }
let(:in_trial_flow) { false }
it { is_expected.to have_button('Continue') }
it { is_expected.to have_selector('#progress-bar') }
it { is_expected.to have_selector('label[for="user_setup_for_company"]', text: 'Who will be using this GitLab subscription?') }
end
context 'not in paid_signup_flow' do
let(:in_paid_signup_flow) { false }
context 'in trial flow' do
let(:in_subscription_flow) { false }
let(:in_trial_flow) { true }
it { is_expected.to have_button('Continue') }
it { is_expected.not_to have_selector('#progress-bar') }
it { is_expected.to have_selector('label[for="user_setup_for_company"]', text: 'Who will be using this GitLab trial?') }
end
context 'neither in subscription nor in trial flow' do
let(:in_subscription_flow) { false }
let(:in_trial_flow) { false }
it { is_expected.to have_button('Get started!') }
it { is_expected.not_to have_selector('#progress-bar') }
it { is_expected.to have_selector('label[for="user_setup_for_company"]', text: 'Who will be using GitLab?') }
end
end
......@@ -21879,9 +21879,15 @@ msgstr ""
msgid "Who will be able to see this group?"
msgstr ""
msgid "Who will be using GitLab?"
msgstr ""
msgid "Who will be using this GitLab subscription?"
msgstr ""
msgid "Who will be using this GitLab trial?"
msgstr ""
msgid "Wiki"
msgstr ""
......
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