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
3e2c3649
Commit
3e2c3649
authored
Oct 04, 2018
by
Jarka Košanová
Committed by
Jose Vargas
Dec 05, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add feature specs for sorting in asc/desc order
parent
ae7c95af
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
225 additions
and
179 deletions
+225
-179
spec/features/issuables/default_sort_order_spec.rb
spec/features/issuables/default_sort_order_spec.rb
+0
-179
spec/features/issuables/sorting_list_spec.rb
spec/features/issuables/sorting_list_spec.rb
+225
-0
No files found.
spec/features/issuables/default_sort_order_spec.rb
deleted
100644 → 0
View file @
ae7c95af
require
'spec_helper'
describe
'Projects > Issuables > Default sort order'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:first_created_issuable
)
{
issuables
.
order_created_asc
.
first
}
let
(
:last_created_issuable
)
{
issuables
.
order_created_desc
.
first
}
let
(
:first_updated_issuable
)
{
issuables
.
order_updated_asc
.
first
}
let
(
:last_updated_issuable
)
{
issuables
.
order_updated_desc
.
first
}
context
'for merge requests'
do
include
MergeRequestHelpers
let!
(
:issuables
)
do
timestamps
=
[{
created_at:
3
.
minutes
.
ago
,
updated_at:
20
.
seconds
.
ago
},
{
created_at:
2
.
minutes
.
ago
,
updated_at:
30
.
seconds
.
ago
},
{
created_at:
4
.
minutes
.
ago
,
updated_at:
10
.
seconds
.
ago
}]
timestamps
.
each_with_index
do
|
ts
,
i
|
create
issuable_type
,
{
title:
"
#{
issuable_type
}
_
#{
i
}
"
,
source_branch:
"
#{
issuable_type
}
_
#{
i
}
"
,
source_project:
project
}.
merge
(
ts
)
end
MergeRequest
.
all
end
context
'in the "merge requests" tab'
,
:js
do
let
(
:issuable_type
)
{
:merge_request
}
it
'is "last created"'
do
visit_merge_requests
project
expect
(
first_merge_request
).
to
include
(
last_created_issuable
.
title
)
expect
(
last_merge_request
).
to
include
(
first_created_issuable
.
title
)
end
end
context
'in the "merge requests / open" tab'
,
:js
do
let
(
:issuable_type
)
{
:merge_request
}
it
'is "created date"'
do
visit_merge_requests_with_state
(
project
,
'open'
)
expect
(
selected_sort_order
).
to
eq
(
'created date'
)
expect
(
first_merge_request
).
to
include
(
last_created_issuable
.
title
)
expect
(
last_merge_request
).
to
include
(
first_created_issuable
.
title
)
end
end
context
'in the "merge requests / merged" tab'
,
:js
do
let
(
:issuable_type
)
{
:merged_merge_request
}
it
'is "last updated"'
do
visit_merge_requests_with_state
(
project
,
'merged'
)
expect
(
find
(
'.issues-other-filters'
)).
to
have_content
(
'Last updated'
)
expect
(
first_merge_request
).
to
include
(
last_updated_issuable
.
title
)
expect
(
last_merge_request
).
to
include
(
first_updated_issuable
.
title
)
end
end
context
'in the "merge requests / closed" tab'
,
:js
do
let
(
:issuable_type
)
{
:closed_merge_request
}
it
'is "last updated"'
do
visit_merge_requests_with_state
(
project
,
'closed'
)
expect
(
find
(
'.issues-other-filters'
)).
to
have_content
(
'Last updated'
)
expect
(
first_merge_request
).
to
include
(
last_updated_issuable
.
title
)
expect
(
last_merge_request
).
to
include
(
first_updated_issuable
.
title
)
end
end
context
'in the "merge requests / all" tab'
,
:js
do
let
(
:issuable_type
)
{
:merge_request
}
it
'is "created date"'
do
visit_merge_requests_with_state
(
project
,
'all'
)
expect
(
find
(
'.issues-other-filters'
)).
to
have_content
(
'Created date'
)
expect
(
first_merge_request
).
to
include
(
last_created_issuable
.
title
)
expect
(
last_merge_request
).
to
include
(
first_created_issuable
.
title
)
end
end
end
context
'for issues'
do
include
IssueHelpers
let!
(
:issuables
)
do
timestamps
=
[{
created_at:
3
.
minutes
.
ago
,
updated_at:
20
.
seconds
.
ago
},
{
created_at:
2
.
minutes
.
ago
,
updated_at:
30
.
seconds
.
ago
},
{
created_at:
4
.
minutes
.
ago
,
updated_at:
10
.
seconds
.
ago
}]
timestamps
.
each_with_index
do
|
ts
,
i
|
create
issuable_type
,
{
title:
"
#{
issuable_type
}
_
#{
i
}
"
,
project:
project
}.
merge
(
ts
)
end
Issue
.
all
end
context
'in the "issues" tab'
,
:js
do
let
(
:issuable_type
)
{
:issue
}
it
'is "created date"'
do
visit_issues
project
expect
(
find
(
'.issues-other-filters'
)).
to
have_content
(
'Created date'
)
expect
(
first_issue
).
to
include
(
last_created_issuable
.
title
)
expect
(
last_issue
).
to
include
(
first_created_issuable
.
title
)
end
end
context
'in the "issues / open" tab'
,
:js
do
let
(
:issuable_type
)
{
:issue
}
it
'is "created date"'
do
visit_issues_with_state
(
project
,
'open'
)
expect
(
find
(
'.issues-other-filters'
)).
to
have_content
(
'Created date'
)
expect
(
first_issue
).
to
include
(
last_created_issuable
.
title
)
expect
(
last_issue
).
to
include
(
first_created_issuable
.
title
)
end
end
context
'in the "issues / closed" tab'
,
:js
do
let
(
:issuable_type
)
{
:closed_issue
}
it
'is "last updated"'
do
visit_issues_with_state
(
project
,
'closed'
)
expect
(
find
(
'.issues-other-filters'
)).
to
have_content
(
'Last updated'
)
expect
(
first_issue
).
to
include
(
last_updated_issuable
.
title
)
expect
(
last_issue
).
to
include
(
first_updated_issuable
.
title
)
end
end
context
'in the "issues / all" tab'
,
:js
do
let
(
:issuable_type
)
{
:issue
}
it
'is "created date"'
do
visit_issues_with_state
(
project
,
'all'
)
expect
(
find
(
'.issues-other-filters'
)).
to
have_content
(
'Created date'
)
expect
(
first_issue
).
to
include
(
last_created_issuable
.
title
)
expect
(
last_issue
).
to
include
(
first_created_issuable
.
title
)
end
end
context
'when the sort in the URL is id_desc'
do
let
(
:issuable_type
)
{
:issue
}
before
do
visit_issues
(
project
,
sort:
'id_desc'
)
end
it
'shows the sort order as created date'
do
expect
(
find
(
'.issues-other-filters'
)).
to
have_content
(
'Created date'
)
expect
(
first_issue
).
to
include
(
last_created_issuable
.
title
)
expect
(
last_issue
).
to
include
(
first_created_issuable
.
title
)
end
end
end
def
selected_sort_order
find
(
'.filter-dropdown-container .dropdown button'
).
text
.
downcase
end
def
visit_merge_requests_with_state
(
project
,
state
)
visit_merge_requests
project
,
state:
state
end
def
visit_issues_with_state
(
project
,
state
)
visit_issues
project
,
state:
state
end
end
spec/features/issuables/sorting_list_spec.rb
0 → 100644
View file @
3e2c3649
require
'spec_helper'
describe
'Sort Issuable List'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:first_created_issuable
)
{
issuables
.
order_created_asc
.
first
}
let
(
:last_created_issuable
)
{
issuables
.
order_created_desc
.
first
}
let
(
:first_updated_issuable
)
{
issuables
.
order_updated_asc
.
first
}
let
(
:last_updated_issuable
)
{
issuables
.
order_updated_desc
.
first
}
context
'for merge requests'
do
include
MergeRequestHelpers
let!
(
:issuables
)
do
timestamps
=
[{
created_at:
3
.
minutes
.
ago
,
updated_at:
20
.
seconds
.
ago
},
{
created_at:
2
.
minutes
.
ago
,
updated_at:
30
.
seconds
.
ago
},
{
created_at:
4
.
minutes
.
ago
,
updated_at:
10
.
seconds
.
ago
}]
timestamps
.
each_with_index
do
|
ts
,
i
|
create
issuable_type
,
{
title:
"
#{
issuable_type
}
_
#{
i
}
"
,
source_branch:
"
#{
issuable_type
}
_
#{
i
}
"
,
source_project:
project
}.
merge
(
ts
)
end
MergeRequest
.
all
end
context
'default sort order'
do
context
'in the "merge requests" tab'
,
:js
do
let
(
:issuable_type
)
{
:merge_request
}
it
'is "last created"'
do
visit_merge_requests
project
expect
(
first_merge_request
).
to
include
(
last_created_issuable
.
title
)
expect
(
last_merge_request
).
to
include
(
first_created_issuable
.
title
)
end
end
context
'in the "merge requests / open" tab'
,
:js
do
let
(
:issuable_type
)
{
:merge_request
}
it
'is "created date"'
do
visit_merge_requests_with_state
(
project
,
'open'
)
expect
(
selected_sort_order
).
to
eq
(
'created date'
)
expect
(
first_merge_request
).
to
include
(
last_created_issuable
.
title
)
expect
(
last_merge_request
).
to
include
(
first_created_issuable
.
title
)
end
end
context
'in the "merge requests / merged" tab'
,
:js
do
let
(
:issuable_type
)
{
:merged_merge_request
}
it
'is "last updated"'
do
visit_merge_requests_with_state
(
project
,
'merged'
)
expect
(
find
(
'.issues-other-filters'
)).
to
have_content
(
'Last updated'
)
expect
(
first_merge_request
).
to
include
(
last_updated_issuable
.
title
)
expect
(
last_merge_request
).
to
include
(
first_updated_issuable
.
title
)
end
end
context
'in the "merge requests / closed" tab'
,
:js
do
let
(
:issuable_type
)
{
:closed_merge_request
}
it
'is "last updated"'
do
visit_merge_requests_with_state
(
project
,
'closed'
)
expect
(
find
(
'.issues-other-filters'
)).
to
have_content
(
'Last updated'
)
expect
(
first_merge_request
).
to
include
(
last_updated_issuable
.
title
)
expect
(
last_merge_request
).
to
include
(
first_updated_issuable
.
title
)
end
end
context
'in the "merge requests / all" tab'
,
:js
do
let
(
:issuable_type
)
{
:merge_request
}
it
'is "created date"'
do
visit_merge_requests_with_state
(
project
,
'all'
)
expect
(
find
(
'.issues-other-filters'
)).
to
have_content
(
'Created date'
)
expect
(
first_merge_request
).
to
include
(
last_created_issuable
.
title
)
expect
(
last_merge_request
).
to
include
(
first_created_issuable
.
title
)
end
end
context
'custom sorting'
do
let
(
:issuable_type
)
{
:merge_request
}
it
'supports sorting in asc and desc order'
do
visit_merge_requests_with_state
(
project
,
'open'
)
page
.
within
(
'.issues-other-filters'
)
do
click_button
(
'Created date'
)
click_link
(
'Last updated'
)
end
expect
(
first_merge_request
).
to
include
(
last_updated_issuable
.
title
)
expect
(
last_merge_request
).
to
include
(
first_updated_issuable
.
title
)
find
(
'.issues-other-filters .filter-dropdown-container a[type=button]'
).
click
expect
(
first_merge_request
).
to
include
(
first_updated_issuable
.
title
)
expect
(
last_merge_request
).
to
include
(
last_updated_issuable
.
title
)
end
end
end
end
context
'for issues'
do
include
IssueHelpers
let!
(
:issuables
)
do
timestamps
=
[{
created_at:
3
.
minutes
.
ago
,
updated_at:
20
.
seconds
.
ago
},
{
created_at:
2
.
minutes
.
ago
,
updated_at:
30
.
seconds
.
ago
},
{
created_at:
4
.
minutes
.
ago
,
updated_at:
10
.
seconds
.
ago
}]
timestamps
.
each_with_index
do
|
ts
,
i
|
create
issuable_type
,
{
title:
"
#{
issuable_type
}
_
#{
i
}
"
,
project:
project
}.
merge
(
ts
)
end
Issue
.
all
end
context
'default sort order'
do
context
'in the "issues" tab'
,
:js
do
let
(
:issuable_type
)
{
:issue
}
it
'is "created date"'
do
visit_issues
project
expect
(
find
(
'.issues-other-filters'
)).
to
have_content
(
'Created date'
)
expect
(
first_issue
).
to
include
(
last_created_issuable
.
title
)
expect
(
last_issue
).
to
include
(
first_created_issuable
.
title
)
end
end
context
'in the "issues / open" tab'
,
:js
do
let
(
:issuable_type
)
{
:issue
}
it
'is "created date"'
do
visit_issues_with_state
(
project
,
'open'
)
expect
(
find
(
'.issues-other-filters'
)).
to
have_content
(
'Created date'
)
expect
(
first_issue
).
to
include
(
last_created_issuable
.
title
)
expect
(
last_issue
).
to
include
(
first_created_issuable
.
title
)
end
end
context
'in the "issues / closed" tab'
,
:js
do
let
(
:issuable_type
)
{
:closed_issue
}
it
'is "last updated"'
do
visit_issues_with_state
(
project
,
'closed'
)
expect
(
find
(
'.issues-other-filters'
)).
to
have_content
(
'Last updated'
)
expect
(
first_issue
).
to
include
(
last_updated_issuable
.
title
)
expect
(
last_issue
).
to
include
(
first_updated_issuable
.
title
)
end
end
context
'in the "issues / all" tab'
,
:js
do
let
(
:issuable_type
)
{
:issue
}
it
'is "created date"'
do
visit_issues_with_state
(
project
,
'all'
)
expect
(
find
(
'.issues-other-filters'
)).
to
have_content
(
'Created date'
)
expect
(
first_issue
).
to
include
(
last_created_issuable
.
title
)
expect
(
last_issue
).
to
include
(
first_created_issuable
.
title
)
end
end
context
'when the sort in the URL is id_desc'
do
let
(
:issuable_type
)
{
:issue
}
before
do
visit_issues
(
project
,
sort:
'id_desc'
)
end
it
'shows the sort order as created date'
do
expect
(
find
(
'.issues-other-filters'
)).
to
have_content
(
'Created date'
)
expect
(
first_issue
).
to
include
(
last_created_issuable
.
title
)
expect
(
last_issue
).
to
include
(
first_created_issuable
.
title
)
end
end
end
context
'custom sorting'
do
let
(
:issuable_type
)
{
:issue
}
it
'supports sorting in asc and desc order'
do
visit_issues_with_state
(
project
,
'open'
)
page
.
within
(
'.issues-other-filters'
)
do
click_button
(
'Created date'
)
click_link
(
'Last updated'
)
end
expect
(
first_issue
).
to
include
(
last_updated_issuable
.
title
)
expect
(
last_issue
).
to
include
(
first_updated_issuable
.
title
)
find
(
'.issues-other-filters .filter-dropdown-container a[type=button]'
).
click
expect
(
first_issue
).
to
include
(
first_updated_issuable
.
title
)
expect
(
last_issue
).
to
include
(
last_updated_issuable
.
title
)
end
end
end
def
selected_sort_order
find
(
'.filter-dropdown-container .dropdown button'
).
text
.
downcase
end
def
visit_merge_requests_with_state
(
project
,
state
)
visit_merge_requests
project
,
state:
state
end
def
visit_issues_with_state
(
project
,
state
)
visit_issues
project
,
state:
state
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