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
iv
gitlab-ce
Commits
6aea7666
Commit
6aea7666
authored
May 20, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for issues with multiple labels
parent
d6cecf7a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
29 deletions
+60
-29
spec/features/projects/labels/issues_sorted_by_priority_spec.rb
...eatures/projects/labels/issues_sorted_by_priority_spec.rb
+60
-29
No files found.
spec/features/projects/labels/issues_sorted_by_priority_spec.rb
View file @
6aea7666
...
@@ -5,31 +5,23 @@ feature 'Issue prioritization', feature: true do
...
@@ -5,31 +5,23 @@ feature 'Issue prioritization', feature: true do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
name:
'test'
,
namespace:
user
.
namespace
)
}
let
(
:project
)
{
create
(
:project
,
name:
'test'
,
namespace:
user
.
namespace
)
}
# Labels
let
(
:label_1
)
{
create
(
:label
,
title:
'label_1'
,
project:
project
,
priority:
1
)
}
let
(
:label_2
)
{
create
(
:label
,
title:
'label_2'
,
project:
project
,
priority:
2
)
}
let
(
:label_3
)
{
create
(
:label
,
title:
'label_3'
,
project:
project
,
priority:
3
)
}
let
(
:label_4
)
{
create
(
:label
,
title:
'label_4'
,
project:
project
,
priority:
4
)
}
let
(
:label_5
)
{
create
(
:label
,
title:
'label_5'
,
project:
project
)
}
# no priority
# According to https://gitlab.com/gitlab-org/gitlab-ce/issues/14189#note_4360653
# According to https://gitlab.com/gitlab-org/gitlab-ce/issues/14189#note_4360653
context
'when
assigned with prioritized labels
'
do
context
'when
issues have one label
'
do
scenario
'Are sorted properly'
do
scenario
'Are sorted properly'
do
login_as
user
label_1
=
create
(
:label
,
title:
'label_1'
,
priority:
1
)
label_2
=
create
(
:label
,
title:
'label_2'
,
priority:
2
)
label_3
=
create
(
:label
,
title:
'label_3'
,
priority:
3
)
label_4
=
create
(
:label
,
title:
'label_4'
,
priority:
4
)
label_5
=
create
(
:label
,
title:
'label_5'
)
# no priority
project
.
labels
<<
label_1
project
.
labels
<<
label_2
project
.
labels
<<
label_3
project
.
labels
<<
label_4
project
.
labels
<<
label_5
# Issues
issue_1
=
create
(
:issue
,
title:
'issue_1'
,
project:
project
)
issue_1
=
create
(
:issue
,
title:
'issue_1'
,
project:
project
)
issue_2
=
create
(
:issue
,
title:
'issue_2'
,
project:
project
)
issue_2
=
create
(
:issue
,
title:
'issue_2'
,
project:
project
)
issue_3
=
create
(
:issue
,
title:
'issue_3'
,
project:
project
)
issue_3
=
create
(
:issue
,
title:
'issue_3'
,
project:
project
)
issue_4
=
create
(
:issue
,
title:
'issue_4'
,
project:
project
)
issue_4
=
create
(
:issue
,
title:
'issue_4'
,
project:
project
)
issue_5
=
create
(
:issue
,
title:
'issue_5'
,
project:
project
)
issue_5
=
create
(
:issue
,
title:
'issue_5'
,
project:
project
)
issue_6
=
create
(
:issue
,
title:
'issue_6'
,
project:
project
)
issue_7
=
create
(
:issue
,
title:
'issue_7'
,
project:
project
)
issue_8
=
create
(
:issue
,
title:
'issue_8'
,
project:
project
)
# Assign labels to issues disorderly
# Assign labels to issues disorderly
issue_4
.
labels
<<
label_1
issue_4
.
labels
<<
label_1
...
@@ -37,26 +29,65 @@ feature 'Issue prioritization', feature: true do
...
@@ -37,26 +29,65 @@ feature 'Issue prioritization', feature: true do
issue_5
.
labels
<<
label_3
issue_5
.
labels
<<
label_3
issue_2
.
labels
<<
label_4
issue_2
.
labels
<<
label_4
issue_1
.
labels
<<
label_5
issue_1
.
labels
<<
label_5
issue_6
.
labels
<<
label_5
issue_7
.
labels
<<
label_5
issue_8
.
labels
<<
label_5
login_as
user
visit
namespace_project_issues_path
(
project
.
namespace
,
project
,
sort:
'priority'
)
visit
namespace_project_issues_path
(
project
.
namespace
,
project
,
sort:
'priority'
)
# Ensure we are indicating that issues are sorted by priority
# Ensure we are indicating that issues are sorted by priority
expect
(
page
).
to
have_selector
(
'.dropdown-toggle'
,
text:
'Priority'
)
expect
(
page
).
to
have_selector
(
'.dropdown-toggle'
,
text:
'Priority'
)
page
.
within
(
'.issues-
list
'
)
do
page
.
within
(
'.issues-
holder
'
)
do
expect
(
find
(
'> li:nth-of-type(1)'
)).
to
have_content
(
'issue_4'
)
expect
(
page
).
to
have_selector
(
'.issues-list > li:nth-of-type(1)'
,
text:
'issue_4'
)
expect
(
find
(
'> li:nth-of-type(2)'
)).
to
have_content
(
'issue_3'
)
expect
(
page
).
to
have_selector
(
'.issues-list > li:nth-of-type(2)'
,
text:
'issue_3'
)
expect
(
find
(
'> li:nth-of-type(3)'
)).
to
have_content
(
'issue_5'
)
expect
(
page
).
to
have_selector
(
'.issues-list > li:nth-of-type(3)'
,
text:
'issue_5'
)
expect
(
find
(
'> li:nth-of-type(4)'
)).
to
have_content
(
'issue_2'
)
expect
(
page
).
to
have_selector
(
'.issues-list > li:nth-of-type(4)'
,
text:
'issue_2'
)
# the rest should be at the bottom
# the rest should be at the bottom
expect
(
find
(
'> li:nth-of-type(5)'
)).
to
have_content
(
'issue_7'
)
expect
(
page
).
to
have_selector
(
'.issues-list > li:nth-of-type(5)'
,
text:
'issue_1'
)
expect
(
find
(
'> li:nth-of-type(6)'
)).
to
have_content
(
'issue_8'
)
end
expect
(
find
(
'> li:nth-of-type(7)'
)).
to
have_content
(
'issue_1'
)
end
expect
(
find
(
'> li:nth-of-type(8)'
)).
to
have_content
(
'issue_6'
)
end
context
'when issues have multiple labels'
do
scenario
'Are sorted properly'
do
# Issues
issue_1
=
create
(
:issue
,
title:
'issue_1'
,
project:
project
)
issue_2
=
create
(
:issue
,
title:
'issue_2'
,
project:
project
)
issue_3
=
create
(
:issue
,
title:
'issue_3'
,
project:
project
)
issue_4
=
create
(
:issue
,
title:
'issue_4'
,
project:
project
)
issue_5
=
create
(
:issue
,
title:
'issue_5'
,
project:
project
)
issue_6
=
create
(
:issue
,
title:
'issue_6'
,
project:
project
)
issue_7
=
create
(
:issue
,
title:
'issue_7'
,
project:
project
)
issue_8
=
create
(
:issue
,
title:
'issue_8'
,
project:
project
)
# Assign labels to issues disorderly
issue_5
.
labels
<<
label_1
# 1
issue_5
.
labels
<<
label_2
issue_8
.
labels
<<
label_1
# 2
issue_1
.
labels
<<
label_2
# 3
issue_1
.
labels
<<
label_3
issue_3
.
labels
<<
label_2
# 4
issue_3
.
labels
<<
label_4
issue_7
.
labels
<<
label_2
# 5
issue_2
.
labels
<<
label_3
# 6
issue_4
.
labels
<<
label_4
# 7
issue_6
.
labels
<<
label_5
# 8 – No priority
login_as
user
visit
namespace_project_issues_path
(
project
.
namespace
,
project
,
sort:
'priority'
)
expect
(
page
).
to
have_selector
(
'.dropdown-toggle'
,
text:
'Priority'
)
page
.
within
(
'.issues-holder'
)
do
expect
(
page
).
to
have_selector
(
'.issues-list > li:nth-of-type(1)'
,
text:
'issue_5'
)
expect
(
page
).
to
have_selector
(
'.issues-list > li:nth-of-type(2)'
,
text:
'issue_8'
)
expect
(
page
).
to
have_selector
(
'.issues-list > li:nth-of-type(3)'
,
text:
'issue_1'
)
expect
(
page
).
to
have_selector
(
'.issues-list > li:nth-of-type(4)'
,
text:
'issue_3'
)
expect
(
page
).
to
have_selector
(
'.issues-list > li:nth-of-type(5)'
,
text:
'issue_7'
)
expect
(
page
).
to
have_selector
(
'.issues-list > li:nth-of-type(6)'
,
text:
'issue_2'
)
expect
(
page
).
to
have_selector
(
'.issues-list > li:nth-of-type(7)'
,
text:
'issue_4'
)
expect
(
page
).
to
have_selector
(
'.issues-list > li:nth-of-type(8)'
,
text:
'issue_6'
)
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