Commit 06da8d4c authored by Jay Swain's avatar Jay Swain

Promote new_repo experiment

We're promoting the winning segments of the new_repo experiment and
removing the experimentation code

part of:
https://gitlab.com/gitlab-org/gitlab/-/issues/332076

Changelog: changed
parent 9b2ca8da
......@@ -4,12 +4,10 @@ import blankProjectIllustration from '@gitlab/svgs/dist/illustrations/project-cr
import importProjectIllustration from '@gitlab/svgs/dist/illustrations/project-import-sm.svg';
import ciCdProjectIllustration from '@gitlab/svgs/dist/illustrations/project-run-CICD-pipelines-sm.svg';
import { GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
import { experiment } from '~/experimentation/utils';
import { s__ } from '~/locale';
import NewNamespacePage from '~/vue_shared/new_namespace/new_namespace_page.vue';
import NewProjectPushTipPopover from './new_project_push_tip_popover.vue';
const NEW_REPO_EXPERIMENT = 'new_repo';
const CI_CD_PANEL = 'cicd_for_external_repo';
const PANELS = [
{
......@@ -79,28 +77,8 @@ export default {
},
computed: {
decoratedPanels() {
const PANEL_TITLES = experiment(NEW_REPO_EXPERIMENT, {
use: () => ({
blank: s__('ProjectsNew|Create blank project'),
import: s__('ProjectsNew|Import project'),
}),
try: () => ({
blank: s__('ProjectsNew|Create blank project/repository'),
import: s__('ProjectsNew|Import project/repository'),
}),
});
return PANELS.map(({ key, title, ...el }) => ({
...el,
title: PANEL_TITLES[key] ?? title,
}));
},
availablePanels() {
return this.isCiCdAvailable
? this.decoratedPanels
: this.decoratedPanels.filter((p) => p.name !== CI_CD_PANEL);
return this.isCiCdAvailable ? PANELS : PANELS.filter((p) => p.name !== CI_CD_PANEL);
},
},
......@@ -112,7 +90,6 @@ export default {
}
},
},
EXPERIMENT: NEW_REPO_EXPERIMENT,
};
</script>
......@@ -122,7 +99,6 @@ export default {
:panels="availablePanels"
:jump-to-last-persisted-panel="hasErrors"
:title="s__('ProjectsNew|Create new project')"
:experiment="$options.EXPERIMENT"
persistence-key="new_project_last_active_tab"
@panel-change="resetProjectErrors"
>
......
......@@ -16,14 +16,9 @@ export default {
type: Array,
required: true,
},
experiment: {
type: String,
required: false,
default: null,
},
},
created() {
const trackingMixin = Tracking.mixin({ ...gon.tracking_data, experiment: this.experiment });
const trackingMixin = Tracking.mixin();
const trackingInstance = new Vue({
...trackingMixin,
render() {
......
......@@ -36,11 +36,6 @@ export default {
type: String,
required: true,
},
experiment: {
type: String,
required: false,
default: null,
},
},
data() {
......@@ -103,12 +98,7 @@ export default {
</script>
<template>
<welcome-page
v-if="activePanelName === null"
:panels="panels"
:title="title"
:experiment="experiment"
>
<welcome-page v-if="!activePanelName" :panels="panels" :title="title">
<template #footer>
<slot name="welcome-footer"> </slot>
</template>
......
......@@ -39,11 +39,6 @@ class ProjectsController < Projects::ApplicationController
push_frontend_feature_flag(:refactor_blob_viewer, @project, default_enabled: :yaml)
end
before_action only: [:new] do
# Run experiment before render so it will be written to the `gon` for FE
helpers.new_repo_experiment_text
end
layout :determine_layout
feature_category :projects, [
......@@ -78,7 +73,6 @@ class ProjectsController < Projects::ApplicationController
@project = ::Projects::CreateService.new(current_user, project_params(attributes: project_params_create_attributes)).execute
if @project.saved?
experiment(:new_repo, user: current_user).track(:project_created)
experiment(:new_project_readme, actor: current_user).track(
:created,
property: active_new_project_tab,
......
......@@ -21,13 +21,6 @@ module Nav
}
end
def new_repo_experiment_text
experiment(:new_repo, user: current_user) do |e|
e.use { _('New project') }
e.try { _('New project/repository') }
end.run
end
private
def group_menu_section(group)
......@@ -37,9 +30,9 @@ module Nav
menu_items.push(
::Gitlab::Nav::TopNavMenuItem.build(
id: 'new_project',
title: new_repo_experiment_text,
title: _('New project/repository'),
href: new_project_path(namespace_id: group.id),
data: { track_experiment: 'new_repo', track_event: 'click_link_new_project_group', track_label: 'plus_menu_dropdown' }
data: { track_event: 'click_link_new_project_group', track_label: 'plus_menu_dropdown' }
)
)
end
......@@ -129,9 +122,9 @@ module Nav
menu_items.push(
::Gitlab::Nav::TopNavMenuItem.build(
id: 'general_new_project',
title: new_repo_experiment_text,
title: _('New project/repository'),
href: new_project_path,
data: { track_experiment: 'new_repo', track_event: 'click_link_new_project', track_label: 'plus_menu_dropdown', qa_selector: 'global_new_project_link' }
data: { track_event: 'click_link_new_project', track_label: 'plus_menu_dropdown', qa_selector: 'global_new_project_link' }
)
)
end
......
......@@ -98,7 +98,7 @@ module Nav
builder.add_primary_menu_item_with_shortcut(
active: nav == 'project' || active_nav_link?(path: %w[root#index projects#trending projects#starred dashboard/projects#index]),
css_class: 'qa-projects-dropdown',
data: { track_label: "projects_dropdown", track_event: "click_dropdown", track_experiment: "new_repo" },
data: { track_label: "projects_dropdown", track_event: "click_dropdown" },
view: PROJECTS_VIEW,
shortcut_href: dashboard_projects_path,
**projects_menu_item_attrs
......
......@@ -6,7 +6,7 @@
- return if menu_sections.empty?
%li.header-new.dropdown{ class: top_class, data: { track_label: "new_dropdown", track_event: "click_dropdown", track_experiment: "new_repo" } }
%li.header-new.dropdown{ class: top_class, data: { track_label: "new_dropdown", track_event: "click_dropdown" } }
= link_to new_project_path, class: "header-new-dropdown-toggle has-tooltip", id: "js-onboarding-new-project-link", title: title, ref: 'tooltip', aria: { label: title }, data: { toggle: 'dropdown', placement: 'bottom', container: 'body', display: 'static', qa_selector: 'new_menu_toggle' } do
= sprite_icon('plus-square')
= sprite_icon('chevron-down', css_class: 'caret-down')
......
......@@ -4,7 +4,7 @@
-# [1]: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56587
%ul.list-unstyled.navbar-sub-nav
- if dashboard_nav_link?(:projects)
= nav_link(path: ['root#index', 'projects#trending', 'projects#starred', 'dashboard/projects#index'], html_options: { id: 'nav-projects-dropdown', class: "home dropdown header-projects", data: { track_label: "projects_dropdown", track_event: "click_dropdown", track_experiment: "new_repo" } }) do
= nav_link(path: ['root#index', 'projects#trending', 'projects#starred', 'dashboard/projects#index'], html_options: { id: 'nav-projects-dropdown', class: "home dropdown header-projects", data: { track_label: "projects_dropdown", track_event: "click_dropdown" } }) do
%button{ type: 'button', data: { toggle: "dropdown" } }
= _('Projects')
= sprite_icon('chevron-down', css_class: 'caret-down')
......
......@@ -15,21 +15,12 @@
= nav_link(path: 'projects#trending') do
= link_to explore_root_path, data: { track_label: "projects_dropdown_explore_projects", track_event: "click_link" } do
= _('Explore projects')
- experiment(:new_repo, user: current_user) do |e|
- e.use do
= nav_link(path: 'projects/new#blank_project', html_options: { class: 'gl-border-0 gl-border-t-1 gl-border-solid gl-border-gray-100' }) do
= link_to new_project_path(anchor: 'blank_project'), data: { track_label: "projects_dropdown_blank_project", track_event: "click_link", track_experiment: "new_repo", qa_selector: "create_project_link" } do
= _('Create blank project')
= nav_link(path: 'projects/new#import_project') do
= link_to new_project_path(anchor: 'import_project'), data: { track_label: "projects_dropdown_import_project", track_event: "click_link", track_experiment: "new_repo", qa_selector: "import_project_link" } do
= _('Import project')
- e.try do
= nav_link(path: 'projects/new#blank_project', html_options: { class: 'gl-border-0 gl-border-t-1 gl-border-solid gl-border-gray-100' }) do
= link_to new_project_path(anchor: 'blank_project'), data: { track_label: "projects_dropdown_blank_project", track_event: "click_link", track_experiment: "new_repo" } do
= _('Create blank project/repository')
= nav_link(path: 'projects/new#import_project') do
= link_to new_project_path(anchor: 'import_project'), data: { track_label: "projects_dropdown_import_project", track_event: "click_link", track_experiment: "new_repo" } do
= _('Import project/repository')
= nav_link(path: 'projects/new#blank_project', html_options: { class: 'gl-border-0 gl-border-t-1 gl-border-solid gl-border-gray-100' }) do
= link_to new_project_path(anchor: 'blank_project'), data: { track_label: "projects_dropdown_blank_project", track_event: "click_link", qa_selector: "create_project_link" } do
= _('Create blank project')
= nav_link(path: 'projects/new#import_project') do
= link_to new_project_path(anchor: 'import_project'), data: { track_label: "projects_dropdown_import_project", track_event: "click_link", qa_selector: "import_project_link" } do
= _('Import project')
= nav_link(path: 'projects/new#create_from_template') do
= link_to new_project_path(anchor: 'create_from_template'), data: { track_label: "projects_dropdown_create_from_template", track_event: "click_link" } do
= _('Create from template')
......
---
name: new_repo
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/55818
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/285153
milestone: '13.11'
type: experiment
group: group::adoption
default_enabled: false
......@@ -5,12 +5,22 @@ require 'spec_helper'
RSpec.describe 'layouts/header/_new_dropdown' do
let_it_be(:user) { create(:user) }
before do
allow(view).to receive(:current_user).and_return(user)
end
context 'general menu links' do
it "renders a 'New project/repository' link" do
render
expect(rendered).to have_link('New project/repository', href: new_project_path)
end
end
context 'group-specific links' do
let_it_be(:group) { create(:group) }
before do
allow(view).to receive(:current_user).and_return(user)
assign(:group, group)
end
......
......@@ -9090,9 +9090,6 @@ msgstr ""
msgid "Create blank project"
msgstr ""
msgid "Create blank project/repository"
msgstr ""
msgid "Create branch"
msgstr ""
......@@ -16533,9 +16530,6 @@ msgstr ""
msgid "Import project members"
msgstr ""
msgid "Import project/repository"
msgstr ""
msgid "Import projects from Bitbucket"
msgstr ""
......@@ -25973,9 +25967,6 @@ msgstr ""
msgid "ProjectsNew|Create blank project"
msgstr ""
msgid "ProjectsNew|Create blank project/repository"
msgstr ""
msgid "ProjectsNew|Create from template"
msgstr ""
......@@ -25991,9 +25982,6 @@ msgstr ""
msgid "ProjectsNew|Import project"
msgstr ""
msgid "ProjectsNew|Import project/repository"
msgstr ""
msgid "ProjectsNew|Initialize repository with a README"
msgstr ""
......
......@@ -464,12 +464,6 @@ RSpec.describe ProjectsController do
post :create, params: { project: project_params }
end
it 'tracks a created event for the new_repo experiment', :experiment do
expect(experiment(:new_repo, :candidate)).to track(:project_created).on_next_instance
post :create, params: { project: project_params }
end
end
describe 'POST #archive' do
......
......@@ -447,35 +447,6 @@ RSpec.describe 'Group' do
end
end
describe 'new_repo experiment' do
let_it_be(:group) { create_default(:group) }
it 'when in candidate renders "project/repository"' do
stub_experiments(new_repo: :candidate)
visit group_path(group)
find('li.header-new.dropdown').click
page.within('li.header-new.dropdown') do
expect(page).to have_selector('a', text: 'New project/repository')
end
end
it 'when in control renders "project/repository"' do
stub_experiments(new_repo: :control)
visit group_path(group)
find('li.header-new.dropdown').click
page.within('li.header-new.dropdown') do
expect(page).to have_selector('a', text: 'New project')
expect(page).to have_no_selector('a', text: 'New project/repository')
end
end
end
def remove_with_confirm(button_text, confirm_with)
click_button button_text
fill_in 'confirm_name_input', with: confirm_with
......
......@@ -14,75 +14,6 @@ RSpec.describe 'New project', :js do
sign_in(user)
end
context 'new repo experiment', :experiment do
it 'when in control renders "project"' do
stub_experiments(new_repo: :control)
visit new_project_path
find('li.header-new.dropdown').click
page.within('li.header-new.dropdown') do
expect(page).to have_selector('a', text: 'New project')
expect(page).to have_no_selector('a', text: 'New project/repository')
end
expect(page).to have_selector('h3', text: 'Create blank project')
expect(page).to have_no_selector('h3', text: 'Create blank project/repository')
end
it 'when in candidate renders "project/repository"' do
stub_experiments(new_repo: :candidate)
visit new_project_path
find('li.header-new.dropdown').click
page.within('li.header-new.dropdown') do
expect(page).to have_selector('a', text: 'New project/repository')
end
expect(page).to have_selector('h3', text: 'Create blank project/repository')
end
it 'when in control it renders "project" in the new projects dropdown' do
stub_experiments(new_repo: :control)
visit new_project_path
open_top_nav_projects
within_top_nav do
if Feature.enabled?(:combined_menu, default_enabled: :yaml)
expect(page).to have_selector('a', text: 'Create new project')
expect(page).to have_no_selector('a', text: 'Create blank project/repository')
else
expect(page).to have_selector('a', text: 'Create blank project')
expect(page).to have_selector('a', text: 'Import project')
expect(page).to have_no_selector('a', text: 'Create blank project/repository')
expect(page).to have_no_selector('a', text: 'Import project/repository')
end
end
end
it 'when in candidate it renders "project/repository" in the new projects dropdown' do
stub_experiments(new_repo: :candidate)
visit new_project_path
open_top_nav_projects
within_top_nav do
if Feature.enabled?(:combined_menu, default_enabled: :yaml)
expect(page).to have_selector('a', text: 'Create new project')
else
expect(page).to have_selector('a', text: 'Create blank project/repository')
expect(page).to have_selector('a', text: 'Import project/repository')
end
end
end
end
it 'shows a message if multiple levels are restricted' do
Gitlab::CurrentSettings.update!(
restricted_visibility_levels: [Gitlab::VisibilityLevel::PRIVATE, Gitlab::VisibilityLevel::INTERNAL]
......
import { shallowMount } from '@vue/test-utils';
import { assignGitlabExperiment } from 'helpers/experimentation_helper';
import App from '~/pages/projects/new/components/app.vue';
import NewNamespacePage from '~/vue_shared/new_namespace/new_namespace_page.vue';
describe('Experimental new project creation app', () => {
let wrapper;
const findNewNamespacePage = () => wrapper.findComponent(NewNamespacePage);
const createComponent = (propsData) => {
wrapper = shallowMount(App, { propsData });
};
......@@ -16,36 +13,6 @@ describe('Experimental new project creation app', () => {
wrapper.destroy();
});
describe('new_repo experiment', () => {
it('passes new_repo experiment', () => {
createComponent();
expect(findNewNamespacePage().props().experiment).toBe('new_repo');
});
describe('when in the candidate variant', () => {
assignGitlabExperiment('new_repo', 'candidate');
it('has "repository" in the panel title', () => {
createComponent();
expect(findNewNamespacePage().props().panels[0].title).toBe(
'Create blank project/repository',
);
});
});
describe('when in the control variant', () => {
assignGitlabExperiment('new_repo', 'control');
it('has "project" in the panel title', () => {
createComponent();
expect(findNewNamespacePage().props().panels[0].title).toBe('Create blank project');
});
});
});
it('passes custom new project guideline text to underlying component', () => {
const DEMO_GUIDELINES = 'Demo guidelines';
const guidelineSelector = '#new-project-guideline';
......
import { shallowMount } from '@vue/test-utils';
import { nextTick } from 'vue';
import { mockTracking } from 'helpers/tracking_helper';
import { TRACKING_CONTEXT_SCHEMA } from '~/experimentation/constants';
import { getExperimentData } from '~/experimentation/utils';
import WelcomePage from '~/vue_shared/new_namespace/components/welcome.vue';
jest.mock('~/experimentation/utils', () => ({ getExperimentData: jest.fn() }));
describe('Welcome page', () => {
let wrapper;
let trackingSpy;
......@@ -28,7 +24,6 @@ describe('Welcome page', () => {
beforeEach(() => {
trackingSpy = mockTracking('_category_', document, jest.spyOn);
trackingSpy.mockImplementation(() => {});
getExperimentData.mockReturnValue(undefined);
});
afterEach(() => {
......@@ -38,7 +33,7 @@ describe('Welcome page', () => {
});
it('tracks link clicks', async () => {
createComponent({ propsData: { experiment: 'foo', panels: [{ name: 'test', href: '#' }] } });
createComponent({ propsData: { panels: [{ name: 'test', href: '#' }] } });
const link = wrapper.find('a');
link.trigger('click');
await nextTick();
......@@ -47,25 +42,6 @@ describe('Welcome page', () => {
});
});
it('adds experiment data if in experiment', async () => {
const mockExperimentData = 'data';
getExperimentData.mockReturnValue(mockExperimentData);
createComponent({ propsData: { experiment: 'foo', panels: [{ name: 'test', href: '#' }] } });
const link = wrapper.find('a');
link.trigger('click');
await nextTick();
return wrapper.vm.$nextTick().then(() => {
expect(trackingSpy).toHaveBeenCalledWith(undefined, 'click_tab', {
label: 'test',
context: {
data: mockExperimentData,
schema: TRACKING_CONTEXT_SCHEMA,
},
});
});
});
it('renders footer slot if provided', () => {
const DUMMY = 'Test message';
createComponent({
......
......@@ -37,13 +37,6 @@ describe('Experimental new project creation app', () => {
window.location.hash = '';
});
it('passes experiment to welcome component if provided', () => {
const EXPERIMENT = 'foo';
createComponent({ propsData: { experiment: EXPERIMENT } });
expect(findWelcomePage().props().experiment).toBe(EXPERIMENT);
});
describe('with empty hash', () => {
beforeEach(() => {
createComponent();
......
......@@ -13,7 +13,6 @@ RSpec.describe Nav::NewDropdownHelper do
let(:with_can_create_project) { false }
let(:with_can_create_group) { false }
let(:with_can_create_snippet) { false }
let(:with_new_repo_experiment) { :control }
let(:with_invite_members_experiment) { false }
let(:with_invite_members_experiment_enabled) { false }
......@@ -29,7 +28,6 @@ RSpec.describe Nav::NewDropdownHelper do
end
before do
stub_experiments(new_repo: with_new_repo_experiment)
allow(::Gitlab::Experimentation).to receive(:active?).with(:invite_members_new_dropdown) { with_invite_members_experiment }
allow(helper).to receive(:experiment_enabled?).with(:invite_members_new_dropdown) { with_invite_members_experiment_enabled }
allow(helper).to receive(:tracking_label) { 'test_tracking_label' }
......@@ -43,19 +41,6 @@ RSpec.describe Nav::NewDropdownHelper do
allow(user).to receive(:can?).with(:create_snippet) { with_can_create_snippet }
end
shared_examples 'new repo experiment shared example' do |title|
let(:with_new_repo_experiment) { :candidate }
it 'has experiment project title' do
expect(subject[:menu_sections]).to match(
expected_menu_section(
title: title,
menu_item: a_hash_including(title: 'New project/repository')
)
)
end
end
shared_examples 'invite member link shared example' do
it 'shows invite member link' do
expect(subject[:menu_sections]).to eq(
......@@ -117,15 +102,13 @@ RSpec.describe Nav::NewDropdownHelper do
title: 'GitLab',
menu_item: ::Gitlab::Nav::TopNavMenuItem.build(
id: 'general_new_project',
title: 'New project',
title: 'New project/repository',
href: '/projects/new',
data: { track_experiment: 'new_repo', track_event: 'click_link_new_project', track_label: 'plus_menu_dropdown', qa_selector: 'global_new_project_link' }
data: { track_event: 'click_link_new_project', track_label: 'plus_menu_dropdown', qa_selector: 'global_new_project_link' }
)
)
)
end
it_behaves_like 'new repo experiment shared example', 'GitLab'
end
context 'when can create group' do
......@@ -193,15 +176,13 @@ RSpec.describe Nav::NewDropdownHelper do
title: 'This group',
menu_item: ::Gitlab::Nav::TopNavMenuItem.build(
id: 'new_project',
title: 'New project',
title: 'New project/repository',
href: "/projects/new?namespace_id=#{group.id}",
data: { track_experiment: 'new_repo', track_event: 'click_link_new_project_group', track_label: 'plus_menu_dropdown' }
data: { track_event: 'click_link_new_project_group', track_label: 'plus_menu_dropdown' }
)
)
)
end
it_behaves_like 'new repo experiment shared example', 'This group'
end
context 'when can create subgroup' do
......
......@@ -143,7 +143,6 @@ RSpec.describe Nav::TopNavHelper do
css_class: 'qa-projects-dropdown',
data: {
track_event: 'click_dropdown',
track_experiment: 'new_repo',
track_label: 'projects_dropdown'
},
icon: 'project',
......
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