Commit 310de66b authored by jejacks0n's avatar jejacks0n

Add new about your company form into registration

This introduces a new page to collect information from some users on
saas only, behind a feature flag, and with better test coverage.
parent ff31180b
---
name: about_your_company_registration_flow
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/83345
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/355909
milestone: '14.10'
type: development
group: group::adoption
default_enabled: false
......@@ -74,6 +74,11 @@ module EE
helpers.signup_onboarding_enabled?
end
def show_company_form?
update_params[:setup_for_company] == 'true' &&
::Feature.enabled?(:about_your_company_registration_flow)
end
def authorized_for_trial_onboarding!
access_denied! unless can?(current_user, :owner_access, learn_gitlab_project)
end
......@@ -99,7 +104,12 @@ module EE
path_for_signed_in_user(current_user)
else
bypass_registration_event(:creating_project)
experiment(:combined_registration, user: current_user).redirect_path
if show_company_form?
new_users_sign_up_company_path
else
experiment(:combined_registration, user: current_user).redirect_path
end
end
end
......
......@@ -2,7 +2,6 @@
- return if in_trial_flow?
- experiment(:bypass_registration, user: current_user) do |e|
- e.publish_to_database
- e.try do
.row
.form-group.col-sm-12
......@@ -19,3 +18,4 @@
= _('Join a project')
.form-text.gl-text-gray-600
= _('Join your team on GitLab and contribute to an existing project')
- e.publish_to_database
......@@ -282,6 +282,8 @@ RSpec.describe Registrations::WelcomeController do
context 'when joining_project is "false"' do
context 'when combined_registration is candidate variant' do
before do
stub_feature_flags(about_your_company_registration_flow: false)
allow(controller).to receive(:experiment).and_call_original
stub_experiments(combined_registration: :candidate)
end
......@@ -290,7 +292,17 @@ RSpec.describe Registrations::WelcomeController do
end
end
it { is_expected.to redirect_to new_users_sign_up_group_path }
context 'when setup_for_company is "true"' do
let(:setup_for_company) { 'true' }
it { is_expected.to redirect_to new_users_sign_up_company_path }
end
context 'when setup_for_company is "false"' do
let(:setup_for_company) { 'false' }
it { is_expected.to redirect_to new_users_sign_up_group_path }
end
context 'when in subscription flow' do
before do
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'Combined registration flow', :js do
let_it_be(:user) { create(:user) }
let(:experiments) { {} }
let(:feature_flags) { {} }
before do
# https://gitlab.com/gitlab-org/gitlab/-/issues/340302
......@@ -22,7 +22,12 @@ RSpec.describe 'Combined registration flow', :js do
end
context 'when combined_registration experiment variant is candidate' do
let(:experiments) { { combined_registration: :candidate } }
let(:feature_flags) do
{
combined_registration: true,
about_your_company_registration_flow: false
}
end
it 'A user can create a group and project' do
page.within '.js-group-path-display' do
......@@ -80,7 +85,13 @@ RSpec.describe 'Combined registration flow', :js do
end
context 'when require_verification_for_namespace_creation experiment is enabled' do
let(:experiments) { { combined_registration: :candidate, require_verification_for_namespace_creation: :candidate } }
let(:feature_flags) do
{
combined_registration: true,
about_your_company_registration_flow: false,
require_verification_for_namespace_creation: true
}
end
it 'shows a link to exit the page' do
expect(page).to have_link('Exit.', href: exit_users_sign_up_groups_projects_path)
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe "User registration", :js, :saas do
let_it_be(:user) { create(:user) }
before do
stub_feature_flags(
# This is an experiment that we're trying to clean up at the same time as
# adding these new registration flows:
# https://gitlab.com/gitlab-org/gitlab/-/issues/350278
bypass_registration: true,
# This is an "experiment" that's not been cleaned up and is over a year old:
# https://gitlab.com/gitlab-org/gitlab/-/issues/255170
user_other_role_details: true,
# This is an experiment that we want to clean up, but can't yet because of
# query limit concerns:
# https://gitlab.com/gitlab-org/gitlab/-/issues/350754
combined_registration: true,
# This is the feature flag for the new registration flows where the user is
# required to provide company details when registering for their company in
# both the standard registration and trial flows.
about_your_company_registration_flow: true
)
# The groups_and_projects_controller (on `click_on 'Create project'`) is over
# the query limit threshold, so we have to adjust it.
# https://gitlab.com/gitlab-org/gitlab/-/issues/338737
stub_const('Gitlab::QueryLimiting::Transaction::THRESHOLD', 270)
# Various actions in this flow can trigger a request off to the customerApp
# to log the lead data generated in the registration flows.
stub_request(:post, Gitlab::SubscriptionPortal.default_subscriptions_url).to_return(
status: 200,
body: '',
headers: {}
)
# TODO: should we setup and confirm the user via email to replicate a real flow?
sign_in user
visit users_sign_up_welcome_path
end
describe "when invited" do
# TODO: should this be tested better in relation to how it changes flows here?
it "should be tested"
end
describe "using the trial flow" do
# TODO: do we want to test this as part of this effort, or is it a separate lift?
it "should be tested"
end
describe "using the standard flow" do
it "presents the initial welcome step" do
expect(page).to have_content('Welcome to GitLab')
select 'Other', from: 'user_role'
# This is behind the user_other_role_details feature flag.
fill_in 'user_other_role', with: 'My role'
select 'A different reason', from: 'user_registration_objective'
fill_in 'jobs_to_be_done_other', with: 'My reason'
end
context "just for me" do
before do
choose 'Just me'
check 'I\'d like to receive updates about GitLab via email'
end
context "wanting to join a project" do
before do
choose 'Join a project'
click_on 'Continue'
end
it "takes me to my dashboard" do
expect(page).to have_content 'This user doesn\'t have any personal projects'
end
it "signs me up for email updates" do
expect(user.reload).to be_email_opted_in
end
end
context "wanting to create a project" do
# This flow is behind the combined_registration feature flag.
before do
choose 'Create a new project'
click_on 'Continue'
end
it "creates my new group and project without a trial" do
fill_in 'group_name', with: 'Test Group'
fill_in 'blank_project_name', with: 'Test Project'
click_on 'Create project'
# We end up in the continuous onboarding flow here...
expect(page).to have_content 'Get started with GitLab'
# TODO: do we need to test continuous onboarding better here?
# So have to verify the newly created project by navigating to our projects...
visit projects_path
# Where we have two projects, one being part of continuous onboarding.
expect(page).to have_content 'Test Group / Test Project'
expect(page).to have_content 'Test Group / Learn GitLab'
end
it "imports my existing project without a trial" do
click_on 'Import'
fill_in 'import_group_name', with: 'Test Group'
click_on 'GitHub'
# TODO: can this be tested to completion? that seems hard -- what can we do here?
# TODO: does the user end up in the continuous onboarding flow here?!?
expect(page).to have_content <<~MESSAGE.tr("\n", ' ')
To connect GitHub repositories, you first need to authorize
GitLab to access the list of your GitHub repositories.
MESSAGE
end
end
end
context "for my company" do
before do
choose 'My company or team'
end
context "wanting to join a project" do
before do
choose 'Join a project'
click_on 'Continue'
end
it "takes me to my dashboard" do
expect(page).to have_content 'This user doesn\'t have any personal projects'
end
end
context "wanting to create a project" do
# This flow is behind the combined_registration feature flag.
before do
choose 'Create a new project'
click_on 'Continue'
end
it "prompts for details about my company" do
expect(page).to have_content 'About your company'
fill_in 'company_name', with: 'Test Company'
select '1 - 99', from: 'company_size'
select 'United States of America', from: 'country'
select 'Florida', from: 'state'
fill_in 'phone_number', with: '+1234567890'
fill_in 'website_url', with: 'https://gitlab.com'
end
context "and opting into a trial" do
before do
click_button class: 'gl-toggle'
expect_next_instance_of(GitlabSubscriptions::CreateLeadService) do |service|
expect(service).to receive(:execute).with(
trial_user: ActionController::Parameters.new(
company_name: '',
company_size: '',
phone_number: '',
country: '',
website_url: '',
work_email: user.email,
uid: user.id,
setup_for_company: true,
skip_email_confirmation: true,
gitlab_com_trial: true,
provider: 'gitlab',
newsletter_segment: true
).permit!
).and_return(success: true)
end
# TODO: can these inputs really all be blank?
click_on 'Continue'
end
it "creates my new group and project with a trial" do
pending
fill_in 'group_name', with: 'Test Group'
fill_in 'blank_project_name', with: 'Test Project'
expect_next_instance_of(GitlabSubscriptions::CreateLeadService) do |service|
expect(service).to receive(:execute).with(
uid: user.id,
trial_user:
ActionController::Parameters.new(
namespace_id: Namespace.maximum(:id).to_i + 1,
trial_entity: 'company',
gitlab_com_trial: true,
sync_to_gl: true
).permit!
).and_return(success: true)
end
click_on 'Create project'
# TODO: do we end up in continuous onboarding?
expect(page).to have_content 'Get started with GitLab'
end
end
context "without a trial" do
before do
# TODO: can these inputs really all be blank?
click_on 'Continue'
end
it "creates my new group and project without a trial" do
pending
fill_in 'group_name', with: 'Test Group'
fill_in 'blank_project_name', with: 'Test Project'
click_on 'Create project'
# We end up in the continuous onboarding flow here...
expect(page).to have_content 'Get started with GitLab'
# So have to verify the newly created project by navigating to our projects...
visit projects_path
# Where we have two projects, one being part of continuous onboarding.
expect(page).to have_content 'Test Group / Test Project'
expect(page).to have_content 'Test Group / Learn GitLab'
end
end
end
end
end
end
......@@ -8,6 +8,7 @@ RSpec.describe 'User sees new onboarding flow', :js do
let_it_be(:trial_fields) { ['Company name', 'Number of employees', 'Telephone number', 'Country'] }
before do
stub_feature_flags(about_your_company_registration_flow: false)
allow(Gitlab).to receive(:com?).and_return(true)
sign_in(user)
visit users_sign_up_welcome_path
......
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