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
Jérome Perrin
gitlab-ce
Commits
d84f1180
Commit
d84f1180
authored
May 06, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bulk assignment tests
parent
dbf9df1d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
120 additions
and
38 deletions
+120
-38
spec/features/issues/bulk_assigment_labels_spec.rb
spec/features/issues/bulk_assigment_labels_spec.rb
+120
-38
No files found.
spec/features/issues/bulk_assigment_labels_spec.rb
View file @
d84f1180
...
@@ -3,80 +3,147 @@ require 'rails_helper'
...
@@ -3,80 +3,147 @@ require 'rails_helper'
feature
'Issues > Labels bulk assignment'
,
feature:
true
do
feature
'Issues > Labels bulk assignment'
,
feature:
true
do
include
WaitForAjax
include
WaitForAjax
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:issue1
)
{
create
(
:issue
,
project:
project
,
title:
"Issue 1"
)
}
let!
(
:issue1
)
{
create
(
:issue
,
project:
project
,
title:
"Issue 1"
)
}
let!
(
:issue2
)
{
create
(
:issue
,
project:
project
,
title:
"Issue 2"
)
}
let!
(
:issue2
)
{
create
(
:issue
,
project:
project
,
title:
"Issue 2"
)
}
let!
(
:bug
)
{
create
(
:label
,
project:
project
,
title:
'bug'
)
}
before
do
let!
(
:feature
)
{
create
(
:label
,
project:
project
,
title:
'feature'
)
}
create
(
:label
,
project:
project
,
title:
'bug'
)
create
(
:label
,
project:
project
,
title:
'feature'
)
end
context
'as a allowed user'
,
js:
true
do
context
'as a allowed user'
,
js:
true
do
before
do
before
do
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user
,
:master
]
login_as
user
visit
namespace_project_issues_path
(
project
.
namespace
,
project
)
login_as
user
end
end
context
'can bulk assign a label'
do
context
'can bulk assign'
do
context
'to all issues'
do
before
do
before
do
visit
namespace_project_issues_path
(
project
.
namespace
,
project
)
check
'check_all_issues'
end
open_labels_dropdown
[
'bug'
]
click_button
'Update issues'
context
'a label'
do
context
'to all issues'
do
before
do
check
'check_all_issues'
open_labels_dropdown
[
'bug'
]
click_button
'Update issues'
end
it
do
expect
(
find
(
"#issue_
#{
issue1
.
id
}
"
)).
to
have_content
'bug'
expect
(
find
(
"#issue_
#{
issue2
.
id
}
"
)).
to
have_content
'bug'
end
end
end
it
do
context
'to a issue'
do
expect
(
find
(
"#issue_
#{
issue1
.
id
}
"
)).
to
have_content
'bug'
before
do
expect
(
find
(
"#issue_
#{
issue2
.
id
}
"
)).
to
have_content
'bug'
check
"selected_issue_
#{
issue1
.
id
}
"
open_labels_dropdown
[
'bug'
]
click_button
'Update issues'
end
it
do
expect
(
find
(
"#issue_
#{
issue1
.
id
}
"
)).
to
have_content
'bug'
expect
(
find
(
"#issue_
#{
issue2
.
id
}
"
)).
not_to
have_content
'bug'
end
end
end
end
end
context
'to a issue'
do
context
'multiple labels'
do
context
'to all issues'
do
before
do
check
'check_all_issues'
open_labels_dropdown
[
'bug'
,
'feature'
]
click_button
'Update issues'
end
it
do
expect
(
find
(
"#issue_
#{
issue1
.
id
}
"
)).
to
have_content
'bug'
expect
(
find
(
"#issue_
#{
issue1
.
id
}
"
)).
to
have_content
'feature'
expect
(
find
(
"#issue_
#{
issue2
.
id
}
"
)).
to
have_content
'bug'
expect
(
find
(
"#issue_
#{
issue2
.
id
}
"
)).
to
have_content
'feature'
end
end
context
'to a issue'
do
before
do
check
"selected_issue_
#{
issue1
.
id
}
"
open_labels_dropdown
[
'bug'
,
'feature'
]
click_button
'Update issues'
end
it
do
expect
(
find
(
"#issue_
#{
issue1
.
id
}
"
)).
to
have_content
'bug'
expect
(
find
(
"#issue_
#{
issue1
.
id
}
"
)).
to
have_content
'feature'
expect
(
find
(
"#issue_
#{
issue2
.
id
}
"
)).
not_to
have_content
'bug'
expect
(
find
(
"#issue_
#{
issue2
.
id
}
"
)).
not_to
have_content
'feature'
end
end
end
end
context
'can bulk un-assign'
do
context
'all labels to all issues'
do
before
do
before
do
check
"selected_issue_
#{
issue1
.
id
}
"
issue1
.
labels
<<
bug
open_labels_dropdown
[
'bug'
]
issue1
.
labels
<<
feature
issue2
.
labels
<<
bug
issue2
.
labels
<<
feature
visit
namespace_project_issues_path
(
project
.
namespace
,
project
)
check
'check_all_issues'
unmark_labels_in_dropdown
[
'bug'
,
'feature'
]
click_button
'Update issues'
click_button
'Update issues'
end
end
it
do
it
do
expect
(
find
(
"#issue_
#{
issue1
.
id
}
"
)).
to
have_content
'bug'
expect
(
find
(
"#issue_
#{
issue1
.
id
}
"
)).
not_to
have_content
'bug'
expect
(
find
(
"#issue_
#{
issue1
.
id
}
"
)).
not_to
have_content
'feature'
expect
(
find
(
"#issue_
#{
issue2
.
id
}
"
)).
not_to
have_content
'bug'
expect
(
find
(
"#issue_
#{
issue2
.
id
}
"
)).
not_to
have_content
'bug'
expect
(
find
(
"#issue_
#{
issue2
.
id
}
"
)).
not_to
have_content
'feature'
end
end
end
end
end
context
'can bulk assign multiple labels'
do
context
'a label to a issue'
do
context
'to all issues'
do
before
do
before
do
check
'check_all_issues'
issue1
.
labels
<<
bug
open_labels_dropdown
[
'bug'
,
'feature'
]
issue2
.
labels
<<
feature
visit
namespace_project_issues_path
(
project
.
namespace
,
project
)
check_issue
issue1
unmark_labels_in_dropdown
[
'bug'
]
click_button
'Update issues'
click_button
'Update issues'
end
end
it
do
it
do
expect
(
find
(
"#issue_
#{
issue1
.
id
}
"
)).
to
have_content
'bug'
expect
(
find
(
"#issue_
#{
issue1
.
id
}
"
)).
not_to
have_content
'bug'
expect
(
find
(
"#issue_
#{
issue1
.
id
}
"
)).
to
have_content
'feature'
expect
(
find
(
"#issue_
#{
issue2
.
id
}
"
)).
to
have_content
'bug'
expect
(
find
(
"#issue_
#{
issue2
.
id
}
"
)).
to
have_content
'feature'
expect
(
find
(
"#issue_
#{
issue2
.
id
}
"
)).
to
have_content
'feature'
end
end
end
end
context
'
to a issue
'
do
context
'
a label and keep the others label
'
do
before
do
before
do
check
"selected_issue_
#{
issue1
.
id
}
"
issue1
.
labels
<<
bug
open_labels_dropdown
[
'bug'
,
'feature'
]
issue1
.
labels
<<
feature
issue2
.
labels
<<
bug
issue2
.
labels
<<
feature
visit
namespace_project_issues_path
(
project
.
namespace
,
project
)
check_issue
issue1
check_issue
issue2
unmark_labels_in_dropdown
[
'bug'
]
click_button
'Update issues'
click_button
'Update issues'
end
end
it
do
it
do
expect
(
find
(
"#issue_
#{
issue1
.
id
}
"
)).
to
have_content
'bug'
expect
(
find
(
"#issue_
#{
issue1
.
id
}
"
)).
not_
to
have_content
'bug'
expect
(
find
(
"#issue_
#{
issue1
.
id
}
"
)).
to
have_content
'feature'
expect
(
find
(
"#issue_
#{
issue1
.
id
}
"
)).
to
have_content
'feature'
expect
(
find
(
"#issue_
#{
issue2
.
id
}
"
)).
not_to
have_content
'bug'
expect
(
find
(
"#issue_
#{
issue2
.
id
}
"
)).
not_to
have_content
'bug'
expect
(
find
(
"#issue_
#{
issue2
.
id
}
"
)).
not_
to
have_content
'feature'
expect
(
find
(
"#issue_
#{
issue2
.
id
}
"
)).
to
have_content
'feature'
end
end
end
end
end
end
...
@@ -97,13 +164,28 @@ feature 'Issues > Labels bulk assignment', feature: true do
...
@@ -97,13 +164,28 @@ feature 'Issues > Labels bulk assignment', feature: true do
end
end
end
end
def
open_labels_dropdown
(
items
=
[])
def
open_labels_dropdown
(
items
=
[]
,
unmark
=
false
)
page
.
within
(
'.issues_bulk_update'
)
do
page
.
within
(
'.issues_bulk_update'
)
do
click_button
'Label'
click_button
'Label'
wait_for_ajax
wait_for_ajax
items
.
map
do
|
item
|
items
.
map
do
|
item
|
click_link
item
click_link
item
end
end
if
unmark
items
.
map
do
|
item
|
click_link
item
end
end
end
end
def
unmark_labels_in_dropdown
(
items
=
[])
open_labels_dropdown
(
items
,
true
)
end
def
check_issue
(
issue
)
page
.
within
(
'.issues-list'
)
do
check
"selected_issue_
#{
issue
.
id
}
"
end
end
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