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
bdf8c41f
Commit
bdf8c41f
authored
Mar 11, 2020
by
Adam Hegyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more navbar structure test cases
parent
1c5abd05
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
415 additions
and
198 deletions
+415
-198
ee/spec/features/groups/navbar_spec.rb
ee/spec/features/groups/navbar_spec.rb
+107
-0
ee/spec/features/projects/navbar_spec.rb
ee/spec/features/projects/navbar_spec.rb
+102
-0
spec/features/groups/navbar_spec.rb
spec/features/groups/navbar_spec.rb
+8
-77
spec/features/projects/navbar_spec.rb
spec/features/projects/navbar_spec.rb
+14
-121
spec/support/helpers/navbar_structure_helper.rb
spec/support/helpers/navbar_structure_helper.rb
+21
-0
spec/support/shared_contexts/navbar_structure_context.rb
spec/support/shared_contexts/navbar_structure_context.rb
+163
-0
No files found.
ee/spec/features/groups/navbar_spec.rb
0 → 100644
View file @
bdf8c41f
# frozen_string_literal: true
require
'spec_helper'
describe
'Group navbar'
do
include
NavbarStructureHelper
include_context
'group navbar structure'
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
before
do
group
.
add_maintainer
(
user
)
sign_in
(
user
)
end
context
'when productivity analytics is available'
do
before
do
stub_licensed_features
(
productivity_analytics:
true
)
insert_after_sub_nav_item
(
_
(
'Contribution'
),
within:
_
(
'Analytics'
),
new_sub_nav_item_name:
_
(
'Productivity'
)
)
visit
group_path
(
group
)
end
it_behaves_like
'verified navigation bar'
end
context
'when value stream analytics is available'
do
before
do
stub_licensed_features
(
cycle_analytics_for_groups:
true
)
insert_after_sub_nav_item
(
_
(
'Contribution'
),
within:
_
(
'Analytics'
),
new_sub_nav_item_name:
_
(
'Value Stream'
)
)
visit
group_path
(
group
)
end
it_behaves_like
'verified navigation bar'
end
context
'when epics are available'
do
before
do
stub_licensed_features
(
epics:
true
)
insert_after_nav_item
(
_
(
'Group overview'
),
new_nav_item:
{
nav_item:
_
(
'Epics'
),
nav_sub_items:
[
_
(
'List'
),
_
(
'Roadmap'
)
]
}
)
visit
group_path
(
group
)
end
it_behaves_like
'verified navigation bar'
end
context
'when the logged in user is the owner'
do
before
do
group
.
add_owner
(
user
)
insert_after_nav_item
(
_
(
'Members'
),
new_nav_item:
settings_nav_item
)
visit
group_path
(
group
)
end
it_behaves_like
'verified navigation bar'
end
context
'when security dashboard is available'
do
before
do
group
.
add_owner
(
user
)
stub_licensed_features
(
security_dashboard:
true
,
group_level_compliance_dashboard:
true
)
insert_after_nav_item
(
_
(
'Merge Requests'
),
new_nav_item:
{
nav_item:
_
(
'Security & Compliance'
),
nav_sub_items:
[
_
(
'Security'
),
_
(
'Compliance'
)
]
}
)
insert_after_nav_item
(
_
(
'Members'
),
new_nav_item:
settings_nav_item
)
visit
group_path
(
group
)
end
it_behaves_like
'verified navigation bar'
end
end
ee/spec/features/projects/navbar_spec.rb
0 → 100644
View file @
bdf8c41f
# frozen_string_literal: true
require
'spec_helper'
describe
'Project navbar'
do
include
NavbarStructureHelper
include_context
'project navbar structure'
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
before
do
project
.
add_maintainer
(
user
)
sign_in
(
user
)
end
context
'when issues analytics is available'
do
before
do
stub_licensed_features
(
issues_analytics:
true
)
insert_after_sub_nav_item
(
_
(
'Code Review'
),
within:
_
(
'Analytics'
),
new_sub_nav_item_name:
_
(
'Issues'
)
)
visit
project_path
(
project
)
end
it_behaves_like
'verified navigation bar'
end
context
'when service desk is available'
do
before
do
stub_licensed_features
(
service_desk:
true
)
insert_after_sub_nav_item
(
_
(
'Labels'
),
within:
_
(
'Issues'
),
new_sub_nav_item_name:
_
(
'Service Desk'
)
)
visit
project_path
(
project
)
end
it_behaves_like
'verified navigation bar'
end
context
'when security dashboard is available'
do
before
do
stub_licensed_features
(
security_dashboard:
true
)
insert_after_nav_item
(
_
(
'CI / CD'
),
new_nav_item:
{
nav_item:
_
(
'Security & Compliance'
),
nav_sub_items:
[
_
(
'Security Dashboard'
),
_
(
'Vulnerability List'
),
_
(
'Configuration'
)
]
}
)
visit
project_path
(
project
)
end
it_behaves_like
'verified navigation bar'
end
context
'when packages are available'
do
before
do
allow
(
Gitlab
.
config
.
packages
).
to
receive
(
:enabled
).
and_return
(
true
)
stub_licensed_features
(
packages:
true
)
insert_after_nav_item
(
_
(
'Operations'
),
new_nav_item:
{
nav_item:
_
(
'Packages'
),
nav_sub_items:
[
_
(
'List'
)
]
}
)
visit
project_path
(
project
)
end
it_behaves_like
'verified navigation bar'
end
context
'when requirements is available'
do
before
do
stub_licensed_features
(
requirements:
true
)
visit
project_path
(
project
)
end
it_behaves_like
'verified navigation bar'
end
end
spec/features/groups/navbar_spec.rb
View file @
bdf8c41f
...
...
@@ -3,90 +3,21 @@
require
'spec_helper'
describe
'Group navbar'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
include
NavbarStructureHelper
let
(
:analytics_nav_item
)
do
{
nav_item:
_
(
'Analytics'
),
nav_sub_items:
[
_
(
'Contribution'
)
]
}
end
include_context
'group navbar structure'
let
(
:structure
)
do
[
{
nav_item:
_
(
'Group overview'
),
nav_sub_items:
[
_
(
'Details'
),
_
(
'Activity'
)
]
},
{
nav_item:
_
(
'Issues'
),
nav_sub_items:
[
_
(
'List'
),
_
(
'Board'
),
_
(
'Labels'
),
_
(
'Milestones'
)
]
},
{
nav_item:
_
(
'Merge Requests'
),
nav_sub_items:
[]
},
{
nav_item:
_
(
'Kubernetes'
),
nav_sub_items:
[]
},
(
analytics_nav_item
if
Gitlab
.
ee?
),
{
nav_item:
_
(
'Members'
),
nav_sub_items:
[]
}
]
end
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
it_behaves_like
'verified navigation bar'
do
before
do
group
.
add_maintainer
(
user
)
sign_in
(
user
)
visit
group_path
(
group
)
end
end
if
Gitlab
.
ee?
context
'when productivity analytics is available'
do
before
do
stub_licensed_features
(
productivity_analytics:
true
)
analytics_nav_item
[
:nav_sub_items
]
<<
_
(
'Productivity'
)
group
.
add_maintainer
(
user
)
sign_in
(
user
)
visit
group_path
(
group
)
end
it_behaves_like
'verified navigation bar'
end
context
'when value stream analytics is available'
do
it_behaves_like
'verified navigation bar'
do
before
do
stub_licensed_features
(
cycle_analytics_for_groups:
true
)
analytics_nav_item
[
:nav_sub_items
]
<<
_
(
'Value Stream'
)
group
.
add_maintainer
(
user
)
sign_in
(
user
)
visit
group_path
(
group
)
end
it_behaves_like
'verified navigation bar'
end
end
end
spec/features/projects/navbar_spec.rb
View file @
bdf8c41f
...
...
@@ -3,112 +3,14 @@
require
'spec_helper'
describe
'Project navbar'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
include
NavbarStructureHelper
let
(
:analytics_nav_item
)
do
{
nav_item:
_
(
'Analytics'
),
nav_sub_items:
[
_
(
'CI / CD'
),
(
_
(
'Code Review'
)
if
Gitlab
.
ee?
),
_
(
'Repository'
),
_
(
'Value Stream'
)
]
}
end
let
(
:requirements_nav_item
)
do
{
nav_item:
_
(
'Requirements'
),
nav_sub_items:
[
_
(
'List'
)]
}
end
include_context
'project navbar structure'
let
(
:structure
)
do
[
{
nav_item:
_
(
'Project overview'
),
nav_sub_items:
[
_
(
'Details'
),
_
(
'Activity'
),
_
(
'Releases'
)
]
},
{
nav_item:
_
(
'Repository'
),
nav_sub_items:
[
_
(
'Files'
),
_
(
'Commits'
),
_
(
'Branches'
),
_
(
'Tags'
),
_
(
'Contributors'
),
_
(
'Graph'
),
_
(
'Compare'
),
(
_
(
'Locked Files'
)
if
Gitlab
.
ee?
)
]
},
{
nav_item:
_
(
'Issues'
),
nav_sub_items:
[
_
(
'List'
),
_
(
'Boards'
),
_
(
'Labels'
),
_
(
'Milestones'
)
]
},
{
nav_item:
_
(
'Merge Requests'
),
nav_sub_items:
[]
},
(
requirements_nav_item
if
Gitlab
.
ee?
),
{
nav_item:
_
(
'CI / CD'
),
nav_sub_items:
[
_
(
'Pipelines'
),
_
(
'Jobs'
),
_
(
'Artifacts'
),
_
(
'Schedules'
)
]
},
{
nav_item:
_
(
'Operations'
),
nav_sub_items:
[
_
(
'Metrics'
),
_
(
'Environments'
),
_
(
'Error Tracking'
),
_
(
'Serverless'
),
_
(
'Logs'
),
_
(
'Kubernetes'
)
]
},
analytics_nav_item
,
{
nav_item:
_
(
'Wiki'
),
nav_sub_items:
[]
},
{
nav_item:
_
(
'Snippets'
),
nav_sub_items:
[]
},
{
nav_item:
_
(
'Settings'
),
nav_sub_items:
[
_
(
'General'
),
_
(
'Members'
),
_
(
'Integrations'
),
_
(
'Webhooks'
),
_
(
'Repository'
),
_
(
'CI / CD'
),
_
(
'Operations'
),
(
_
(
'Audit Events'
)
if
Gitlab
.
ee?
)
].
compact
}
]
end
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
before
do
stub_licensed_features
(
requirements:
false
)
project
.
add_maintainer
(
user
)
sign_in
(
user
)
end
...
...
@@ -119,28 +21,19 @@ describe 'Project navbar' do
end
end
if
Gitlab
.
ee?
context
'when issues analytics is available'
do
context
'when pages are available'
do
before
do
stub_licensed_features
(
issues_analytics:
true
)
analytics_nav_item
[
:nav_sub_items
]
<<
_
(
'Issues'
)
analytics_nav_item
[
:nav_sub_items
].
sort!
allow
(
Gitlab
.
config
.
pages
).
to
receive
(
:enabled
).
and_return
(
true
)
visit
project_path
(
project
)
end
it_behaves_like
'verified navigation bar'
end
context
'when requirements is available'
do
before
do
stub_licensed_features
(
requirements:
true
)
insert_after_sub_nav_item
(
_
(
'Operations'
),
within:
_
(
'Settings'
),
new_sub_nav_item_name:
_
(
'Pages'
)
)
visit
project_path
(
project
)
end
it_behaves_like
'verified navigation bar'
end
end
end
spec/support/helpers/navbar_structure_helper.rb
0 → 100644
View file @
bdf8c41f
# frozen_string_literal: true
module
NavbarStructureHelper
def
insert_after_nav_item
(
before_nav_item_name
,
new_nav_item
:)
expect
(
structure
).
to
include
(
a_hash_including
(
nav_item:
before_nav_item_name
))
index
=
structure
.
find_index
{
|
h
|
h
[
:nav_item
]
==
before_nav_item_name
}
structure
.
insert
(
index
+
1
,
new_nav_item
)
end
def
insert_after_sub_nav_item
(
before_sub_nav_item_name
,
within
:,
new_sub_nav_item_name
:)
expect
(
structure
).
to
include
(
a_hash_including
(
nav_item:
within
))
hash
=
structure
.
find
{
|
h
|
h
[
:nav_item
]
==
within
}
expect
(
hash
).
to
have_key
(
:nav_sub_items
)
expect
(
hash
[
:nav_sub_items
]).
to
include
(
before_sub_nav_item_name
)
index
=
hash
[
:nav_sub_items
].
find_index
(
before_sub_nav_item_name
)
hash
[
:nav_sub_items
].
insert
(
index
+
1
,
new_sub_nav_item_name
)
end
end
spec/support/shared_contexts/navbar_structure_context.rb
0 → 100644
View file @
bdf8c41f
# frozen_string_literal: true
RSpec
.
shared_context
'project navbar structure'
do
let
(
:requirements_nav_item
)
do
{
nav_item:
_
(
'Requirements'
),
nav_sub_items:
[
_
(
'List'
)]
}
end
let
(
:analytics_nav_item
)
do
{
nav_item:
_
(
'Analytics'
),
nav_sub_items:
[
_
(
'CI / CD'
),
(
_
(
'Code Review'
)
if
Gitlab
.
ee?
),
_
(
'Repository'
),
_
(
'Value Stream'
)
]
}
end
let
(
:structure
)
do
[
{
nav_item:
_
(
'Project overview'
),
nav_sub_items:
[
_
(
'Details'
),
_
(
'Activity'
),
_
(
'Releases'
)
]
},
{
nav_item:
_
(
'Repository'
),
nav_sub_items:
[
_
(
'Files'
),
_
(
'Commits'
),
_
(
'Branches'
),
_
(
'Tags'
),
_
(
'Contributors'
),
_
(
'Graph'
),
_
(
'Compare'
),
(
_
(
'Locked Files'
)
if
Gitlab
.
ee?
)
]
},
{
nav_item:
_
(
'Issues'
),
nav_sub_items:
[
_
(
'List'
),
_
(
'Boards'
),
_
(
'Labels'
),
_
(
'Milestones'
)
]
},
{
nav_item:
_
(
'Merge Requests'
),
nav_sub_items:
[]
},
(
requirements_nav_item
if
Gitlab
.
ee?
),
{
nav_item:
_
(
'CI / CD'
),
nav_sub_items:
[
_
(
'Pipelines'
),
_
(
'Jobs'
),
_
(
'Artifacts'
),
_
(
'Schedules'
)
]
},
{
nav_item:
_
(
'Operations'
),
nav_sub_items:
[
_
(
'Metrics'
),
_
(
'Environments'
),
_
(
'Error Tracking'
),
_
(
'Serverless'
),
_
(
'Logs'
),
_
(
'Kubernetes'
)
]
},
analytics_nav_item
,
{
nav_item:
_
(
'Wiki'
),
nav_sub_items:
[]
},
{
nav_item:
_
(
'Snippets'
),
nav_sub_items:
[]
},
{
nav_item:
_
(
'Settings'
),
nav_sub_items:
[
_
(
'General'
),
_
(
'Members'
),
_
(
'Integrations'
),
_
(
'Webhooks'
),
_
(
'Repository'
),
_
(
'CI / CD'
),
_
(
'Operations'
),
(
_
(
'Audit Events'
)
if
Gitlab
.
ee?
)
].
compact
}
].
compact
end
end
RSpec
.
shared_context
'group navbar structure'
do
let
(
:analytics_nav_item
)
do
{
nav_item:
_
(
'Analytics'
),
nav_sub_items:
[
_
(
'Contribution'
)
]
}
end
let
(
:settings_nav_item
)
do
{
nav_item:
_
(
'Settings'
),
nav_sub_items:
[
_
(
'General'
),
_
(
'Projects'
),
_
(
'CI / CD'
),
_
(
'Webhooks'
),
_
(
'Audit Events'
),
_
(
'Usage Quotas'
)
]
}
end
let
(
:structure
)
do
[
{
nav_item:
_
(
'Group overview'
),
nav_sub_items:
[
_
(
'Details'
),
_
(
'Activity'
)
]
},
{
nav_item:
_
(
'Issues'
),
nav_sub_items:
[
_
(
'List'
),
_
(
'Board'
),
_
(
'Labels'
),
_
(
'Milestones'
)
]
},
{
nav_item:
_
(
'Merge Requests'
),
nav_sub_items:
[]
},
{
nav_item:
_
(
'Kubernetes'
),
nav_sub_items:
[]
},
(
analytics_nav_item
if
Gitlab
.
ee?
),
{
nav_item:
_
(
'Members'
),
nav_sub_items:
[]
}
]
end
end
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