Commit 4d3a5984 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'jswain_repo_project_tracking' into 'master'

Add more detailed tracking for the new_dropdown

See merge request gitlab-org/gitlab!60553
parents 2afc3748 3cd154d9
- new_repo_experiment_text = content_for(:new_repo_experiment)
%li.header-new.dropdown{ data: { track_label: "new_dropdown", track_event: "click_dropdown", track_experiment: "new_repo" } }
= link_to new_project_path, class: "header-new-dropdown-toggle has-tooltip qa-new-menu-toggle", id: "js-onboarding-new-project-link", title: _("New..."), ref: 'tooltip', aria: { label: _("New...") }, data: { toggle: 'dropdown', placement: 'bottom', container: 'body', display: 'static' } do
= sprite_icon('plus-square')
......@@ -12,9 +13,9 @@
%li.dropdown-bold-header
= _('This group')
- if create_group_project
%li= link_to _('New project'), new_project_path(namespace_id: @group.id)
%li= link_to new_repo_experiment_text, new_project_path(namespace_id: @group.id), data: { track_experiment: 'new_repo', track_event: 'click_link_new_project_group', track_label: 'plus_menu_dropdown' }
- if create_group_subgroup
%li= link_to _('New subgroup'), new_group_path(parent_id: @group.id)
%li= link_to _('New subgroup'), new_group_path(parent_id: @group.id), data: { track_event: 'click_link_new_subgroup', track_label: 'plus_menu_dropdown' }
= render_if_exists 'layouts/header/create_epic_new_dropdown_item'
= render 'layouts/header/group_invite_members_new_dropdown_item'
%li.divider
......@@ -29,16 +30,18 @@
%li.dropdown-bold-header
= _('This project')
- if create_project_issue
%li= link_to _('New issue'), new_project_issue_path(@project)
%li= link_to _('New issue'), new_project_issue_path(@project), data: { track_event: 'click_link_new_issue', track_label: 'plus_menu_dropdown' }
- if merge_project
%li= link_to _('New merge request'), project_new_merge_request_path(merge_project)
%li= link_to _('New merge request'), project_new_merge_request_path(merge_project), data: { track_event: 'click_link_new_mr', track_label: 'plus_menu_dropdown' }
- if create_project_snippet
%li= link_to _('New snippet'), new_project_snippet_path(@project)
%li= link_to _('New snippet'), new_project_snippet_path(@project), data: { track_event: 'click_link_new_snippet_project', track_label: 'plus_menu_dropdown' }
= render 'layouts/header/project_invite_members_new_dropdown_item'
%li.divider
%li.dropdown-bold-header GitLab
= content_for :new_repo_experiment
- if current_user.can_create_project?
%li= link_to new_repo_experiment_text, new_project_path, class: 'qa-global-new-project-link', data: { track_experiment: 'new_repo', track_event: 'click_link_new_project', track_label: 'plus_menu_dropdown' }
- if current_user.can_create_group?
%li= link_to _('New group'), new_group_path
%li= link_to _('New group'), new_group_path, data: { track_event: 'click_link_new_group', track_label: 'plus_menu_dropdown' }
- if current_user.can?(:create_snippet)
%li= link_to _('New snippet'), new_snippet_path, class: 'qa-global-new-snippet-link'
%li= link_to _('New snippet'), new_snippet_path, data: { track_event: 'click_link_new_snippet_parent', track_label: 'plus_menu_dropdown' }, class: 'qa-global-new-snippet-link'
- content_for :new_repo_experiment do
- if current_user&.can_create_project?
- experiment(:new_repo, user: current_user) do |e|
- e.use do
%li= link_to _('New project'), new_project_path, class: 'qa-global-new-project-link', data: { track_experiment: 'new_repo', track_event: 'click_link', track_label: 'plus_menu_dropdown' }
- e.try do
%li= link_to _('New project/repository'), new_project_path, class: 'qa-global-new-project-link', data: { track_experiment: 'new_repo', track_event: 'click_link', track_label: 'plus_menu_dropdown' }
- experiment(:new_repo, user: current_user) do |e|
- e.use do
= _('New project')
- e.try do
= _('New project/repository')
- return unless can?(current_user, :create_epic, @group)
%li= link_to _('New epic'), new_group_epic_path(@group)
%li= link_to _('New epic'), new_group_epic_path(@group), data: { track_event: 'click_link_new_epic', track_label: 'plus_menu_dropdown' }
......@@ -439,6 +439,35 @@ 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
......
......@@ -52,6 +52,7 @@ RSpec.describe 'layouts/header/_new_dropdown' do
end
it 'has a "New project" link' do
render('layouts/header/new_repo_experiment')
render
expect(rendered).to have_link('New project', href: new_project_path(namespace_id: group.id))
......
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