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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
561ed7b9
Commit
561ed7b9
authored
Dec 17, 2016
by
Semyon Pupkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move admin labels spinach test to rspec
https://gitlab.com/gitlab-org/gitlab-ce/issues/23036
parent
e47989a5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
99 additions
and
155 deletions
+99
-155
features/admin/labels.feature
features/admin/labels.feature
+0
-38
features/steps/admin/labels.rb
features/steps/admin/labels.rb
+0
-117
spec/features/admin/admin_labels_spec.rb
spec/features/admin/admin_labels_spec.rb
+99
-0
No files found.
features/admin/labels.feature
deleted
100644 → 0
View file @
e47989a5
Feature
:
Admin Issues Labels
Background
:
Given
I sign in as an admin
And I have labels
:
"bug",
"feature",
"enhancement"
Given
I visit admin labels page
Scenario
:
I
should see labels list
Then
I should see label 'bug'
And
I should see label 'feature'
Scenario
:
I
create new label
Given
I submit new label 'support'
Then
I should see label 'support'
Scenario
:
I
edit label
Given
I visit 'bug' label edit page
When
I change label 'bug' to 'fix'
Then
I should not see label 'bug'
Then
I should see label 'fix'
Scenario
:
I
remove label
When
I remove label 'bug'
Then
I should not see label 'bug'
@javascript
Scenario
:
I
delete all labels
When
I delete all labels
Then
I should see labels help message
Scenario
:
I
create a label with invalid color
Given
I visit admin new label page
When
I submit new label with invalid color
Then
I should see label color error message
Scenario
:
I
create a label that already exists
Given
I visit admin new label page
When
I submit new label 'bug'
Then
I should see label exist error message
features/steps/admin/labels.rb
deleted
100644 → 0
View file @
e47989a5
class
Spinach::Features::AdminIssuesLabels
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedProject
include
SharedPaths
step
'I visit \'bug\' label edit page'
do
visit
edit_admin_label_path
(
bug_label
)
end
step
'I visit admin new label page'
do
visit
new_admin_label_path
end
step
'I visit admin labels page'
do
visit
admin_labels_path
end
step
'I remove label \'bug\''
do
page
.
within
"#label_
#{
bug_label
.
id
}
"
do
click_link
'Delete'
end
end
step
'I have labels: "bug", "feature", "enhancement"'
do
[
"bug"
,
"feature"
,
"enhancement"
].
each
do
|
title
|
Label
.
create
(
title:
title
,
template:
true
)
end
end
step
'I delete all labels'
do
page
.
within
'.labels'
do
page
.
all
(
'.btn-remove'
).
each
do
|
remove
|
remove
.
click
sleep
0.05
end
end
end
step
'I should see labels help message'
do
page
.
within
'.labels'
do
expect
(
page
).
to
have_content
'There are no labels yet'
end
end
step
'I submit new label \'support\''
do
visit
new_admin_label_path
fill_in
'Title'
,
with:
'support'
fill_in
'Background color'
,
with:
'#F95610'
click_button
'Save'
end
step
'I submit new label \'bug\''
do
visit
new_admin_label_path
fill_in
'Title'
,
with:
'bug'
fill_in
'Background color'
,
with:
'#F95610'
click_button
'Save'
end
step
'I submit new label with invalid color'
do
visit
new_admin_label_path
fill_in
'Title'
,
with:
'support'
fill_in
'Background color'
,
with:
'#12'
click_button
'Save'
end
step
'I should see label exist error message'
do
page
.
within
'.label-form'
do
expect
(
page
).
to
have_content
'Title has already been taken'
end
end
step
'I should see label color error message'
do
page
.
within
'.label-form'
do
expect
(
page
).
to
have_content
'Color must be a valid color code'
end
end
step
'I should see label \'feature\''
do
page
.
within
'.manage-labels-list'
do
expect
(
page
).
to
have_content
'feature'
end
end
step
'I should see label \'bug\''
do
page
.
within
'.manage-labels-list'
do
expect
(
page
).
to
have_content
'bug'
end
end
step
'I should not see label \'bug\''
do
page
.
within
'.manage-labels-list'
do
expect
(
page
).
not_to
have_content
'bug'
end
end
step
'I should see label \'support\''
do
page
.
within
'.manage-labels-list'
do
expect
(
page
).
to
have_content
'support'
end
end
step
'I change label \'bug\' to \'fix\''
do
fill_in
'Title'
,
with:
'fix'
fill_in
'Background color'
,
with:
'#F15610'
click_button
'Save'
end
step
'I should see label \'fix\''
do
page
.
within
'.manage-labels-list'
do
expect
(
page
).
to
have_content
'fix'
end
end
def
bug_label
Label
.
templates
.
find_or_create_by
(
title:
'bug'
)
end
end
spec/features/admin/admin_labels_spec.rb
0 → 100644
View file @
561ed7b9
require
'spec_helper'
RSpec
.
describe
'admin issues labels'
do
include
WaitForAjax
let!
(
:bug_label
)
{
Label
.
create
(
title:
'bug'
,
template:
true
)
}
let!
(
:feature_label
)
{
Label
.
create
(
title:
'feature'
,
template:
true
)
}
before
do
login_as
:admin
end
describe
'list'
do
before
do
visit
admin_labels_path
end
it
'renders labels list'
do
page
.
within
'.manage-labels-list'
do
expect
(
page
).
to
have_content
(
'bug'
)
expect
(
page
).
to
have_content
(
'feature'
)
end
end
it
'deletes label'
do
page
.
within
"#label_
#{
bug_label
.
id
}
"
do
click_link
'Delete'
end
page
.
within
'.manage-labels-list'
do
expect
(
page
).
not_to
have_content
(
'bug'
)
end
end
it
'deletes all labels'
,
js:
true
do
page
.
within
'.labels'
do
page
.
all
(
'.btn-remove'
).
each
do
|
remove
|
wait_for_ajax
remove
.
click
end
end
page
.
within
'.manage-labels-list'
do
expect
(
page
).
not_to
have_content
(
'bug'
)
expect
(
page
).
not_to
have_content
(
'feature_label'
)
end
end
end
describe
'create'
do
before
do
visit
new_admin_label_path
end
it
'creates new label'
do
fill_in
'Title'
,
with:
'support'
fill_in
'Background color'
,
with:
'#F95610'
click_button
'Save'
page
.
within
'.manage-labels-list'
do
expect
(
page
).
to
have_content
(
'support'
)
end
end
it
'does not creates label with invalid color'
do
fill_in
'Title'
,
with:
'support'
fill_in
'Background color'
,
with:
'#12'
click_button
'Save'
page
.
within
'.label-form'
do
expect
(
page
).
to
have_content
(
'Color must be a valid color code'
)
end
end
it
'does not creates label if label already exists'
do
fill_in
'Title'
,
with:
'bug'
fill_in
'Background color'
,
with:
'#F95610'
click_button
'Save'
page
.
within
'.label-form'
do
expect
(
page
).
to
have_content
'Title has already been taken'
end
end
end
describe
'edit'
do
it
'changes bug label'
do
visit
edit_admin_label_path
(
bug_label
)
fill_in
'Title'
,
with:
'fix'
fill_in
'Background color'
,
with:
'#F15610'
click_button
'Save'
page
.
within
'.manage-labels-list'
do
expect
(
page
).
to
have_content
(
'fix'
)
end
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