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 ...@@ -15,7 +15,7 @@ module Registrations
if current_user.save if current_user.save
hide_advanced_issues 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) redirect_to namespace_project_board_path(params[:namespace_path], learn_gitlab.project, learn_gitlab.board)
else else
redirect_to group_path(params[:namespace_path]) 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 ...@@ -46,6 +46,10 @@ RSpec.describe 'User sees new onboarding flow', :js do
click_on 'Show me the basics' click_on 'Show me the basics'
expect(page).to have_content('Learn GitLab') 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') 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' click_on 'Learn GitLab'
...@@ -56,9 +60,5 @@ RSpec.describe 'User sees new onboarding flow', :js do ...@@ -56,9 +60,5 @@ RSpec.describe 'User sees new onboarding flow', :js do
page.find('.nav-item-name', text: 'Issues').click 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') 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
end end
...@@ -70,10 +70,6 @@ module Gitlab ...@@ -70,10 +70,6 @@ module Gitlab
tracking_category: 'Growth::Conversion::Experiment::GroupOnlyTrials', tracking_category: 'Growth::Conversion::Experiment::GroupOnlyTrials',
use_backwards_compatible_subject_index: true 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: { jobs_empty_state: {
tracking_category: 'Growth::Activation::Experiment::JobsEmptyState' tracking_category: 'Growth::Activation::Experiment::JobsEmptyState'
}, },
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Registrations::ExperienceLevelsController do RSpec.describe Registrations::ExperienceLevelsController do
include AfterNextHelpers
let_it_be(:namespace) { create(:group, path: 'group-path' ) } let_it_be(:namespace) { create(:group, path: 'group-path' ) }
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
...@@ -45,6 +47,9 @@ RSpec.describe Registrations::ExperienceLevelsController do ...@@ -45,6 +47,9 @@ RSpec.describe Registrations::ExperienceLevelsController do
end end
context 'with an authenticated user' do 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 before do
sign_in(user) sign_in(user)
stub_experiment_for_subject(onboarding_issues: true) stub_experiment_for_subject(onboarding_issues: true)
...@@ -85,91 +90,57 @@ RSpec.describe Registrations::ExperienceLevelsController do ...@@ -85,91 +90,57 @@ RSpec.describe Registrations::ExperienceLevelsController do
end end
end end
describe 'redirection' do context 'when "Learn GitLab" project exists' do
let(:project) { build(:project, namespace: namespace, creator: user, path: 'project-path') } let(:learn_gitlab_available?) { true }
let(:issues_board) { build(:board, id: 123, project: project) }
before do 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_next_instance_of(LearnGitlab) do |learn_gitlab|
allow(learn_gitlab).to receive(:available?).and_return(learn_gitlab_available?) 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(:project).and_return(project)
allow(learn_gitlab).to receive(:board).and_return(issues_board) allow(learn_gitlab).to receive(:board).and_return(issues_board)
allow(learn_gitlab).to receive(:label).and_return(double(id: 1))
end end
end end
context 'when namespace_path param is missing' do context 'redirection' do
let(:params) { super().merge(namespace_path: nil) } 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
where(:default_to_issues_board_xp?, :learn_gitlab_available?, :path) do where(
true | true | '/group-path/project-path/-/boards/123' learn_gitlab_available?: [true, false]
true | false | '/group-path' )
false | true | '/group-path'
false | false | '/group-path'
end
with_them do with_them do
it { is_expected.to redirect_to(path) } it { is_expected.to redirect_to('/') }
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))
end end
end end
context 'when novice' do context 'when we have a namespace_path param' do
let(:params) { super().merge(experience_level: :novice) } using RSpec::Parameterized::TableSyntax
it 'adds a BoardLabel' do where(:learn_gitlab_available?, :path) do
expect_next_instance_of(Boards::UpdateService) do |service| true | '/group-path/project-path/-/boards/123'
expect(service).to receive(:execute) false | '/group-path'
end
subject
end end
end
context 'when experienced' do
let(:params) { super().merge(experience_level: :experienced) }
it 'does not add a BoardLabel' do with_them do
expect(Boards::UpdateService).not_to receive(:new) it { is_expected.to redirect_to(path) }
subject
end end
end end
end end
context 'when no "Learn GitLab" project exists' do context 'when novice' do
let(:params) { super().merge(experience_level: :novice) } let(:params) { super().merge(experience_level: :novice) }
before do it 'adds a BoardLabel' do
allow_next_instance_of(LearnGitlab) do |learn_gitlab| expect_next(Boards::UpdateService).to receive(:execute)
allow(learn_gitlab).to receive(:available?).and_return(false)
end subject
end end
end
context 'when experienced' do
let(:params) { super().merge(experience_level: :experienced) }
it 'does not add a BoardLabel' do it 'does not add a BoardLabel' do
expect(Boards::UpdateService).not_to receive(:new) expect(Boards::UpdateService).not_to receive(:new)
...@@ -178,6 +149,20 @@ RSpec.describe Registrations::ExperienceLevelsController do ...@@ -178,6 +149,20 @@ RSpec.describe Registrations::ExperienceLevelsController do
end end
end 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 end
context 'when user update fails' do context 'when user update fails' do
......
...@@ -15,8 +15,7 @@ RSpec.describe Gitlab::Experimentation::EXPERIMENTS do ...@@ -15,8 +15,7 @@ RSpec.describe Gitlab::Experimentation::EXPERIMENTS do
:invite_members_empty_group_version_a, :invite_members_empty_group_version_a,
:contact_sales_btn_in_app, :contact_sales_btn_in_app,
:customize_homepage, :customize_homepage,
:group_only_trials, :group_only_trials
:default_to_issues_board
] ]
backwards_compatible_experiment_keys = described_class.filter { |_, v| v[:use_backwards_compatible_subject_index] }.keys 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