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
91f235df
Commit
91f235df
authored
Oct 29, 2018
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests
parent
ee4a7811
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
73 additions
and
183 deletions
+73
-183
app/assets/javascripts/search_autocomplete.js
app/assets/javascripts/search_autocomplete.js
+4
-5
app/controllers/dashboard_controller.rb
app/controllers/dashboard_controller.rb
+3
-0
app/controllers/root_controller.rb
app/controllers/root_controller.rb
+2
-2
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+2
-0
app/views/dashboard/issues.html.haml
app/views/dashboard/issues.html.haml
+1
-1
app/views/dashboard/merge_requests.html.haml
app/views/dashboard/merge_requests.html.haml
+1
-1
spec/controllers/root_controller_spec.rb
spec/controllers/root_controller_spec.rb
+2
-2
spec/features/atom/dashboard_issues_spec.rb
spec/features/atom/dashboard_issues_spec.rb
+6
-6
spec/features/dashboard/issuables_counter_spec.rb
spec/features/dashboard/issuables_counter_spec.rb
+2
-2
spec/features/dashboard/issues_filter_spec.rb
spec/features/dashboard/issues_filter_spec.rb
+9
-22
spec/features/dashboard/issues_spec.rb
spec/features/dashboard/issues_spec.rb
+6
-21
spec/features/dashboard/label_filter_spec.rb
spec/features/dashboard/label_filter_spec.rb
+9
-6
spec/features/dashboard/merge_requests_spec.rb
spec/features/dashboard/merge_requests_spec.rb
+7
-8
spec/features/dashboard/milestone_filter_spec.rb
spec/features/dashboard/milestone_filter_spec.rb
+0
-77
spec/features/issues/user_sorts_issues_spec.rb
spec/features/issues/user_sorts_issues_spec.rb
+1
-1
spec/features/merge_requests/user_sorts_merge_requests_spec.rb
...features/merge_requests/user_sorts_merge_requests_spec.rb
+2
-2
spec/features/search/user_uses_header_search_field_spec.rb
spec/features/search/user_uses_header_search_field_spec.rb
+12
-4
spec/javascripts/search_autocomplete_spec.js
spec/javascripts/search_autocomplete_spec.js
+4
-4
spec/support/helpers/filter_item_select_helper.rb
spec/support/helpers/filter_item_select_helper.rb
+0
-19
No files found.
app/assets/javascripts/search_autocomplete.js
View file @
91f235df
...
@@ -253,7 +253,6 @@ export class SearchAutocomplete {
...
@@ -253,7 +253,6 @@ export class SearchAutocomplete {
}
}
getCategoryContents
()
{
getCategoryContents
()
{
const
userId
=
gon
.
current_user_id
;
const
userName
=
gon
.
current_username
;
const
userName
=
gon
.
current_username
;
const
{
projectOptions
,
groupOptions
,
dashboardOptions
}
=
gl
;
const
{
projectOptions
,
groupOptions
,
dashboardOptions
}
=
gl
;
...
@@ -279,21 +278,21 @@ export class SearchAutocomplete {
...
@@ -279,21 +278,21 @@ export class SearchAutocomplete {
const
issueItems
=
[
const
issueItems
=
[
{
{
text
:
s__
(
'
SearchAutocomplete|Issues assigned to me
'
),
text
:
s__
(
'
SearchAutocomplete|Issues assigned to me
'
),
url
:
`
${
issuesPath
}
/?assignee_
id=
${
userId
}
`
,
url
:
`
${
issuesPath
}
/?assignee_
username=
${
userName
}
`
,
},
},
{
{
text
:
s__
(
"
SearchAutocomplete|Issues I've created
"
),
text
:
s__
(
"
SearchAutocomplete|Issues I've created
"
),
url
:
`
${
issuesPath
}
/?author_
id=
${
userId
}
`
,
url
:
`
${
issuesPath
}
/?author_
username=
${
userName
}
`
,
},
},
];
];
const
mergeRequestItems
=
[
const
mergeRequestItems
=
[
{
{
text
:
s__
(
'
SearchAutocomplete|Merge requests assigned to me
'
),
text
:
s__
(
'
SearchAutocomplete|Merge requests assigned to me
'
),
url
:
`
${
mrPath
}
/?assignee_
id=
${
userId
}
`
,
url
:
`
${
mrPath
}
/?assignee_
username=
${
userName
}
`
,
},
},
{
{
text
:
s__
(
"
SearchAutocomplete|Merge requests I've created
"
),
text
:
s__
(
"
SearchAutocomplete|Merge requests I've created
"
),
url
:
`
${
mrPath
}
/?author_
id=
${
userId
}
`
,
url
:
`
${
mrPath
}
/?author_
username=
${
userName
}
`
,
},
},
];
];
...
...
app/controllers/dashboard_controller.rb
View file @
91f235df
...
@@ -5,6 +5,9 @@ class DashboardController < Dashboard::ApplicationController
...
@@ -5,6 +5,9 @@ class DashboardController < Dashboard::ApplicationController
include
MergeRequestsAction
include
MergeRequestsAction
FILTER_PARAMS
=
[
FILTER_PARAMS
=
[
# author_id and assignee_id are kept so old RSS links still work
:author_id
,
:assignee_id
,
:author_username
,
:author_username
,
:assignee_username
,
:assignee_username
,
:milestone_title
,
:milestone_title
,
...
...
app/controllers/root_controller.rb
View file @
91f235df
...
@@ -45,9 +45,9 @@ class RootController < Dashboard::ProjectsController
...
@@ -45,9 +45,9 @@ class RootController < Dashboard::ProjectsController
when
'todos'
when
'todos'
redirect_to
(
dashboard_todos_path
)
redirect_to
(
dashboard_todos_path
)
when
'issues'
when
'issues'
redirect_to
(
issues_dashboard_path
(
assignee_
id:
current_user
.
id
))
redirect_to
(
issues_dashboard_path
(
assignee_
username:
current_user
.
username
))
when
'merge_requests'
when
'merge_requests'
redirect_to
(
merge_requests_dashboard_path
(
assignee_
id:
current_user
.
id
))
redirect_to
(
merge_requests_dashboard_path
(
assignee_
username:
current_user
.
username
))
end
end
end
end
...
...
app/helpers/application_helper.rb
View file @
91f235df
...
@@ -178,7 +178,9 @@ module ApplicationHelper
...
@@ -178,7 +178,9 @@ module ApplicationHelper
scope:
params
[
:scope
],
scope:
params
[
:scope
],
milestone_title:
params
[
:milestone_title
],
milestone_title:
params
[
:milestone_title
],
assignee_id:
params
[
:assignee_id
],
assignee_id:
params
[
:assignee_id
],
assignee_username:
params
[
:assignee_username
],
author_id:
params
[
:author_id
],
author_id:
params
[
:author_id
],
author_username:
params
[
:author_username
],
search:
params
[
:search
],
search:
params
[
:search
],
label_name:
params
[
:label_name
]
label_name:
params
[
:label_name
]
}
}
...
...
app/views/dashboard/issues.html.haml
View file @
91f235df
-
@hide_top_links
=
true
-
@hide_top_links
=
true
-
page_title
_
(
"Issues"
)
-
page_title
_
(
"Issues"
)
-
@breadcrumb_link
=
issues_dashboard_path
(
assignee_
id:
current_user
.
id
)
-
@breadcrumb_link
=
issues_dashboard_path
(
assignee_
username:
current_user
.
username
)
=
content_for
:meta_tags
do
=
content_for
:meta_tags
do
=
auto_discovery_link_tag
(
:atom
,
safe_params
.
merge
(
rss_url_options
).
to_h
,
title:
"
#{
current_user
.
name
}
issues"
)
=
auto_discovery_link_tag
(
:atom
,
safe_params
.
merge
(
rss_url_options
).
to_h
,
title:
"
#{
current_user
.
name
}
issues"
)
...
...
app/views/dashboard/merge_requests.html.haml
View file @
91f235df
-
@hide_top_links
=
true
-
@hide_top_links
=
true
-
page_title
_
(
"Merge Requests"
)
-
page_title
_
(
"Merge Requests"
)
-
@breadcrumb_link
=
merge_requests_dashboard_path
(
assignee_
id:
current_user
.
id
)
-
@breadcrumb_link
=
merge_requests_dashboard_path
(
assignee_
username:
current_user
.
username
)
.page-title-holder
.page-title-holder
%h1
.page-title
=
_
(
'Merge Requests'
)
%h1
.page-title
=
_
(
'Merge Requests'
)
...
...
spec/controllers/root_controller_spec.rb
View file @
91f235df
...
@@ -98,7 +98,7 @@ describe RootController do
...
@@ -98,7 +98,7 @@ describe RootController do
it
'redirects to their assigned issues'
do
it
'redirects to their assigned issues'
do
get
:index
get
:index
expect
(
response
).
to
redirect_to
issues_dashboard_path
(
assignee_
id:
user
.
id
)
expect
(
response
).
to
redirect_to
issues_dashboard_path
(
assignee_
username:
user
.
username
)
end
end
end
end
...
@@ -110,7 +110,7 @@ describe RootController do
...
@@ -110,7 +110,7 @@ describe RootController do
it
'redirects to their assigned merge requests'
do
it
'redirects to their assigned merge requests'
do
get
:index
get
:index
expect
(
response
).
to
redirect_to
merge_requests_dashboard_path
(
assignee_
id:
user
.
id
)
expect
(
response
).
to
redirect_to
merge_requests_dashboard_path
(
assignee_
username:
user
.
username
)
end
end
end
end
...
...
spec/features/atom/dashboard_issues_spec.rb
View file @
91f235df
...
@@ -25,35 +25,35 @@ describe "Dashboard Issues Feed" do
...
@@ -25,35 +25,35 @@ describe "Dashboard Issues Feed" do
it
"renders atom feed via personal access token"
do
it
"renders atom feed via personal access token"
do
personal_access_token
=
create
(
:personal_access_token
,
user:
user
)
personal_access_token
=
create
(
:personal_access_token
,
user:
user
)
visit
issues_dashboard_path
(
:atom
,
private_token:
personal_access_token
.
token
,
assignee_
id:
user
.
id
)
visit
issues_dashboard_path
(
:atom
,
private_token:
personal_access_token
.
token
,
assignee_
username:
user
.
username
)
expect
(
response_headers
[
'Content-Type'
]).
to
have_content
(
'application/atom+xml'
)
expect
(
response_headers
[
'Content-Type'
]).
to
have_content
(
'application/atom+xml'
)
expect
(
body
).
to
have_selector
(
'title'
,
text:
"
#{
user
.
name
}
issues"
)
expect
(
body
).
to
have_selector
(
'title'
,
text:
"
#{
user
.
name
}
issues"
)
end
end
it
"renders atom feed via feed token"
do
it
"renders atom feed via feed token"
do
visit
issues_dashboard_path
(
:atom
,
feed_token:
user
.
feed_token
,
assignee_
id:
user
.
id
)
visit
issues_dashboard_path
(
:atom
,
feed_token:
user
.
feed_token
,
assignee_
username:
user
.
username
)
expect
(
response_headers
[
'Content-Type'
]).
to
have_content
(
'application/atom+xml'
)
expect
(
response_headers
[
'Content-Type'
]).
to
have_content
(
'application/atom+xml'
)
expect
(
body
).
to
have_selector
(
'title'
,
text:
"
#{
user
.
name
}
issues"
)
expect
(
body
).
to
have_selector
(
'title'
,
text:
"
#{
user
.
name
}
issues"
)
end
end
it
"renders atom feed with url parameters"
do
it
"renders atom feed with url parameters"
do
visit
issues_dashboard_path
(
:atom
,
feed_token:
user
.
feed_token
,
state:
'opened'
,
assignee_
id:
user
.
id
)
visit
issues_dashboard_path
(
:atom
,
feed_token:
user
.
feed_token
,
state:
'opened'
,
assignee_
username:
user
.
username
)
link
=
find
(
'link[type="application/atom+xml"]'
)
link
=
find
(
'link[type="application/atom+xml"]'
)
params
=
CGI
.
parse
(
URI
.
parse
(
link
[
:href
]).
query
)
params
=
CGI
.
parse
(
URI
.
parse
(
link
[
:href
]).
query
)
expect
(
params
).
to
include
(
'feed_token'
=>
[
user
.
feed_token
])
expect
(
params
).
to
include
(
'feed_token'
=>
[
user
.
feed_token
])
expect
(
params
).
to
include
(
'state'
=>
[
'opened'
])
expect
(
params
).
to
include
(
'state'
=>
[
'opened'
])
expect
(
params
).
to
include
(
'assignee_
id'
=>
[
user
.
id
.
to_s
])
expect
(
params
).
to
include
(
'assignee_
username'
=>
[
user
.
username
.
to_s
])
end
end
context
"issue with basic fields"
do
context
"issue with basic fields"
do
let!
(
:issue2
)
{
create
(
:issue
,
author:
user
,
assignees:
[
assignee
],
project:
project2
,
description:
'test desc'
)
}
let!
(
:issue2
)
{
create
(
:issue
,
author:
user
,
assignees:
[
assignee
],
project:
project2
,
description:
'test desc'
)
}
it
"renders issue fields"
do
it
"renders issue fields"
do
visit
issues_dashboard_path
(
:atom
,
feed_token:
user
.
feed_token
,
assignee_
id:
assignee
.
id
)
visit
issues_dashboard_path
(
:atom
,
feed_token:
user
.
feed_token
,
assignee_
username:
assignee
.
username
)
entry
=
find
(
:xpath
,
"//feed/entry[contains(summary/text(),'
#{
issue2
.
title
}
')]"
)
entry
=
find
(
:xpath
,
"//feed/entry[contains(summary/text(),'
#{
issue2
.
title
}
')]"
)
...
@@ -76,7 +76,7 @@ describe "Dashboard Issues Feed" do
...
@@ -76,7 +76,7 @@ describe "Dashboard Issues Feed" do
end
end
it
"renders issue label and milestone info"
do
it
"renders issue label and milestone info"
do
visit
issues_dashboard_path
(
:atom
,
feed_token:
user
.
feed_token
,
assignee_
id:
assignee
.
id
)
visit
issues_dashboard_path
(
:atom
,
feed_token:
user
.
feed_token
,
assignee_
username:
assignee
.
username
)
entry
=
find
(
:xpath
,
"//feed/entry[contains(summary/text(),'
#{
issue1
.
title
}
')]"
)
entry
=
find
(
:xpath
,
"//feed/entry[contains(summary/text(),'
#{
issue1
.
title
}
')]"
)
...
...
spec/features/dashboard/issuables_counter_spec.rb
View file @
91f235df
...
@@ -45,11 +45,11 @@ describe 'Navigation bar counter', :use_clean_rails_memory_store_caching do
...
@@ -45,11 +45,11 @@ describe 'Navigation bar counter', :use_clean_rails_memory_store_caching do
end
end
def
issues_path
def
issues_path
issues_dashboard_path
(
assignee_
id:
user
.
id
)
issues_dashboard_path
(
assignee_
username:
user
.
username
)
end
end
def
merge_requests_path
def
merge_requests_path
merge_requests_dashboard_path
(
assignee_
id:
user
.
id
)
merge_requests_dashboard_path
(
assignee_
username:
user
.
username
)
end
end
def
expect_counters
(
issuable_type
,
count
)
def
expect_counters
(
issuable_type
,
count
)
...
...
spec/features/dashboard/issues_filter_spec.rb
View file @
91f235df
...
@@ -2,6 +2,7 @@ require 'spec_helper'
...
@@ -2,6 +2,7 @@ require 'spec_helper'
describe
'Dashboard Issues filtering'
,
:js
do
describe
'Dashboard Issues filtering'
,
:js
do
include
Spec
::
Support
::
Helpers
::
Features
::
SortingHelpers
include
Spec
::
Support
::
Helpers
::
Features
::
SortingHelpers
include
FilteredSearchHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
...
@@ -25,27 +26,21 @@ describe 'Dashboard Issues filtering', :js do
...
@@ -25,27 +26,21 @@ describe 'Dashboard Issues filtering', :js do
context
'filtering by milestone'
do
context
'filtering by milestone'
do
it
'shows all issues with no milestone'
do
it
'shows all issues with no milestone'
do
show_milestone_dropdown
input_filtered_search
(
"milestone:none"
)
click_link
'No Milestone'
expect
(
page
).
to
have_issuable_counts
(
open:
1
,
closed:
0
,
all:
1
)
expect
(
page
).
to
have_issuable_counts
(
open:
1
,
closed:
0
,
all:
1
)
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
1
)
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
1
)
end
end
it
'shows all issues with the selected milestone'
do
it
'shows all issues with the selected milestone'
do
show_milestone_dropdown
input_filtered_search
(
"milestone:%
\"
#{
milestone
.
title
}
\"
"
)
page
.
within
'.dropdown-content'
do
click_link
milestone
.
title
end
expect
(
page
).
to
have_issuable_counts
(
open:
1
,
closed:
0
,
all:
1
)
expect
(
page
).
to
have_issuable_counts
(
open:
1
,
closed:
0
,
all:
1
)
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
1
)
expect
(
page
).
to
have_selector
(
'.issue'
,
count:
1
)
end
end
it
'updates atom feed link'
do
it
'updates atom feed link'
do
visit_issues
(
milestone_title:
''
,
assignee_
id:
user
.
id
)
visit_issues
(
milestone_title:
''
,
assignee_
username:
user
.
username
)
link
=
find
(
'.nav-controls a[title="Subscribe to RSS feed"]'
)
link
=
find
(
'.nav-controls a[title="Subscribe to RSS feed"]'
)
params
=
CGI
.
parse
(
URI
.
parse
(
link
[
:href
]).
query
)
params
=
CGI
.
parse
(
URI
.
parse
(
link
[
:href
]).
query
)
...
@@ -54,10 +49,10 @@ describe 'Dashboard Issues filtering', :js do
...
@@ -54,10 +49,10 @@ describe 'Dashboard Issues filtering', :js do
expect
(
params
).
to
include
(
'feed_token'
=>
[
user
.
feed_token
])
expect
(
params
).
to
include
(
'feed_token'
=>
[
user
.
feed_token
])
expect
(
params
).
to
include
(
'milestone_title'
=>
[
''
])
expect
(
params
).
to
include
(
'milestone_title'
=>
[
''
])
expect
(
params
).
to
include
(
'assignee_
id'
=>
[
user
.
id
.
to_s
])
expect
(
params
).
to
include
(
'assignee_
username'
=>
[
user
.
username
.
to_s
])
expect
(
auto_discovery_params
).
to
include
(
'feed_token'
=>
[
user
.
feed_token
])
expect
(
auto_discovery_params
).
to
include
(
'feed_token'
=>
[
user
.
feed_token
])
expect
(
auto_discovery_params
).
to
include
(
'milestone_title'
=>
[
''
])
expect
(
auto_discovery_params
).
to
include
(
'milestone_title'
=>
[
''
])
expect
(
auto_discovery_params
).
to
include
(
'assignee_
id'
=>
[
user
.
id
.
to_s
])
expect
(
auto_discovery_params
).
to
include
(
'assignee_
username'
=>
[
user
.
username
.
to_s
])
end
end
end
end
...
@@ -66,10 +61,7 @@ describe 'Dashboard Issues filtering', :js do
...
@@ -66,10 +61,7 @@ describe 'Dashboard Issues filtering', :js do
let!
(
:label_link
)
{
create
(
:label_link
,
label:
label
,
target:
issue
)
}
let!
(
:label_link
)
{
create
(
:label_link
,
label:
label
,
target:
issue
)
}
it
'shows all issues with the selected label'
do
it
'shows all issues with the selected label'
do
page
.
within
'.labels-filter'
do
input_filtered_search
(
"label:~
#{
label
.
title
}
"
)
find
(
'.dropdown'
).
click
click_link
label
.
title
end
page
.
within
'ul.content-list'
do
page
.
within
'ul.content-list'
do
expect
(
page
).
to
have_content
issue
.
title
expect
(
page
).
to
have_content
issue
.
title
...
@@ -80,12 +72,12 @@ describe 'Dashboard Issues filtering', :js do
...
@@ -80,12 +72,12 @@ describe 'Dashboard Issues filtering', :js do
context
'sorting'
do
context
'sorting'
do
before
do
before
do
visit_issues
(
assignee_
id:
user
.
id
)
visit_issues
(
assignee_
username:
user
.
username
)
end
end
it
'remembers last sorting value'
do
it
'remembers last sorting value'
do
sort_by
(
'Created date'
)
sort_by
(
'Created date'
)
visit_issues
(
assignee_
id:
user
.
id
)
visit_issues
(
assignee_
username:
user
.
username
)
expect
(
find
(
'.issues-filters'
)).
to
have_content
(
'Created date'
)
expect
(
find
(
'.issues-filters'
)).
to
have_content
(
'Created date'
)
end
end
...
@@ -98,11 +90,6 @@ describe 'Dashboard Issues filtering', :js do
...
@@ -98,11 +90,6 @@ describe 'Dashboard Issues filtering', :js do
end
end
end
end
def
show_milestone_dropdown
click_button
'Milestone'
expect
(
page
).
to
have_selector
(
'.dropdown-content'
,
visible:
true
)
end
def
visit_issues
(
*
args
)
def
visit_issues
(
*
args
)
visit
issues_dashboard_path
(
*
args
)
visit
issues_dashboard_path
(
*
args
)
end
end
...
...
spec/features/dashboard/issues_spec.rb
View file @
91f235df
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
'Dashboard Issues'
do
RSpec
.
describe
'Dashboard Issues'
do
include
FilteredSearchHelpers
let
(
:current_user
)
{
create
:user
}
let
(
:current_user
)
{
create
:user
}
let
(
:user
)
{
current_user
}
# Shared examples depend on this being available
let
(
:user
)
{
current_user
}
# Shared examples depend on this being available
let!
(
:public_project
)
{
create
(
:project
,
:public
)
}
let!
(
:public_project
)
{
create
(
:project
,
:public
)
}
...
@@ -14,7 +16,7 @@ RSpec.describe 'Dashboard Issues' do
...
@@ -14,7 +16,7 @@ RSpec.describe 'Dashboard Issues' do
before
do
before
do
[
project
,
project_with_issues_disabled
].
each
{
|
project
|
project
.
add_maintainer
(
current_user
)
}
[
project
,
project_with_issues_disabled
].
each
{
|
project
|
project
.
add_maintainer
(
current_user
)
}
sign_in
(
current_user
)
sign_in
(
current_user
)
visit
issues_dashboard_path
(
assignee_
id:
current_user
.
id
)
visit
issues_dashboard_path
(
assignee_
username:
current_user
.
username
)
end
end
describe
'issues'
do
describe
'issues'
do
...
@@ -24,26 +26,9 @@ RSpec.describe 'Dashboard Issues' do
...
@@ -24,26 +26,9 @@ RSpec.describe 'Dashboard Issues' do
expect
(
page
).
not_to
have_content
(
other_issue
.
title
)
expect
(
page
).
not_to
have_content
(
other_issue
.
title
)
end
end
it
'shows checkmark when unassigned is selected for assignee'
,
:js
do
find
(
'.js-assignee-search'
).
click
find
(
'li'
,
text:
'Unassigned'
).
click
find
(
'.js-assignee-search'
).
click
expect
(
find
(
'li[data-user-id="0"] a.is-active'
)).
to
be_visible
end
it
'shows issues when current user is author'
,
:js
do
it
'shows issues when current user is author'
,
:js
do
execute_script
(
"document.querySelector('#assignee_id').value=''"
)
reset_filters
find
(
'.js-author-search'
,
match: :first
).
click
input_filtered_search
(
"author:
#{
current_user
.
to_reference
}
"
)
expect
(
find
(
'li[data-user-id="null"] a.is-active'
)).
to
be_visible
find
(
'.dropdown-menu-author li a'
,
match: :first
,
text:
current_user
.
to_reference
).
click
find
(
'.js-author-search'
,
match: :first
).
click
page
.
within
'.dropdown-menu-user'
do
expect
(
find
(
'.dropdown-menu-author li a.is-active'
,
match: :first
,
text:
current_user
.
to_reference
)).
to
be_visible
end
expect
(
page
).
to
have_content
(
authored_issue
.
title
)
expect
(
page
).
to
have_content
(
authored_issue
.
title
)
expect
(
page
).
to
have_content
(
authored_issue_on_public_project
.
title
)
expect
(
page
).
to
have_content
(
authored_issue_on_public_project
.
title
)
...
@@ -53,7 +38,7 @@ RSpec.describe 'Dashboard Issues' do
...
@@ -53,7 +38,7 @@ RSpec.describe 'Dashboard Issues' do
it
'state filter tabs work'
do
it
'state filter tabs work'
do
find
(
'#state-closed'
).
click
find
(
'#state-closed'
).
click
expect
(
page
).
to
have_current_path
(
issues_dashboard_url
(
assignee_
id:
current_user
.
id
,
state:
'closed'
),
url:
true
)
expect
(
page
).
to
have_current_path
(
issues_dashboard_url
(
assignee_
username:
current_user
.
username
,
state:
'closed'
),
url:
true
)
end
end
it_behaves_like
"it has an RSS button with current_user's feed token"
it_behaves_like
"it has an RSS button with current_user's feed token"
...
...
spec/features/dashboard/label_filter_spec.rb
View file @
91f235df
require
'spec_helper'
require
'spec_helper'
describe
'Dashboard > label filter'
,
:js
do
describe
'Dashboard > label filter'
,
:js
do
include
FilteredSearchHelpers
let
(
:filtered_search
)
{
find
(
'.filtered-search'
)
}
let
(
:filter_dropdown
)
{
find
(
"#js-dropdown-label .filter-dropdown"
)
}
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
)
}
let
(
:project2
)
{
create
(
:project
,
name:
'test2'
,
path:
'test2'
,
namespace:
user
.
namespace
)
}
let
(
:project2
)
{
create
(
:project
,
name:
'test2'
,
path:
'test2'
,
namespace:
user
.
namespace
)
}
...
@@ -13,17 +18,15 @@ describe 'Dashboard > label filter', :js do
...
@@ -13,17 +18,15 @@ describe 'Dashboard > label filter', :js do
sign_in
(
user
)
sign_in
(
user
)
visit
issues_dashboard_path
visit
issues_dashboard_path
init_label_search
end
end
context
'duplicate labels'
do
context
'duplicate labels'
do
it
'removes duplicate labels'
do
it
'removes duplicate labels'
do
page
.
within
(
'.labels-filter'
)
do
filtered_search
.
send_keys
(
'bu'
)
click_button
'Label'
end
page
.
within
(
'.dropdown-menu-labels'
)
do
expect
(
filter_dropdown
).
to
have_selector
(
'.filter-dropdown-item'
,
text:
'bug'
,
count:
1
)
expect
(
page
).
to
have_selector
(
'.dropdown-content a'
,
text:
'bug'
,
count:
1
)
end
end
end
end
end
end
end
spec/features/dashboard/merge_requests_spec.rb
View file @
91f235df
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
'Dashboard Merge Requests'
do
describe
'Dashboard Merge Requests'
do
include
Spec
::
Support
::
Helpers
::
Features
::
SortingHelpers
include
Spec
::
Support
::
Helpers
::
Features
::
SortingHelpers
include
Filter
ItemSelectHelper
include
Filter
edSearchHelpers
include
ProjectForksHelper
include
ProjectForksHelper
let
(
:current_user
)
{
create
:user
}
let
(
:current_user
)
{
create
:user
}
...
@@ -36,7 +36,7 @@ describe 'Dashboard Merge Requests' do
...
@@ -36,7 +36,7 @@ describe 'Dashboard Merge Requests' do
context
'no merge requests exist'
do
context
'no merge requests exist'
do
it
'shows an empty state'
do
it
'shows an empty state'
do
visit
merge_requests_dashboard_path
(
assignee_
id:
current_user
.
id
)
visit
merge_requests_dashboard_path
(
assignee_
username:
current_user
.
username
)
expect
(
page
).
to
have_selector
(
'.empty-state'
)
expect
(
page
).
to
have_selector
(
'.empty-state'
)
end
end
...
@@ -79,7 +79,7 @@ describe 'Dashboard Merge Requests' do
...
@@ -79,7 +79,7 @@ describe 'Dashboard Merge Requests' do
end
end
before
do
before
do
visit
merge_requests_dashboard_path
(
assignee_
id:
current_user
.
id
)
visit
merge_requests_dashboard_path
(
assignee_
username:
current_user
.
username
)
end
end
it
'shows assigned merge requests'
do
it
'shows assigned merge requests'
do
...
@@ -92,8 +92,8 @@ describe 'Dashboard Merge Requests' do
...
@@ -92,8 +92,8 @@ describe 'Dashboard Merge Requests' do
end
end
it
'shows authored merge requests'
,
:js
do
it
'shows authored merge requests'
,
:js
do
filter_item_select
(
'Any Assignee'
,
'.js-assignee-search'
)
reset_filters
filter_item_select
(
current_user
.
to_reference
,
'.js-author-search'
)
input_filtered_search
(
"author:
#{
current_user
.
to_reference
}
"
)
expect
(
page
).
to
have_content
(
authored_merge_request
.
title
)
expect
(
page
).
to
have_content
(
authored_merge_request
.
title
)
expect
(
page
).
to
have_content
(
authored_merge_request_from_fork
.
title
)
expect
(
page
).
to
have_content
(
authored_merge_request_from_fork
.
title
)
...
@@ -104,8 +104,7 @@ describe 'Dashboard Merge Requests' do
...
@@ -104,8 +104,7 @@ describe 'Dashboard Merge Requests' do
end
end
it
'shows error message without filter'
,
:js
do
it
'shows error message without filter'
,
:js
do
filter_item_select
(
'Any Assignee'
,
'.js-assignee-search'
)
reset_filters
filter_item_select
(
'Any Author'
,
'.js-author-search'
)
expect
(
page
).
to
have_content
(
'Please select at least one filter to see results'
)
expect
(
page
).
to
have_content
(
'Please select at least one filter to see results'
)
end
end
...
@@ -113,7 +112,7 @@ describe 'Dashboard Merge Requests' do
...
@@ -113,7 +112,7 @@ describe 'Dashboard Merge Requests' do
it
'shows sorted merge requests'
do
it
'shows sorted merge requests'
do
sort_by
(
'Created date'
)
sort_by
(
'Created date'
)
visit
merge_requests_dashboard_path
(
assignee_
id:
current_user
.
id
)
visit
merge_requests_dashboard_path
(
assignee_
username:
current_user
.
username
)
expect
(
find
(
'.issues-filters'
)).
to
have_content
(
'Created date'
)
expect
(
find
(
'.issues-filters'
)).
to
have_content
(
'Created date'
)
end
end
...
...
spec/features/dashboard/milestone_filter_spec.rb
deleted
100644 → 0
View file @
ee4a7811
require
'spec_helper'
describe
'Dashboard > milestone filter'
,
:js
do
include
FilterItemSelectHelper
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
name:
'test'
,
namespace:
user
.
namespace
)
}
let
(
:milestone
)
{
create
(
:milestone
,
title:
'v1.0'
,
project:
project
)
}
let
(
:milestone2
)
{
create
(
:milestone
,
title:
'v2.0'
,
project:
project
)
}
let!
(
:issue
)
{
create
:issue
,
author:
user
,
project:
project
,
milestone:
milestone
}
let!
(
:issue2
)
{
create
:issue
,
author:
user
,
project:
project
,
milestone:
milestone2
}
dropdown_toggle_button
=
'.js-milestone-select'
before
do
sign_in
(
user
)
end
context
'default state'
do
it
'shows issues with Any Milestone'
do
visit
issues_dashboard_path
(
author_id:
user
.
id
)
page
.
all
(
'.issue-info'
).
each
do
|
issue_info
|
expect
(
issue_info
.
text
).
to
match
(
/v\d.0/
)
end
end
end
context
'filtering by milestone'
do
before
do
visit
issues_dashboard_path
(
author_id:
user
.
id
)
filter_item_select
(
'v1.0'
,
dropdown_toggle_button
)
find
(
dropdown_toggle_button
).
click
wait_for_requests
end
it
'shows issues with Milestone v1.0'
do
expect
(
find
(
'.issues-list'
)).
to
have_selector
(
'.issue'
,
count:
1
)
expect
(
find
(
'.milestone-filter .dropdown-content'
)).
to
have_selector
(
'a.is-active'
,
count:
1
)
end
it
'should not change active Milestone unless clicked'
do
page
.
within
'.milestone-filter'
do
expect
(
find
(
'.dropdown-content'
)).
to
have_selector
(
'a.is-active'
,
count:
1
)
find
(
'.dropdown-menu-close'
).
click
expect
(
page
).
not_to
have_selector
(
'.dropdown.open'
)
find
(
dropdown_toggle_button
).
click
expect
(
find
(
'.dropdown-content'
)).
to
have_selector
(
'a.is-active'
,
count:
1
)
expect
(
find
(
'.dropdown-content a.is-active'
)).
to
have_content
(
'v1.0'
)
end
end
end
context
'with milestone filter in URL'
do
before
do
visit
issues_dashboard_path
(
author_id:
user
.
id
,
milestone_title:
milestone
.
title
)
find
(
dropdown_toggle_button
).
click
wait_for_requests
end
it
'has milestone selected'
do
expect
(
find
(
'.milestone-filter .dropdown-content'
)).
to
have_css
(
'.is-active'
,
text:
milestone
.
title
)
end
it
'removes milestone filter from URL after clicking "Any Milestone"'
do
expect
(
current_url
).
to
include
(
"milestone_title=
#{
milestone
.
title
}
"
)
find
(
'.milestone-filter .dropdown-content li'
,
text:
'Any Milestone'
).
click
expect
(
current_url
).
not_to
include
(
'milestone_title'
)
end
end
end
spec/features/issues/user_sorts_issues_spec.rb
View file @
91f235df
...
@@ -26,7 +26,7 @@ describe "User sorts issues" do
...
@@ -26,7 +26,7 @@ describe "User sorts issues" do
click_link
(
'Milestone'
)
click_link
(
'Milestone'
)
end
end
visit
(
issues_dashboard_path
(
assignee_
id:
user
.
id
))
visit
(
issues_dashboard_path
(
assignee_
username:
user
.
username
))
expect
(
find
(
'.issues-filters a.is-active'
)).
to
have_content
(
'Milestone'
)
expect
(
find
(
'.issues-filters a.is-active'
)).
to
have_content
(
'Milestone'
)
...
...
spec/features/merge_requests/user_sorts_merge_requests_spec.rb
View file @
91f235df
...
@@ -25,7 +25,7 @@ describe 'User sorts merge requests' do
...
@@ -25,7 +25,7 @@ describe 'User sorts merge requests' do
click_link
(
'Milestone'
)
click_link
(
'Milestone'
)
end
end
visit
(
merge_requests_dashboard_path
(
assignee_
id:
user
.
id
))
visit
(
merge_requests_dashboard_path
(
assignee_
username:
user
.
username
))
expect
(
find
(
'.issues-filters a.is-active'
)).
to
have_content
(
'Milestone'
)
expect
(
find
(
'.issues-filters a.is-active'
)).
to
have_content
(
'Milestone'
)
...
@@ -41,7 +41,7 @@ describe 'User sorts merge requests' do
...
@@ -41,7 +41,7 @@ describe 'User sorts merge requests' do
it
'fallbacks to issuable_sort cookie key when remembering the sorting option'
do
it
'fallbacks to issuable_sort cookie key when remembering the sorting option'
do
set_cookie
(
'issuable_sort'
,
'milestone'
)
set_cookie
(
'issuable_sort'
,
'milestone'
)
visit
(
merge_requests_dashboard_path
(
assignee_
id:
user
.
id
))
visit
(
merge_requests_dashboard_path
(
assignee_
username:
user
.
username
))
expect
(
find
(
'.issues-filters a.is-active'
)).
to
have_content
(
'Milestone'
)
expect
(
find
(
'.issues-filters a.is-active'
)).
to
have_content
(
'Milestone'
)
end
end
...
...
spec/features/search/user_uses_header_search_field_spec.rb
View file @
91f235df
...
@@ -21,13 +21,17 @@ describe 'User uses header search field' do
...
@@ -21,13 +21,17 @@ describe 'User uses header search field' do
it
'shows assigned issues'
do
it
'shows assigned issues'
do
find
(
'.search-input-container .dropdown-menu'
).
click_link
(
'Issues assigned to me'
)
find
(
'.search-input-container .dropdown-menu'
).
click_link
(
'Issues assigned to me'
)
expect
(
find
(
'.js-assignee-search'
)).
to
have_content
(
user
.
name
)
expect
(
page
).
to
have_selector
(
'.filtered-search'
)
expect_tokens
([
assignee_token
(
user
.
name
)])
expect_filtered_search_input_empty
end
end
it
'shows created issues'
do
it
'shows created issues'
do
find
(
'.search-input-container .dropdown-menu'
).
click_link
(
"Issues I've created"
)
find
(
'.search-input-container .dropdown-menu'
).
click_link
(
"Issues I've created"
)
expect
(
find
(
'.js-author-search'
)).
to
have_content
(
user
.
name
)
expect
(
page
).
to
have_selector
(
'.filtered-search'
)
expect_tokens
([
author_token
(
user
.
name
)])
expect_filtered_search_input_empty
end
end
end
end
...
@@ -37,13 +41,17 @@ describe 'User uses header search field' do
...
@@ -37,13 +41,17 @@ describe 'User uses header search field' do
it
'shows assigned merge requests'
do
it
'shows assigned merge requests'
do
find
(
'.search-input-container .dropdown-menu'
).
click_link
(
'Merge requests assigned to me'
)
find
(
'.search-input-container .dropdown-menu'
).
click_link
(
'Merge requests assigned to me'
)
expect
(
find
(
'.js-assignee-search'
)).
to
have_content
(
user
.
name
)
expect
(
page
).
to
have_selector
(
'.filtered-search'
)
expect_tokens
([
assignee_token
(
user
.
name
)])
expect_filtered_search_input_empty
end
end
it
'shows created merge requests'
do
it
'shows created merge requests'
do
find
(
'.search-input-container .dropdown-menu'
).
click_link
(
"Merge requests I've created"
)
find
(
'.search-input-container .dropdown-menu'
).
click_link
(
"Merge requests I've created"
)
expect
(
find
(
'.js-author-search'
)).
to
have_content
(
user
.
name
)
expect
(
page
).
to
have_selector
(
'.filtered-search'
)
expect_tokens
([
author_token
(
user
.
name
)])
expect_filtered_search_input_empty
end
end
end
end
end
end
...
...
spec/javascripts/search_autocomplete_spec.js
View file @
91f235df
...
@@ -109,16 +109,16 @@ describe('Search autocomplete dropdown', () => {
...
@@ -109,16 +109,16 @@ describe('Search autocomplete dropdown', () => {
assertLinks
=
function
(
list
,
issuesPath
,
mrsPath
)
{
assertLinks
=
function
(
list
,
issuesPath
,
mrsPath
)
{
if
(
issuesPath
)
{
if
(
issuesPath
)
{
const
issuesAssignedToMeLink
=
`a[href="
${
issuesPath
}
/?assignee_
id=
${
userId
}
"]`
;
const
issuesAssignedToMeLink
=
`a[href="
${
issuesPath
}
/?assignee_
username=
${
userName
}
"]`
;
const
issuesIHaveCreatedLink
=
`a[href="
${
issuesPath
}
/?author_
id=
${
userId
}
"]`
;
const
issuesIHaveCreatedLink
=
`a[href="
${
issuesPath
}
/?author_
username=
${
userName
}
"]`
;
expect
(
list
.
find
(
issuesAssignedToMeLink
).
length
).
toBe
(
1
);
expect
(
list
.
find
(
issuesAssignedToMeLink
).
length
).
toBe
(
1
);
expect
(
list
.
find
(
issuesAssignedToMeLink
).
text
()).
toBe
(
'
Issues assigned to me
'
);
expect
(
list
.
find
(
issuesAssignedToMeLink
).
text
()).
toBe
(
'
Issues assigned to me
'
);
expect
(
list
.
find
(
issuesIHaveCreatedLink
).
length
).
toBe
(
1
);
expect
(
list
.
find
(
issuesIHaveCreatedLink
).
length
).
toBe
(
1
);
expect
(
list
.
find
(
issuesIHaveCreatedLink
).
text
()).
toBe
(
"
Issues I've created
"
);
expect
(
list
.
find
(
issuesIHaveCreatedLink
).
text
()).
toBe
(
"
Issues I've created
"
);
}
}
const
mrsAssignedToMeLink
=
`a[href="
${
mrsPath
}
/?assignee_
id=
${
userId
}
"]`
;
const
mrsAssignedToMeLink
=
`a[href="
${
mrsPath
}
/?assignee_
username=
${
userName
}
"]`
;
const
mrsIHaveCreatedLink
=
`a[href="
${
mrsPath
}
/?author_
id=
${
userId
}
"]`
;
const
mrsIHaveCreatedLink
=
`a[href="
${
mrsPath
}
/?author_
username=
${
userName
}
"]`
;
expect
(
list
.
find
(
mrsAssignedToMeLink
).
length
).
toBe
(
1
);
expect
(
list
.
find
(
mrsAssignedToMeLink
).
length
).
toBe
(
1
);
expect
(
list
.
find
(
mrsAssignedToMeLink
).
text
()).
toBe
(
'
Merge requests assigned to me
'
);
expect
(
list
.
find
(
mrsAssignedToMeLink
).
text
()).
toBe
(
'
Merge requests assigned to me
'
);
...
...
spec/support/helpers/filter_item_select_helper.rb
deleted
100644 → 0
View file @
ee4a7811
# Helper allows you to select value from filter-items
#
# Params
# value - value for select
# selector - css selector of item
#
# Usage:
#
# filter_item_select('Any Author', '.js-author-search')
#
module
FilterItemSelectHelper
def
filter_item_select
(
value
,
selector
)
find
(
selector
).
click
wait_for_requests
page
.
within
(
'.dropdown-content'
)
do
click_link
value
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