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
8a2605e0
Commit
8a2605e0
authored
Nov 29, 2019
by
Ezekiel Kigbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added feature specs for persisting stage edits
Minor cleanup resused spec data
parent
f29f681e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
24 deletions
+63
-24
ee/spec/features/analytics/cycle_analytics/cycle_analytics_spec.rb
...eatures/analytics/cycle_analytics/cycle_analytics_spec.rb
+63
-24
No files found.
ee/spec/features/analytics/cycle_analytics/cycle_analytics_spec.rb
View file @
8a2605e0
...
...
@@ -10,6 +10,8 @@ describe 'Group Cycle Analytics', :js do
let
(
:mr
)
{
create_merge_request_closing_issue
(
user
,
project
,
issue
,
commit_message:
"References
#{
issue
.
to_reference
}
"
)
}
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
status:
'created'
,
project:
project
,
ref:
mr
.
source_branch
,
sha:
mr
.
source_branch_sha
,
head_pipeline_of:
mr
)
}
stage_nav_selector
=
'.stage-nav'
3
.
times
do
|
i
|
let!
(
"issue_
#{
i
}
"
.
to_sym
)
{
create
(
:issue
,
title:
"New Issue
#{
i
}
"
,
project:
project
,
created_at:
2
.
days
.
ago
)
}
end
...
...
@@ -119,11 +121,11 @@ describe 'Group Cycle Analytics', :js do
context
'stage nav'
do
it
'displays the list of stages'
do
expect
(
page
).
to
have_selector
(
'.stage-nav'
,
visible:
true
)
expect
(
page
).
to
have_selector
(
stage_nav_selector
,
visible:
true
)
end
it
'displays the default list of stages'
do
stage_nav
=
page
.
find
(
'.stage-nav'
)
stage_nav
=
page
.
find
(
stage_nav_selector
)
%w[Issue Plan Code Test Review Staging Production]
.
each
do
|
item
|
expect
(
stage_nav
).
to
have_content
(
item
)
...
...
@@ -212,13 +214,14 @@ describe 'Group Cycle Analytics', :js do
end
describe
'Customizable cycle analytics'
,
:js
do
custom_stage
=
"Cool beans"
custom_stage
_name
=
"Cool beans"
start_event_identifier
=
:merge_request_created
end_event_identifier
=
:merge_request_merged
let
(
:button_class
)
{
'.js-add-stage-button'
}
let
(
:params
)
{
{
name:
custom_stage
,
start_event_identifier:
start_event_identifier
,
end_event_identifier:
end_event_identifier
}
}
let
(
:params
)
{
{
name:
custom_stage
_name
,
start_event_identifier:
start_event_identifier
,
end_event_identifier:
end_event_identifier
}
}
let
(
:first_default_stage
)
{
page
.
find
(
'.stage-nav-item-cell'
,
text:
"Issue"
).
ancestor
(
".stage-nav-item"
)
}
let
(
:first_custom_stage
)
{
page
.
find
(
'.stage-nav-item-cell'
,
text:
custom_stage
).
ancestor
(
".stage-nav-item"
)
}
let
(
:first_custom_stage
)
{
page
.
find
(
'.stage-nav-item-cell'
,
text:
custom_stage
_name
).
ancestor
(
".stage-nav-item"
)
}
def
create_custom_stage
Analytics
::
CycleAnalytics
::
Stages
::
CreateService
.
new
(
parent:
group
,
params:
params
,
current_user:
user
).
execute
...
...
@@ -283,8 +286,6 @@ describe 'Group Cycle Analytics', :js do
end
context
'with all required fields set'
do
custom_stage_name
=
"cool beans"
before
do
fill_in
'custom-stage-name'
,
with:
custom_stage_name
select_dropdown_option
'custom-stage-start-event'
...
...
@@ -338,28 +339,66 @@ describe 'Group Cycle Analytics', :js do
stage_save_button
=
'.js-save-stage'
name_field
=
"custom-stage-name"
start_event_field
=
"custom-stage-start-event"
end_event_field
=
"custom-stage-end-event"
end_event_field
=
"custom-stage-stop-event"
updated_custom_stage_name
=
'Extra uber cool stage'
def
select_edit_stage
toggle_more_options
(
first_custom_stage
)
click_button
"Edit stage"
end
before
do
create_custom_stage
select_group
expect
(
page
).
to
have_text
custom_stage
toggle_more_options
(
first_custom_stage
)
click_button
"Edit stage"
expect
(
page
).
to
have_text
custom_stage_name
end
it
'prepoulates the stage data'
do
expect
(
page
.
find
(
stage_form_class
)).
to
have_text
'Editing stage'
context
'with no changes to the data'
do
before
do
select_edit_stage
end
it
'displays the editing stage form'
do
expect
(
page
.
find
(
stage_form_class
)).
to
have_text
'Editing stage'
end
it
'prepoulates the stage data'
do
expect
(
page
.
find_field
(
name_field
).
value
).
to
eq
custom_stage_name
expect
(
page
.
find_field
(
start_event_field
).
value
).
to
eq
start_event_identifier
.
to_s
expect
(
page
.
find_field
(
end_event_field
).
value
).
to
eq
end_event_identifier
.
to_s
end
expect
(
page
.
find_field
(
name_field
).
value
).
to
eq
custom_stage
expect
(
page
.
find_field
(
start_event_field
).
value
).
to
eq
start_event_identifier
e
xpect
(
page
.
find_field
(
end_event_field
).
value
).
to
eq
end_event_identifier
it
'disables the submit form button'
do
expect
(
page
.
find
(
stage_save_button
)[
:disabled
]).
to
eq
"true"
e
nd
end
it
'disables the submit form if there are no changes'
do
expect
(
page
.
find
(
stage_save_button
)[
:disabled
]).
to
eq
"true"
context
'with changes'
do
before
do
select_edit_stage
end
it
'enables the submit button'
do
fill_in
name_field
,
with:
updated_custom_stage_name
expect
(
page
.
find
(
stage_save_button
)[
:disabled
]).
to
eq
nil
end
it
'will persist updates to the stage'
do
fill_in
name_field
,
with:
updated_custom_stage_name
page
.
find
(
stage_save_button
).
click
expect
(
page
.
find
(
'.flash-notice'
)).
to
have_text
'Stage data updated'
expect
(
page
.
find
(
stage_nav_selector
)).
not_to
have_text
custom_stage_name
expect
(
page
.
find
(
stage_nav_selector
)).
to
have_text
updated_custom_stage_name
end
it
'disables the submit form button if incomplete'
do
fill_in
name_field
,
with:
""
expect
(
page
.
find
(
stage_save_button
)[
:disabled
]).
to
eq
"true"
end
end
end
...
...
@@ -384,7 +423,7 @@ describe 'Group Cycle Analytics', :js do
end
it
'will not appear in the stage table after being hidden'
do
nav
=
page
.
find
(
'.stage-nav'
)
nav
=
page
.
find
(
stage_nav_selector
)
expect
(
nav
).
to
have_text
(
"Issue"
)
click_button
"Hide stage"
...
...
@@ -399,7 +438,7 @@ describe 'Group Cycle Analytics', :js do
create_custom_stage
select_group
expect
(
page
).
to
have_text
custom_stage
expect
(
page
).
to
have_text
custom_stage
_name
toggle_more_options
(
first_custom_stage
)
end
...
...
@@ -417,13 +456,13 @@ describe 'Group Cycle Analytics', :js do
end
it
'will not appear in the stage table after being removed'
do
nav
=
page
.
find
(
'.stage-nav'
)
expect
(
nav
).
to
have_text
(
custom_stage
)
nav
=
page
.
find
(
stage_nav_selector
)
expect
(
nav
).
to
have_text
(
custom_stage
_name
)
click_button
"Remove stage"
expect
(
page
.
find
(
'.flash-notice'
)).
to
have_text
'Stage removed'
expect
(
nav
).
not_to
have_text
(
custom_stage
)
expect
(
nav
).
not_to
have_text
(
custom_stage
_name
)
end
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