BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
25d9f71e
Commit
25d9f71e
authored
Nov 24, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add feature tests for Cycle Analytics
parent
8dc2163c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
132 additions
and
4 deletions
+132
-4
_empty_stage.html.haml
app/views/projects/cycle_analytics/_empty_stage.html.haml
+1
-1
show.html.haml
app/views/projects/cycle_analytics/show.html.haml
+3
-3
cycle_analytics_spec.rb
spec/features/cycle_analytics_spec.rb
+128
-0
No files found.
app/views/projects/cycle_analytics/_empty_stage.html.haml
View file @
25d9f71e
...
...
@@ -2,6 +2,6 @@
.empty-stage
.icon-no-data
=
custom_icon
(
'icon_no_data'
)
%h4
We don
’
t have enough data to show this stage.
%h4
We don
'
t have enough data to show this stage.
%p
{{currentStage.emptyStageText}}
app/views/projects/cycle_analytics/show.html.haml
View file @
25d9f71e
...
...
@@ -27,9 +27,9 @@
.content-block
.container-fluid
.row
.col-sm-3.col-xs-12.column
{
"v-for"
=>
"item in state.summary"
}
%h3
.header
{{
item.value
}}
%p
.text
{{
item.title
}}
.col-sm-3.col-xs-12.column
{
"v-for"
=>
"item in state.summary"
}
%h3
.header
{{
item.value
}}
%p
.text
{{
item.title
}}
.col-sm-3.col-xs-12.column
.dropdown.inline.js-ca-dropdown
%button
.dropdown-menu-toggle
{
"data-toggle"
=>
"dropdown"
,
:type
=>
"button"
}
...
...
spec/features/cycle_analytics_spec.rb
0 → 100644
View file @
25d9f71e
require
'spec_helper'
feature
'Cycle Analytics'
,
feature:
true
,
js:
true
do
include
WaitForAjax
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:guest
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
created_at:
2
.
days
.
ago
)
}
context
'as an allowed user'
do
context
'when project is new'
do
before
do
project
.
team
<<
[
user
,
:master
]
login_as
(
user
)
visit
namespace_project_cycle_analytics_path
(
project
.
namespace
,
project
)
wait_for_ajax
end
it
'shows introductory message'
do
expect
(
page
).
to
have_content
(
'Introducing Cycle Analytics'
)
end
it
'shows active stage with empty message'
do
expect
(
page
).
to
have_selector
(
'.stage-nav-item.active'
,
text:
'Issue'
)
expect
(
page
).
to
have_content
(
"We don't have enough data to show this stage."
)
end
end
context
"when there's cycle analytics data"
do
before
do
project
.
team
<<
[
user
,
:master
]
allow_any_instance_of
(
Gitlab
::
ReferenceExtractor
).
to
receive
(
:issues
).
and_return
([
issue
])
create_cycle
deploy_master
login_as
(
user
)
visit
namespace_project_cycle_analytics_path
(
project
.
namespace
,
project
)
end
it
'shows data on each stage'
do
expect_issue_to_be_present
click_stage
(
'Plan'
)
expect
(
find
(
'.stage-events'
)).
to
have_content
(
@merge_request
.
commits
.
last
.
title
)
click_stage
(
'Code'
)
expect_merge_request_to_be_present
click_stage
(
'Test'
)
expect_build_to_be_present
click_stage
(
'Review'
)
expect_merge_request_to_be_present
click_stage
(
'Staging'
)
expect_build_to_be_present
click_stage
(
'Production'
)
expect_issue_to_be_present
end
end
end
context
"as a guest"
do
before
do
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
guest
,
:guest
]
allow_any_instance_of
(
Gitlab
::
ReferenceExtractor
).
to
receive
(
:issues
).
and_return
([
issue
])
create_cycle
deploy_master
login_as
(
guest
)
visit
namespace_project_cycle_analytics_path
(
project
.
namespace
,
project
)
wait_for_ajax
end
it
'needs permissions to see restricted stages'
do
expect
(
find
(
'.stage-events'
)).
to
have_content
(
issue
.
title
)
click_stage
(
'Code'
)
expect
(
find
(
'.stage-events'
)).
to
have_content
(
'You need permission.'
)
click_stage
(
'Review'
)
expect
(
find
(
'.stage-events'
)).
to
have_content
(
'You need permission.'
)
end
end
def
expect_issue_to_be_present
expect
(
find
(
'.stage-events'
)).
to
have_content
(
issue
.
title
)
expect
(
find
(
'.stage-events'
)).
to
have_content
(
issue
.
author
.
name
)
expect
(
find
(
'.stage-events'
)).
to
have_content
(
"#
#{
issue
.
iid
}
"
)
end
def
expect_build_to_be_present
expect
(
find
(
'.stage-events'
)).
to
have_content
(
@build
.
ref
)
expect
(
find
(
'.stage-events'
)).
to
have_content
(
@build
.
short_sha
)
expect
(
find
(
'.stage-events'
)).
to
have_content
(
"#
#{
@build
.
id
}
"
)
end
def
expect_merge_request_to_be_present
expect
(
find
(
'.stage-events'
)).
to
have_content
(
@merge_request
.
title
)
expect
(
find
(
'.stage-events'
)).
to
have_content
(
@merge_request
.
author
.
name
)
expect
(
find
(
'.stage-events'
)).
to
have_content
(
"!
#{
@merge_request
.
iid
}
"
)
end
def
create_cycle
milestone
=
create
(
:milestone
,
project:
project
)
issue
.
update
(
milestone:
milestone
)
@merge_request
=
create_merge_request_closing_issue
(
issue
)
pipeline
=
create
(
:ci_empty_pipeline
,
status:
'created'
,
project:
project
,
ref:
@merge_request
.
source_branch
,
sha:
@merge_request
.
source_branch_sha
)
pipeline
.
run
@build
=
create
(
:ci_build
,
pipeline:
pipeline
,
status: :success
,
author:
user
)
merge_merge_requests_closing_issue
(
issue
)
ProcessCommitWorker
.
new
.
perform
(
project
.
id
,
user
.
id
,
@merge_request
.
commits
.
last
.
to_hash
)
end
def
click_stage
(
stage_name
)
find
(
'.stage-nav li'
,
text:
stage_name
).
click
wait_for_ajax
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