Commit 1631bc18 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '246795-experiment-new-user-onboarding-default-to-viewing-issue-board' into 'master'

Experiment: New user onboarding default to viewing issue board

See merge request gitlab-org/gitlab!43939
parents 37e05ab8 cb3a898f
......@@ -14,7 +14,13 @@ module Registrations
if current_user.save
hide_advanced_issues
record_experiment_user(:default_to_issues_board)
if experiment_enabled?(:default_to_issues_board) && learn_gitlab.available?
redirect_to namespace_project_board_path(params[:namespace_path], learn_gitlab.project, learn_gitlab.board)
else
redirect_to group_path(params[:namespace_path])
end
else
render :show
end
......
......@@ -68,6 +68,9 @@ module Gitlab
},
group_only_trials: {
tracking_category: 'Growth::Conversion::Experiment::GroupOnlyTrials'
},
default_to_issues_board: {
tracking_category: 'Growth::Conversion::Experiment::DefaultToIssuesBoard'
}
}.freeze
......
......@@ -85,16 +85,49 @@ RSpec.describe Registrations::ExperienceLevelsController do
end
end
context 'when a namespace_path is sent' do
it { is_expected.to have_gitlab_http_status(:redirect) }
it { is_expected.to redirect_to(group_path(namespace)) }
describe 'redirection' do
let(:project) { build(:project, namespace: namespace, creator: user, path: 'project-path') }
let(:issues_board) { build(:board, id: 123, project: project) }
before do
stub_experiment_for_user(
onboarding_issues: true,
default_to_issues_board: default_to_issues_board_xp?
)
allow_next_instance_of(LearnGitlab) do |learn_gitlab|
allow(learn_gitlab).to receive(:available?).and_return(learn_gitlab_available?)
allow(learn_gitlab).to receive(:project).and_return(project)
allow(learn_gitlab).to receive(:board).and_return(issues_board)
end
end
context 'when no namespace_path is sent' do
context 'when namespace_path param is missing' do
let(:params) { super().merge(namespace_path: nil) }
it { is_expected.to have_gitlab_http_status(:redirect) }
it { is_expected.to redirect_to(root_path) }
where(
default_to_issues_board_xp?: [true, false],
learn_gitlab_available?: [true, false]
)
with_them do
it { is_expected.to redirect_to('/') }
end
end
context 'when we have a namespace_path param' do
using RSpec::Parameterized::TableSyntax
where(:default_to_issues_board_xp?, :learn_gitlab_available?, :path) do
true | true | '/group-path/project-path/-/boards/123'
true | false | '/group-path'
false | true | '/group-path'
false | false | '/group-path'
end
with_them do
it { is_expected.to redirect_to(path) }
end
end
end
describe 'applying the chosen level' do
......
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