Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
0b144001
Commit
0b144001
authored
Aug 12, 2021
by
Alex Kalderimis
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '328511-fj-add-analytics-menu' into 'master'
Add Analytics menu See merge request gitlab-org/gitlab!66904
parents
57917640
0f31a593
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
648 additions
and
254 deletions
+648
-254
app/helpers/analytics/navbar_helper.rb
app/helpers/analytics/navbar_helper.rb
+0
-28
app/views/layouts/nav/sidebar/_analytics_links.html.haml
app/views/layouts/nav/sidebar/_analytics_links.html.haml
+0
-22
app/views/layouts/nav/sidebar/_group_menus.html.haml
app/views/layouts/nav/sidebar/_group_menus.html.haml
+0
-2
ee/app/helpers/ee/analytics/navbar_helper.rb
ee/app/helpers/ee/analytics/navbar_helper.rb
+0
-122
ee/app/views/layouts/nav/_group_insights_link.html.haml
ee/app/views/layouts/nav/_group_insights_link.html.haml
+0
-5
ee/lib/ee/sidebars/groups/panel.rb
ee/lib/ee/sidebars/groups/panel.rb
+1
-0
ee/lib/sidebars/groups/menus/analytics_menu.rb
ee/lib/sidebars/groups/menus/analytics_menu.rb
+201
-0
ee/spec/features/groups/navbar_spec.rb
ee/spec/features/groups/navbar_spec.rb
+1
-1
ee/spec/lib/sidebars/groups/menus/analytics_menu_spec.rb
ee/spec/lib/sidebars/groups/menus/analytics_menu_spec.rb
+231
-0
ee/spec/views/layouts/nav/sidebar/_group.html.haml_spec.rb
ee/spec/views/layouts/nav/sidebar/_group.html.haml_spec.rb
+194
-54
qa/qa/ee/page/group/menu.rb
qa/qa/ee/page/group/menu.rb
+20
-7
qa/qa/page/group/menu.rb
qa/qa/page/group/menu.rb
+0
-13
No files found.
app/helpers/analytics/navbar_helper.rb
deleted
100644 → 0
View file @
57917640
# frozen_string_literal: true
module
Analytics
module
NavbarHelper
class
NavbarSubItem
attr_reader
:title
,
:path
,
:link
,
:link_to_options
def
initialize
(
title
:,
path
:,
link
:,
link_to_options:
{})
@title
=
title
@path
=
path
@link
=
link
@link_to_options
=
link_to_options
.
merge
(
title:
title
)
end
end
def
group_analytics_navbar_links
(
group
,
current_user
)
[]
end
private
def
navbar_sub_item
(
args
)
NavbarSubItem
.
new
(
**
args
)
end
end
end
Analytics
::
NavbarHelper
.
prepend_mod_with
(
'Analytics::NavbarHelper'
)
app/views/layouts/nav/sidebar/_analytics_links.html.haml
deleted
100644 → 0
View file @
57917640
-
navbar_links
=
links
.
sort_by
(
&
:title
)
-
all_paths
=
navbar_links
.
map
(
&
:path
)
-
analytics_link
=
navbar_links
.
find
{
|
link
|
link
.
title
==
_
(
'Value stream'
)
}
||
navbar_links
.
first
-
if
navbar_links
.
any?
=
nav_link
(
path:
all_paths
)
do
=
link_to
analytics_link
.
link
,
{
class:
'shortcuts-analytics has-sub-items'
,
data:
{
qa_selector:
'analytics_anchor'
}
}
do
.nav-icon-container
=
sprite_icon
(
'chart'
)
%span
.nav-item-name
{
data:
{
qa_selector:
'analytics_link'
}
}
=
_
(
'Analytics'
)
%ul
.sidebar-sub-level-items
{
data:
{
qa_selector:
'analytics_sidebar_submenu'
}
}
=
nav_link
(
path:
analytics_link
.
path
,
html_options:
{
class:
"fly-out-top-item"
}
)
do
=
link_to
analytics_link
.
link
do
%strong
.fly-out-top-item-name
=
_
(
'Analytics'
)
%li
.divider.fly-out-top-item
-
navbar_links
.
each
do
|
menu_item
|
=
nav_link
(
path:
menu_item
.
path
)
do
=
link_to
(
menu_item
.
link
,
menu_item
.
link_to_options
)
do
%span
=
menu_item
.
title
app/views/layouts/nav/sidebar/_group_menus.html.haml
View file @
0b144001
=
render
'layouts/nav/sidebar/analytics_links'
,
links:
group_analytics_navbar_links
(
@group
,
current_user
)
-
if
group_sidebar_link?
(
:wiki
)
=
render
'layouts/nav/sidebar/wiki_link'
,
wiki_url:
@group
.
wiki
.
web_url
...
...
ee/app/helpers/ee/analytics/navbar_helper.rb
deleted
100644 → 0
View file @
57917640
# frozen_string_literal: true
module
EE
module
Analytics
module
NavbarHelper
extend
::
Gitlab
::
Utils
::
Override
override
:group_analytics_navbar_links
def
group_analytics_navbar_links
(
group
,
current_user
)
super
+
[
group_ci_cd_analytics_navbar_link
(
group
,
current_user
),
group_devops_adoption_navbar_link
(
group
,
current_user
),
group_repository_analytics_navbar_link
(
group
,
current_user
),
contribution_analytics_navbar_link
(
group
,
current_user
),
group_insights_navbar_link
(
group
,
current_user
),
issues_analytics_navbar_link
(
group
,
current_user
),
productivity_analytics_navbar_link
(
group
,
current_user
),
group_cycle_analytics_navbar_link
(
group
,
current_user
),
group_merge_request_analytics_navbar_link
(
group
,
current_user
)
].
compact
end
private
# Currently an empty page, so don't show it on the navbar for now
def
group_merge_request_analytics_navbar_link
(
group
,
current_user
)
return
return
unless
group_sidebar_link?
(
:merge_request_analytics
)
# rubocop: disable Lint/UnreachableCode
navbar_sub_item
(
title:
_
(
'Merge request'
),
path:
'groups/analytics/merge_request_analytics#show'
,
link:
group_analytics_merge_request_analytics_path
(
group
)
)
end
def
group_cycle_analytics_navbar_link
(
group
,
current_user
)
return
unless
group_sidebar_link?
(
:cycle_analytics
)
navbar_sub_item
(
title:
_
(
'Value stream'
),
path:
'groups/analytics/cycle_analytics#show'
,
link:
group_analytics_cycle_analytics_path
(
group
)
)
end
def
group_devops_adoption_navbar_link
(
group
,
current_user
)
return
unless
group_sidebar_link?
(
:group_devops_adoption
)
navbar_sub_item
(
title:
_
(
'DevOps adoption'
),
path:
'groups/analytics/devops_adoption#show'
,
link:
group_analytics_devops_adoption_path
(
group
)
)
end
def
productivity_analytics_navbar_link
(
group
,
current_user
)
return
unless
group_sidebar_link?
(
:productivity_analytics
)
navbar_sub_item
(
title:
_
(
'Productivity'
),
path:
'groups/analytics/productivity_analytics#show'
,
link:
group_analytics_productivity_analytics_path
(
group
)
)
end
def
contribution_analytics_navbar_link
(
group
,
current_user
)
return
unless
group_sidebar_link?
(
:contribution_analytics
)
navbar_sub_item
(
title:
_
(
'Contribution'
),
path:
'groups/contribution_analytics#show'
,
link:
group_contribution_analytics_path
(
group
),
link_to_options:
{
data:
{
placement:
'right'
,
qa_selector:
'contribution_analytics_link'
}
}
)
end
def
group_insights_navbar_link
(
group
,
current_user
)
return
unless
group_sidebar_link?
(
:group_insights
)
navbar_sub_item
(
title:
_
(
'Insights'
),
path:
'groups/insights#show'
,
link:
group_insights_path
(
group
),
link_to_options:
{
class:
'shortcuts-group-insights'
,
data:
{
qa_selector:
'group_insights_link'
}
}
)
end
def
issues_analytics_navbar_link
(
group
,
current_user
)
return
unless
group_sidebar_link?
(
:analytics
)
navbar_sub_item
(
title:
_
(
'Issue'
),
path:
'issues_analytics#show'
,
link:
group_issues_analytics_path
(
group
)
)
end
def
group_ci_cd_analytics_navbar_link
(
group
,
current_user
)
return
unless
group
.
licensed_feature_available?
(
:group_ci_cd_analytics
)
return
unless
group_sidebar_link?
(
:group_ci_cd_analytics
)
navbar_sub_item
(
title:
_
(
'CI/CD'
),
path:
'groups/analytics/ci_cd_analytics#show'
,
link:
group_analytics_ci_cd_analytics_path
(
group
)
)
end
def
group_repository_analytics_navbar_link
(
group
,
current_user
)
return
unless
group
.
licensed_feature_available?
(
:group_coverage_reports
)
return
unless
group_sidebar_link?
(
:repository_analytics
)
navbar_sub_item
(
title:
_
(
'Repositories'
),
path:
'groups/analytics/repository_analytics#show'
,
link:
group_analytics_repository_analytics_path
(
group
)
)
end
end
end
end
ee/app/views/layouts/nav/_group_insights_link.html.haml
deleted
100644 → 0
View file @
57917640
-
return
unless
group_sidebar_link?
(
:group_insights
)
=
nav_link
(
path:
'groups/insights#show'
)
do
=
link_to
group_insights_path
(
@group
),
title:
_
(
'Insights'
),
class:
'shortcuts-group-insights'
,
data:
{
qa_selector:
'group_insights_link'
}
do
%span
=
_
(
'Insights'
)
ee/lib/ee/sidebars/groups/panel.rb
View file @
0b144001
...
...
@@ -14,6 +14,7 @@ module EE
insert_menu_after
(
::
Sidebars
::
Groups
::
Menus
::
GroupInformationMenu
,
::
Sidebars
::
Groups
::
Menus
::
EpicsMenu
.
new
(
context
))
insert_menu_after
(
::
Sidebars
::
Groups
::
Menus
::
MergeRequestsMenu
,
::
Sidebars
::
Groups
::
Menus
::
SecurityComplianceMenu
.
new
(
context
))
insert_menu_after
(
::
Sidebars
::
Groups
::
Menus
::
SecurityComplianceMenu
,
::
Sidebars
::
Groups
::
Menus
::
PushRulesMenu
.
new
(
context
))
insert_menu_after
(
::
Sidebars
::
Groups
::
Menus
::
PackagesRegistriesMenu
,
::
Sidebars
::
Groups
::
Menus
::
AnalyticsMenu
.
new
(
context
))
end
end
end
...
...
ee/lib/sidebars/groups/menus/analytics_menu.rb
0 → 100644
View file @
0b144001
# frozen_string_literal: true
module
Sidebars
module
Groups
module
Menus
class
AnalyticsMenu
<
::
Sidebars
::
Menu
include
Gitlab
::
Utils
::
StrongMemoize
override
:configure_menu_items
def
configure_menu_items
add_item
(
ci_cd_analytics_menu_item
)
add_item
(
contribution_analytics_menu_item
)
add_item
(
devops_adoption_menu_item
)
add_item
(
insights_analytics_menu_item
)
add_item
(
issues_analytics_menu_item
)
add_item
(
merge_request_analytics_menu_item
)
add_item
(
productivity_analytics_menu_item
)
add_item
(
repository_analytics_menu_item
)
add_item
(
cycle_analytics_menu_item
)
true
end
override
:link
def
link
return
cycle_analytics_menu_item
.
link
if
cycle_analytics_menu_item
.
render?
renderable_items
.
first
.
link
end
override
:extra_container_html_options
def
extra_container_html_options
{
class:
'shortcuts-analytics'
}
end
override
:title
def
title
_
(
'Analytics'
)
end
override
:sprite_icon
def
sprite_icon
'chart'
end
private
def
ci_cd_analytics_menu_item
unless
show_ci_cd_analytics?
return
::
Sidebars
::
NilMenuItem
.
new
(
item_id: :ci_cd_analytics
)
end
::
Sidebars
::
MenuItem
.
new
(
title:
_
(
'CI/CD'
),
link:
group_analytics_ci_cd_analytics_path
(
context
.
group
),
active_routes:
{
path:
'groups/analytics/ci_cd_analytics#show'
},
item_id: :ci_cd_analytics
)
end
def
show_ci_cd_analytics?
context
.
group
.
licensed_feature_available?
(
:group_ci_cd_analytics
)
&&
::
Feature
.
enabled?
(
:group_ci_cd_analytics_page
,
context
.
group
,
default_enabled:
true
)
&&
can?
(
context
.
current_user
,
:view_group_ci_cd_analytics
,
context
.
group
)
end
def
contribution_analytics_menu_item
unless
show_contribution_analytics?
return
::
Sidebars
::
NilMenuItem
.
new
(
item_id: :contribution_analytics
)
end
::
Sidebars
::
MenuItem
.
new
(
title:
_
(
'Contribution'
),
link:
group_contribution_analytics_path
(
context
.
group
),
active_routes:
{
path:
'groups/contribution_analytics#show'
},
container_html_options:
{
data:
{
placement:
'right'
}
},
item_id: :contribution_analytics
)
end
def
show_contribution_analytics?
can?
(
context
.
current_user
,
:read_group_contribution_analytics
,
context
.
group
)
||
LicenseHelper
.
show_promotions?
(
context
.
current_user
)
end
def
devops_adoption_menu_item
unless
can?
(
context
.
current_user
,
:view_group_devops_adoption
,
context
.
group
)
return
::
Sidebars
::
NilMenuItem
.
new
(
item_id: :devops_adoption
)
end
::
Sidebars
::
MenuItem
.
new
(
title:
_
(
'DevOps adoption'
),
link:
group_analytics_devops_adoption_path
(
context
.
group
),
active_routes:
{
path:
'groups/analytics/devops_adoption#show'
},
item_id: :devops_adoption
)
end
def
insights_analytics_menu_item
unless
context
.
group
.
insights_available?
return
::
Sidebars
::
NilMenuItem
.
new
(
item_id: :insights
)
end
::
Sidebars
::
MenuItem
.
new
(
title:
_
(
'Insights'
),
link:
group_insights_path
(
context
.
group
),
active_routes:
{
path:
'groups/insights#show'
},
container_html_options:
{
class:
'shortcuts-group-insights'
},
item_id: :insights
)
end
def
issues_analytics_menu_item
unless
context
.
group
.
licensed_feature_available?
(
:issues_analytics
)
return
::
Sidebars
::
NilMenuItem
.
new
(
item_id: :issues_analytics
)
end
::
Sidebars
::
MenuItem
.
new
(
title:
_
(
'Issue'
),
link:
group_issues_analytics_path
(
context
.
group
),
active_routes:
{
path:
'issues_analytics#show'
},
item_id: :issues_analytics
)
end
def
merge_request_analytics_menu_item
unless
show_merge_requests_analytics?
return
::
Sidebars
::
NilMenuItem
.
new
(
item_id: :merge_requests_analytics
)
end
::
Sidebars
::
MenuItem
.
new
(
title:
_
(
'Merge request'
),
link:
group_analytics_merge_request_analytics_path
(
context
.
group
),
active_routes:
{
path:
'groups/analytics/merge_request_analytics#show'
},
item_id: :merge_requests_analytics
)
end
# Currently an empty page, so don't show it on the navbar for now
def
show_merge_requests_analytics?
return
false
can?
(
context
.
current_user
,
:read_group_merge_request_analytics
,
context
.
group
)
# rubocop:disable Lint/UnreachableCode
end
def
productivity_analytics_menu_item
unless
show_productivity_analytics?
return
::
Sidebars
::
NilMenuItem
.
new
(
item_id: :productivity_analytics
)
end
::
Sidebars
::
MenuItem
.
new
(
title:
_
(
'Productivity'
),
link:
group_analytics_productivity_analytics_path
(
context
.
group
),
active_routes:
{
path:
'groups/analytics/productivity_analytics#show'
},
item_id: :productivity_analytics
)
end
def
show_productivity_analytics?
context
.
group
.
licensed_feature_available?
(
:productivity_analytics
)
&&
can?
(
context
.
current_user
,
:view_productivity_analytics
,
context
.
group
)
end
def
repository_analytics_menu_item
unless
show_repository_analytics?
return
::
Sidebars
::
NilMenuItem
.
new
(
item_id: :repository_analytics
)
end
::
Sidebars
::
MenuItem
.
new
(
title:
_
(
'Repository'
),
link:
group_analytics_repository_analytics_path
(
context
.
group
),
active_routes:
{
path:
'groups/analytics/repository_analytics#show'
},
item_id: :repository_analytics
)
end
def
show_repository_analytics?
context
.
group
.
licensed_feature_available?
(
:group_coverage_reports
)
&&
can?
(
context
.
current_user
,
:read_group_repository_analytics
,
context
.
group
)
end
def
cycle_analytics_menu_item
strong_memoize
(
:cycle_analytics_menu_item
)
do
unless
can?
(
context
.
current_user
,
:read_group_cycle_analytics
,
context
.
group
)
next
::
Sidebars
::
NilMenuItem
.
new
(
item_id: :cycle_analytics
)
end
::
Sidebars
::
MenuItem
.
new
(
title:
_
(
'Value stream'
),
link:
group_analytics_cycle_analytics_path
(
context
.
group
),
active_routes:
{
path:
'groups/analytics/cycle_analytics#show'
},
item_id: :cycle_analytics
)
end
end
end
end
end
end
ee/spec/features/groups/navbar_spec.rb
View file @
0b144001
...
...
@@ -70,7 +70,7 @@ RSpec.describe 'Group navbar' do
it
'redirects to value stream when Analytics item is clicked'
do
page
.
within
(
'.sidebar-top-level-items'
)
do
find
(
'
[data-qa-selector=analytics_anchor]'
).
click
# rubocop:disable QA/SelectorUsage
find
(
'
.shortcuts-analytics'
).
click
end
wait_for_requests
...
...
ee/spec/lib/sidebars/groups/menus/analytics_menu_spec.rb
0 → 100644
View file @
0b144001
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Sidebars
::
Groups
::
Menus
::
AnalyticsMenu
do
let_it_be
(
:owner
)
{
create
(
:user
)
}
let_it_be_with_refind
(
:group
)
do
create
(
:group
,
:private
).
tap
do
|
g
|
g
.
add_owner
(
owner
)
end
end
let
(
:user
)
{
owner
}
let
(
:context
)
{
Sidebars
::
Groups
::
Context
.
new
(
current_user:
user
,
container:
group
)
}
let
(
:menu
)
{
described_class
.
new
(
context
)
}
describe
'#link'
do
before
do
stub_licensed_features
(
cycle_analytics_for_groups:
true
,
group_ci_cd_analytics:
true
)
end
it
'returns link to the value stream page'
do
expect
(
menu
.
link
).
to
include
(
"/groups/
#{
group
.
full_path
}
/-/analytics/value_stream_analytics"
)
end
context
'when Value Stream is not visible'
do
it
'returns link to the the first visible menu item'
do
allow
(
menu
).
to
receive
(
:cycle_analytics_menu_item
).
and_return
(
double
(
render?:
false
))
expect
(
menu
.
link
).
not_to
include
(
"/groups/
#{
group
.
full_path
}
/-/analytics/value_stream_analytics"
)
expect
(
menu
.
link
).
to
eq
menu
.
renderable_items
.
first
.
link
end
end
end
describe
'Menu items'
do
subject
{
described_class
.
new
(
context
).
renderable_items
.
index
{
|
e
|
e
.
item_id
==
item_id
}
}
describe
'CI/CD'
do
let
(
:item_id
)
{
:ci_cd_analytics
}
before
do
stub_licensed_features
(
group_ci_cd_analytics:
true
)
end
specify
{
is_expected
.
not_to
be_nil
}
describe
'when licensed feature :group_ci_cd_analytics is disabled'
do
specify
do
stub_licensed_features
(
group_ci_cd_analytics:
false
)
is_expected
.
to
be_nil
end
end
describe
'when feature flag :group_ci_cd_analytics_page is disabled'
do
specify
do
stub_feature_flags
(
group_ci_cd_analytics_page:
false
)
is_expected
.
to
be_nil
end
end
describe
'when the user does not have access'
do
let
(
:user
)
{
nil
}
specify
{
is_expected
.
to
be_nil
}
end
end
describe
'Devops adoptions'
do
let
(
:item_id
)
{
:devops_adoption
}
before
do
stub_licensed_features
(
group_level_devops_adoption:
true
)
end
specify
{
is_expected
.
not_to
be_nil
}
describe
'when the user does not have access'
do
let
(
:user
)
{
nil
}
specify
{
is_expected
.
to
be_nil
}
end
end
describe
'Repository'
do
let
(
:item_id
)
{
:repository_analytics
}
before
do
stub_licensed_features
(
group_coverage_reports:
true
,
group_repository_analytics:
true
)
end
specify
{
is_expected
.
not_to
be_nil
}
describe
'when licensed feature :group_coverage_reports is disabled'
do
specify
do
stub_licensed_features
(
group_coverage_reports:
false
)
is_expected
.
to
be_nil
end
end
describe
'when licensed feature :group_repository_analytics is disabled'
do
specify
do
stub_licensed_features
(
group_repository_analytics:
false
)
is_expected
.
to
be_nil
end
end
describe
'when the user does not have access'
do
let
(
:user
)
{
nil
}
specify
{
is_expected
.
to
be_nil
}
end
end
describe
'Contribution analytics'
do
let
(
:item_id
)
{
:contribution_analytics
}
before
do
stub_licensed_features
(
contribution_analytics:
true
)
end
specify
{
is_expected
.
not_to
be_nil
}
describe
'when licensed feature :group_coverage_reports is disabled'
do
specify
do
stub_licensed_features
(
contribution_analytics:
false
)
is_expected
.
to
be_nil
end
end
describe
'when the user does not have access'
do
let
(
:user
)
{
nil
}
specify
{
is_expected
.
to
be_nil
}
describe
'when show_promotions? is true'
do
specify
do
allow
(
LicenseHelper
).
to
receive
(
:show_promotions?
).
and_return
(
true
)
is_expected
.
not_to
be_nil
end
end
end
end
describe
'Insights'
do
let
(
:item_id
)
{
:insights
}
let
(
:insights_available
)
{
true
}
before
do
allow
(
group
).
to
receive
(
:insights_available?
).
and_return
(
insights_available
)
end
specify
{
is_expected
.
not_to
be_nil
}
describe
'when insights are not available'
do
let
(
:insights_available
)
{
false
}
specify
{
is_expected
.
to
be_nil
}
end
end
describe
'Issue analytics'
do
let
(
:item_id
)
{
:issues_analytics
}
let
(
:issues_analytics_enabled
)
{
true
}
before
do
stub_licensed_features
(
issues_analytics:
issues_analytics_enabled
)
end
specify
{
is_expected
.
not_to
be_nil
}
describe
'when licensed feature :issues_analytics is disabled'
do
let
(
:issues_analytics_enabled
)
{
false
}
specify
{
is_expected
.
to
be_nil
}
end
end
describe
'Productivity analytics'
do
let
(
:item_id
)
{
:productivity_analytics
}
let
(
:productivity_analytics_enabled
)
{
true
}
before
do
stub_licensed_features
(
productivity_analytics:
productivity_analytics_enabled
)
end
specify
{
is_expected
.
not_to
be_nil
}
describe
'when licensed feature :productivity_analytics is disabled'
do
let
(
:productivity_analytics_enabled
)
{
false
}
specify
{
is_expected
.
to
be_nil
}
end
describe
'when the user does not have access'
do
let
(
:user
)
{
nil
}
specify
{
is_expected
.
to
be_nil
}
end
end
describe
'Value Stream'
do
let
(
:item_id
)
{
:cycle_analytics
}
let
(
:cycle_analytics_enabled
)
{
true
}
before
do
stub_licensed_features
(
cycle_analytics_for_groups:
cycle_analytics_enabled
)
end
specify
{
is_expected
.
not_to
be_nil
}
describe
'when licensed feature :cycle_analytics_for_groups is disabled'
do
let
(
:cycle_analytics_enabled
)
{
false
}
specify
{
is_expected
.
to
be_nil
}
end
describe
'when the user does not have access'
do
let
(
:user
)
{
nil
}
specify
{
is_expected
.
to
be_nil
}
end
end
end
end
ee/spec/views/layouts/nav/sidebar/_group.html.haml_spec.rb
View file @
0b144001
...
...
@@ -323,122 +323,262 @@ RSpec.describe 'layouts/nav/sidebar/_group' do
end
end
describe
'DevOps adoption link'
do
let!
(
:current_user
)
{
create
(
:user
)
}
describe
'Analytics menu'
do
let_it_be
(
:owner
)
{
create
(
:user
)
}
let_it_be
(
:guest
)
{
create
(
:user
)
}
before
do
group
.
add_maintainer
(
current_user
)
let_it_be_with_refind
(
:group
)
do
create
(
:group
).
tap
do
|
g
|
g
.
add_maintainer
(
owner
)
g
.
add_guest
(
guest
)
end
end
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
current_user
)
before
do
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
owner
)
end
context
'DevOps adoption feature is available'
do
describe
'CI/CD analytics'
do
let
(
:ci_cd_analytics_enabled
)
{
true
}
before
do
stub_licensed_features
(
group_
level_devops_adoption:
true
)
stub_licensed_features
(
group_
ci_cd_analytics:
ci_cd_analytics_enabled
)
end
it
'
is visibl
e'
do
it
'
has a link to the CI/CD analytics pag
e'
do
render
expect
(
rendered
).
to
have_
text
'DevOps adoption'
expect
(
rendered
).
to
have_
link
(
'CI/CD'
,
href:
group_analytics_ci_cd_analytics_path
(
group
))
end
end
context
'DevOps adoption feature is not available'
do
before
do
stub_licensed_features
(
group_level_devops_adoption:
false
)
end
describe
'feature is disabled'
do
let
(
:ci_cd_analytics_enabled
)
{
false
}
it
'is not visible'
do
render
specify
do
render
expect
(
rendered
).
not_to
have_text
'DevOps adoption'
expect
(
rendered
).
not_to
have_link
(
'CI/CD'
)
end
end
end
end
describe
'contribution analytics tab'
do
let!
(
:current_user
)
{
create
(
:user
)
}
describe
'DevOps'
do
context
'DevOps adoption feature is available'
do
before
do
stub_licensed_features
(
group_level_devops_adoption:
true
)
end
before
do
group
.
add_guest
(
current_user
)
it
'is visible'
do
render
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
current_user
)
expect
(
rendered
).
to
have_text
'DevOps adoption'
end
end
context
'DevOps adoption feature is not available'
do
before
do
stub_licensed_features
(
group_level_devops_adoption:
false
)
end
it
'is not visible'
do
render
expect
(
rendered
).
not_to
have_text
'DevOps adoption'
end
end
end
context
'contribution analytics feature is available
'
do
describe
'Repository analytics
'
do
before
do
stub_licensed_features
(
contribution
_analytics:
true
)
stub_licensed_features
(
group_coverage_reports:
true
,
group_repository
_analytics:
true
)
end
it
'
is visibl
e'
do
it
'
has a link to the Repository analytics pag
e'
do
render
expect
(
rendered
).
to
have_text
'Contribution'
expect
(
rendered
).
to
have_link
(
'Repository'
,
href:
group_analytics_repository_analytics_path
(
group
))
end
describe
'feature is not available'
do
specify
do
stub_licensed_features
(
group_coverage_reports:
false
)
render
expect
(
rendered
).
not_to
have_link
(
'Repository'
)
end
end
end
context
'contribution analytics feature is not available
'
do
describe
'contribution analytics tab
'
do
before
do
stub_licensed_features
(
contribution_analytics:
false
)
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
guest
)
end
context
'
we do not show promotions
'
do
context
'
contribution analytics feature is available
'
do
before
do
allow
(
LicenseHelper
).
to
receive
(
:show_promotions?
).
and_return
(
fals
e
)
stub_licensed_features
(
contribution_analytics:
tru
e
)
end
it
'is
not
visible'
do
it
'is visible'
do
render
expect
(
rendered
).
not_
to
have_text
'Contribution'
expect
(
rendered
).
to
have_text
'Contribution'
end
end
end
context
'no license installed'
do
before
do
allow
(
License
).
to
receive
(
:current
).
and_return
(
nil
)
stub_application_setting
(
check_namespace_plan:
false
)
context
'contribution analytics feature is not available'
do
before
do
stub_licensed_features
(
contribution_analytics:
false
)
end
context
'we do not show promotions'
do
before
do
allow
(
LicenseHelper
).
to
receive
(
:show_promotions?
).
and_return
(
false
)
end
it
'is not visible'
do
render
expect
(
rendered
).
not_to
have_text
'Contribution'
end
end
end
context
'no license installed'
do
before
do
allow
(
License
).
to
receive
(
:current
).
and_return
(
nil
)
stub_application_setting
(
check_namespace_plan:
false
)
allow
(
view
).
to
receive
(
:can?
)
{
|*
args
|
Ability
.
allowed?
(
*
args
)
}
end
it
'is visible when there is no valid license but we show promotions'
do
stub_licensed_features
(
contribution_analytics:
false
)
render
allow
(
view
).
to
receive
(
:can?
)
{
|*
args
|
Ability
.
allowed?
(
*
args
)
}
expect
(
rendered
).
to
have_text
'Contribution'
end
end
it
'is visible
when there is no valid license but we show promotions
'
do
stub_licensed_features
(
contribution_analytics:
fals
e
)
it
'is visible'
do
stub_licensed_features
(
contribution_analytics:
tru
e
)
render
expect
(
rendered
).
to
have_text
'Contribution'
end
describe
'group issue boards link'
do
context
'when multiple issue board is disabled'
do
it
'shows link text in singular'
do
render
expect
(
rendered
).
to
have_text
'Board'
end
end
context
'when multiple issue board is enabled'
do
before
do
stub_licensed_features
(
multiple_group_issue_boards:
true
)
end
it
'shows link text in plural'
do
render
expect
(
rendered
).
to
have_text
'Boards'
end
end
end
end
it
'is visible'
do
stub_licensed_features
(
contribution_analytics:
true
)
describe
'Insights analytics'
do
it
'has a link to the insights analytics page'
do
allow
(
group
).
to
receive
(
:insights_available?
).
and_return
(
true
)
render
render
expect
(
rendered
).
to
have_text
'Contribution'
expect
(
rendered
).
to
have_link
(
'Insights'
,
href:
group_insights_path
(
group
))
end
describe
'feature is disabled'
do
specify
do
render
expect
(
rendered
).
not_to
have_link
(
'Insights'
)
end
end
end
describe
'group issue boards link'
do
context
'when multiple issue board is disabled'
do
it
'shows link text in singular'
do
describe
'Issue analytics'
do
let
(
:issues_analytics_enabled
)
{
true
}
before
do
stub_licensed_features
(
issues_analytics:
issues_analytics_enabled
)
end
it
'has a link to the Issue analytics page'
do
render
expect
(
rendered
).
to
have_link
(
'Issue'
,
href:
group_issues_analytics_path
(
group
))
end
describe
'feature is disabled'
do
let
(
:issues_analytics_enabled
)
{
false
}
specify
do
render
expect
(
rendered
).
to
have_text
'Board'
expect
(
rendered
).
not_to
have_link
(
exact_text:
'Issue'
)
end
end
end
describe
'Productivity analytics'
do
let
(
:productivity_analytics_enabled
)
{
true
}
before
do
stub_licensed_features
(
productivity_analytics:
productivity_analytics_enabled
)
end
context
'when multiple issue board is enabled'
do
before
do
stub_licensed_features
(
multiple_group_issue_boards:
true
)
it
'has a link to the Productivity analytics page'
do
render
expect
(
rendered
).
to
have_link
(
'Productivity'
,
href:
group_analytics_productivity_analytics_path
(
group
))
end
describe
'feature is disabled'
do
let
(
:productivity_analytics_enabled
)
{
false
}
specify
do
render
expect
(
rendered
).
not_to
have_link
(
'Productivity'
,
href:
group_analytics_productivity_analytics_path
(
group
))
end
end
end
describe
'Cycle analytics'
do
let
(
:cycle_analytics_enabled
)
{
true
}
before
do
stub_licensed_features
(
cycle_analytics_for_groups:
cycle_analytics_enabled
)
end
it
'has a link to the Cycle analytics page'
do
render
expect
(
rendered
).
to
have_link
(
'Value stream'
,
href:
group_analytics_cycle_analytics_path
(
group
))
end
describe
'feature is disabled'
do
let
(
:cycle_analytics_enabled
)
{
false
}
it
'shows link text in plural'
do
specify
do
render
expect
(
rendered
).
to
have_text
'Boards'
expect
(
rendered
).
not_to
have_link
(
'Value stream'
)
end
end
end
...
...
qa/qa/ee/page/group/menu.rb
View file @
0b144001
...
...
@@ -32,10 +32,6 @@ module QA
element
:ldap_synchronization_link
element
:billing_link
end
view
'ee/app/views/layouts/nav/_group_insights_link.html.haml'
do
element
:group_insights_link
end
end
end
...
...
@@ -71,10 +67,18 @@ module QA
end
end
def
click_contribution_analytics_item
hover_group_analytics
do
within_submenu
do
click_element
(
:sidebar_menu_item_link
,
menu_item:
'Contribution'
)
end
end
end
def
click_group_insights_link
hover_
element
(
:analytics_link
)
do
within_submenu
(
:analytics_sidebar_submenu
)
do
click_element
(
:
group_insights_link
)
hover_
group_analytics
do
within_submenu
do
click_element
(
:
sidebar_menu_item_link
,
menu_item:
'Insights'
)
end
end
end
...
...
@@ -141,6 +145,15 @@ module QA
yield
end
end
def
hover_group_analytics
within_sidebar
do
scroll_to_element
(
:sidebar_menu_link
,
menu_item:
'Analytics'
)
find_element
(
:sidebar_menu_link
,
menu_item:
'Analytics'
).
hover
yield
end
end
end
end
end
...
...
qa/qa/page/group/menu.rb
View file @
0b144001
...
...
@@ -15,11 +15,6 @@ module QA
element
:group_package_settings_link
end
view
'app/views/layouts/nav/sidebar/_analytics_links.html.haml'
do
element
:analytics_link
element
:analytics_sidebar_submenu
end
def
click_group_members_item
hover_group_information
do
within_submenu
do
...
...
@@ -42,14 +37,6 @@ module QA
end
end
def
click_contribution_analytics_item
hover_element
(
:analytics_link
)
do
within_submenu
(
:analytics_sidebar_submenu
)
do
click_element
(
:contribution_analytics_link
)
end
end
end
def
click_group_general_settings_item
hover_element
(
:group_settings
)
do
within_submenu
(
:group_sidebar_submenu
)
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment