Commit 6cab6507 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'nicolasdular/remove-default-to-issue-board-experiment' into 'master'

Redirect to learn gitlab experiment when available

See merge request gitlab-org/gitlab!52520
parents b84608c0 a3fc952a
......@@ -15,7 +15,7 @@ module Registrations
if current_user.save
hide_advanced_issues
if experiment_enabled?(:default_to_issues_board) && learn_gitlab.available?
if 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])
......
---
name: default_to_issues_board_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/43939
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/268298
milestone: '13.5'
type: experiment
group: group::conversion
default_enabled: true
......@@ -46,6 +46,10 @@ RSpec.describe 'User sees new onboarding flow', :js do
click_on 'Show me the basics'
expect(page).to have_content('Learn GitLab')
expect(page).to have_css('.selectable', text: 'Label = ~Novice')
visit group_path('test')
expect(page).to have_css('.popover', text: 'Here are all your projects in your group, including the one you just created. To start, let’s take a look at your personalized learning project which will help you learn about GitLab at your own pace. 1 / 2')
click_on 'Learn GitLab'
......@@ -56,9 +60,5 @@ RSpec.describe 'User sees new onboarding flow', :js do
page.find('.nav-item-name', text: 'Issues').click
expect(page).to have_css('.popover', text: 'Go to Issues > Boards to access your personalized learning issue board. 2 / 2')
click_on 'Boards'
expect(page).to have_css('.selectable', text: 'Label = ~Novice')
end
end
......@@ -70,10 +70,6 @@ module Gitlab
tracking_category: 'Growth::Conversion::Experiment::GroupOnlyTrials',
use_backwards_compatible_subject_index: true
},
default_to_issues_board: {
tracking_category: 'Growth::Conversion::Experiment::DefaultToIssuesBoard',
use_backwards_compatible_subject_index: true
},
jobs_empty_state: {
tracking_category: 'Growth::Activation::Experiment::JobsEmptyState'
},
......
......@@ -3,6 +3,8 @@
require 'spec_helper'
RSpec.describe Registrations::ExperienceLevelsController do
include AfterNextHelpers
let_it_be(:namespace) { create(:group, path: 'group-path' ) }
let_it_be(:user) { create(:user) }
......@@ -45,6 +47,9 @@ RSpec.describe Registrations::ExperienceLevelsController do
end
context 'with an authenticated user' do
let_it_be(:project) { build(:project, namespace: namespace, creator: user, path: 'project-path') }
let_it_be(:issues_board) { build(:board, id: 123, project: project) }
before do
sign_in(user)
stub_experiment_for_subject(onboarding_issues: true)
......@@ -85,91 +90,57 @@ RSpec.describe Registrations::ExperienceLevelsController do
end
end
describe 'redirection' do
let(:project) { build(:project, namespace: namespace, creator: user, path: 'project-path') }
let(:issues_board) { build(:board, id: 123, project: project) }
context 'when "Learn GitLab" project exists' do
let(:learn_gitlab_available?) { true }
before do
stub_experiment_for_subject(
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)
allow(learn_gitlab).to receive(:label).and_return(double(id: 1))
end
end
context 'when namespace_path param is missing' do
let(:params) { super().merge(namespace_path: nil) }
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
context 'redirection' do
context 'when namespace_path param is missing' do
let(:params) { super().merge(namespace_path: nil) }
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
where(
learn_gitlab_available?: [true, false]
)
with_them do
it { is_expected.to redirect_to(path) }
end
end
end
describe 'applying the chosen level' do
context 'when a "Learn GitLab" project is available' do
before do
allow_next_instance_of(LearnGitlab) do |learn_gitlab|
allow(learn_gitlab).to receive(:available?).and_return(true)
allow(learn_gitlab).to receive(:label).and_return(double(id: 1))
with_them do
it { is_expected.to redirect_to('/') }
end
end
context 'when novice' do
let(:params) { super().merge(experience_level: :novice) }
context 'when we have a namespace_path param' do
using RSpec::Parameterized::TableSyntax
it 'adds a BoardLabel' do
expect_next_instance_of(Boards::UpdateService) do |service|
expect(service).to receive(:execute)
end
subject
where(:learn_gitlab_available?, :path) do
true | '/group-path/project-path/-/boards/123'
false | '/group-path'
end
end
context 'when experienced' do
let(:params) { super().merge(experience_level: :experienced) }
it 'does not add a BoardLabel' do
expect(Boards::UpdateService).not_to receive(:new)
subject
with_them do
it { is_expected.to redirect_to(path) }
end
end
end
context 'when no "Learn GitLab" project exists' do
context 'when novice' do
let(:params) { super().merge(experience_level: :novice) }
before do
allow_next_instance_of(LearnGitlab) do |learn_gitlab|
allow(learn_gitlab).to receive(:available?).and_return(false)
end
it 'adds a BoardLabel' do
expect_next(Boards::UpdateService).to receive(:execute)
subject
end
end
context 'when experienced' do
let(:params) { super().merge(experience_level: :experienced) }
it 'does not add a BoardLabel' do
expect(Boards::UpdateService).not_to receive(:new)
......@@ -178,6 +149,20 @@ RSpec.describe Registrations::ExperienceLevelsController do
end
end
end
context 'when no "Learn GitLab" project exists' do
let(:params) { super().merge(experience_level: :novice) }
before do
allow_next(LearnGitlab).to receive(:available?).and_return(false)
end
it 'does not add a BoardLabel' do
expect(Boards::UpdateService).not_to receive(:new)
subject
end
end
end
context 'when user update fails' do
......
......@@ -15,8 +15,7 @@ RSpec.describe Gitlab::Experimentation::EXPERIMENTS do
:invite_members_empty_group_version_a,
:contact_sales_btn_in_app,
:customize_homepage,
:group_only_trials,
:default_to_issues_board
:group_only_trials
]
backwards_compatible_experiment_keys = described_class.filter { |_, v| v[:use_backwards_compatible_subject_index] }.keys
......
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