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
deed7120
Commit
deed7120
authored
Dec 18, 2019
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete system tests that duplicate JS tests
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
f588407e
Changes
15
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
278 additions
and
1665 deletions
+278
-1665
ee/spec/features/issues/filtered_search/dropdown_weight_spec.rb
...c/features/issues/filtered_search/dropdown_weight_spec.rb
+3
-95
ee/spec/javascripts/filtered_search/issues_filtered_search_token_keys_spec.js
...filtered_search/issues_filtered_search_token_keys_spec.js
+1
-113
spec/features/issues/filtered_search/dropdown_assignee_spec.rb
...features/issues/filtered_search/dropdown_assignee_spec.rb
+2
-193
spec/features/issues/filtered_search/dropdown_author_spec.rb
spec/features/issues/filtered_search/dropdown_author_spec.rb
+7
-162
spec/features/issues/filtered_search/dropdown_base_spec.rb
spec/features/issues/filtered_search/dropdown_base_spec.rb
+58
-0
spec/features/issues/filtered_search/dropdown_emoji_spec.rb
spec/features/issues/filtered_search/dropdown_emoji_spec.rb
+5
-143
spec/features/issues/filtered_search/dropdown_hint_spec.rb
spec/features/issues/filtered_search/dropdown_hint_spec.rb
+2
-167
spec/features/issues/filtered_search/dropdown_label_spec.rb
spec/features/issues/filtered_search/dropdown_label_spec.rb
+3
-282
spec/features/issues/filtered_search/dropdown_milestone_spec.rb
...eatures/issues/filtered_search/dropdown_milestone_spec.rb
+3
-248
spec/features/issues/filtered_search/dropdown_release_spec.rb
.../features/issues/filtered_search/dropdown_release_spec.rb
+3
-25
spec/features/issues/filtered_search/filter_issues_spec.rb
spec/features/issues/filtered_search/filter_issues_spec.rb
+0
-52
spec/features/issues/filtered_search/visual_tokens_spec.rb
spec/features/issues/filtered_search/visual_tokens_spec.rb
+5
-183
spec/features/issues/rss_spec.rb
spec/features/issues/rss_spec.rb
+35
-2
spec/javascripts/filtered_search/issues_filtered_search_token_keys_spec.js
...filtered_search/issues_filtered_search_token_keys_spec.js
+147
-0
spec/support/helpers/filtered_search_helpers.rb
spec/support/helpers/filtered_search_helpers.rb
+4
-0
No files found.
ee/spec/features/issues/filtered_search/dropdown_weight_spec.rb
View file @
deed7120
...
...
@@ -9,22 +9,7 @@ describe 'Dropdown weight', :js do
let!
(
:user
)
{
create
(
:user
)
}
let
(
:filtered_search
)
{
find
(
'.filtered-search'
)
}
let
(
:js_dropdown_weight
)
{
'#js-dropdown-weight'
}
def
send_keys_to_filtered_search
(
input
)
input
.
split
(
""
).
each
do
|
i
|
filtered_search
.
send_keys
(
i
)
sleep
3
wait_for_requests
end
end
def
click_weight
(
text
)
find
(
'#js-dropdown-weight .filter-dropdown .filter-dropdown-item'
,
text:
text
,
exact_text:
true
).
click
end
def
click_static_weight
(
text
)
find
(
'#js-dropdown-weight .filter-dropdown-item'
,
text:
text
).
click
end
let
(
:filter_dropdown
)
{
find
(
"
#{
js_dropdown_weight
}
.filter-dropdown"
)
}
before
do
project
.
add_maintainer
(
user
)
...
...
@@ -35,87 +20,10 @@ describe 'Dropdown weight', :js do
end
describe
'behavior'
do
it
'opens when the search bar has weight:'
do
filtered_search
.
set
(
'weight:'
)
expect
(
page
).
to
have_css
(
js_dropdown_weight
,
visible:
true
)
end
it
'closes when the search bar is unfocused'
do
filtered_search
.
set
(
'weight:'
)
find
(
'body'
).
click
expect
(
page
).
to
have_css
(
js_dropdown_weight
,
visible:
false
)
end
it
'loads all the weights when opened'
do
send_keys_to_filtered_search
(
'weight:'
)
expect
(
page
.
all
(
'#js-dropdown-weight .filter-dropdown .filter-dropdown-item'
).
size
).
to
eq
(
21
)
end
end
describe
'selecting from dropdown'
do
before
do
input_filtered_search
(
'weight:'
,
submit:
false
)
end
it
'fills in weight 1'
do
click_weight
(
1
)
expect
(
page
).
to
have_css
(
js_dropdown_weight
,
visible:
false
)
expect_tokens
([{
name:
'Weight'
,
value:
'1'
}])
expect_filtered_search_input_empty
end
it
'fills in weight 2'
do
click_weight
(
2
)
expect
(
page
).
to
have_css
(
js_dropdown_weight
,
visible:
false
)
expect_tokens
([{
name:
'Weight'
,
value:
'2'
}])
expect_filtered_search_input_empty
end
it
'fills in weight 3'
do
click_weight
(
3
)
expect
(
page
).
to
have_css
(
js_dropdown_weight
,
visible:
false
)
expect_tokens
([{
name:
'Weight'
,
value:
'3'
}])
expect_filtered_search_input_empty
end
it
'fills in `no weight`'
do
click_static_weight
(
'None'
)
expect
(
page
).
to
have_css
(
js_dropdown_weight
,
visible:
false
)
expect_tokens
([{
name:
'Weight'
,
value:
'None'
}])
expect_filtered_search_input_empty
end
end
describe
'input has existing content'
do
it
'opens weight dropdown with existing search term'
do
filtered_search
.
set
(
'searchTerm weight:'
)
expect
(
page
).
to
have_css
(
js_dropdown_weight
,
visible:
true
)
end
it
'opens weight dropdown with existing assignee'
do
filtered_search
.
set
(
'assignee:@user weight:'
)
expect
(
page
).
to
have_css
(
js_dropdown_weight
,
visible:
true
)
end
it
'opens weight dropdown with existing label'
do
filtered_search
.
set
(
'label:~bug weight:'
)
expect
(
page
).
to
have_css
(
js_dropdown_weight
,
visible:
true
)
end
it
'opens weight dropdown with existing milestone'
do
filtered_search
.
set
(
'milestone:%v1.0 weight:'
)
input_filtered_search
(
'weight:'
,
submit:
false
,
extra_space:
false
)
expect
(
page
).
to
have_css
(
js_dropdown_weight
,
visible:
true
)
expect
_filtered_search_dropdown_results
(
filter_dropdown
,
21
)
end
end
end
ee/spec/javascripts/filtered_search/issues_filtered_search_token_keys_spec.js
View file @
deed7120
import
IssuableFilteredSearchTokenKeys
from
'
ee/filtered_search/issuable_filtered_search_token_keys
'
;
describe
(
'
Filtered Search Token Keys (Issues
EE)
'
,
()
=>
{
describe
(
'
Issues Filtered Search Token Keys (
EE)
'
,
()
=>
{
const
weightTokenKey
=
{
key
:
'
weight
'
,
type
:
'
string
'
,
...
...
@@ -18,26 +18,12 @@ describe('Filtered Search Token Keys (Issues EE)', () => {
tokenKeys
=
IssuableFilteredSearchTokenKeys
.
get
();
});
it
(
'
should return tokenKeys
'
,
()
=>
{
expect
(
tokenKeys
).
not
.
toBeNull
();
});
it
(
'
should return tokenKeys as an array
'
,
()
=>
{
expect
(
tokenKeys
instanceof
Array
).
toBe
(
true
);
});
it
(
'
should return weightTokenKey as part of tokenKeys
'
,
()
=>
{
const
match
=
tokenKeys
.
find
(
tk
=>
tk
.
key
===
weightTokenKey
.
key
);
expect
(
match
).
toEqual
(
weightTokenKey
);
});
it
(
'
should always return the same array
'
,
()
=>
{
const
tokenKeys2
=
IssuableFilteredSearchTokenKeys
.
get
();
expect
(
tokenKeys
).
toEqual
(
tokenKeys2
);
});
it
(
'
should return assignee as an array
'
,
()
=>
{
const
assignee
=
tokenKeys
.
find
(
tokenKey
=>
tokenKey
.
key
===
'
assignee
'
);
...
...
@@ -45,17 +31,6 @@ describe('Filtered Search Token Keys (Issues EE)', () => {
});
});
describe
(
'
getKeys
'
,
()
=>
{
it
(
'
should return keys
'
,
()
=>
{
const
getKeys
=
IssuableFilteredSearchTokenKeys
.
getKeys
();
const
keys
=
IssuableFilteredSearchTokenKeys
.
get
().
map
(
i
=>
i
.
key
);
keys
.
forEach
((
key
,
i
)
=>
{
expect
(
key
).
toEqual
(
getKeys
[
i
]);
});
});
});
describe
(
'
getConditions
'
,
()
=>
{
let
conditions
;
...
...
@@ -63,14 +38,6 @@ describe('Filtered Search Token Keys (Issues EE)', () => {
conditions
=
IssuableFilteredSearchTokenKeys
.
getConditions
();
});
it
(
'
should return conditions
'
,
()
=>
{
expect
(
conditions
).
not
.
toBeNull
();
});
it
(
'
should return conditions as an array
'
,
()
=>
{
expect
(
conditions
instanceof
Array
).
toBe
(
true
);
});
it
(
'
should return weightConditions as part of conditions
'
,
()
=>
{
const
weightConditions
=
conditions
.
filter
(
c
=>
c
.
tokenKey
===
'
weight
'
);
...
...
@@ -79,19 +46,6 @@ describe('Filtered Search Token Keys (Issues EE)', () => {
});
describe
(
'
searchByKey
'
,
()
=>
{
it
(
'
should return null when key not found
'
,
()
=>
{
const
tokenKey
=
IssuableFilteredSearchTokenKeys
.
searchByKey
(
'
notakey
'
);
expect
(
tokenKey
).
toBeNull
();
});
it
(
'
should return tokenKey when found by key
'
,
()
=>
{
const
tokenKeys
=
IssuableFilteredSearchTokenKeys
.
get
();
const
result
=
IssuableFilteredSearchTokenKeys
.
searchByKey
(
tokenKeys
[
0
].
key
);
expect
(
result
).
toEqual
(
tokenKeys
[
0
]);
});
it
(
'
should return weight tokenKey when found by weight key
'
,
()
=>
{
const
tokenKeys
=
IssuableFilteredSearchTokenKeys
.
get
();
const
match
=
tokenKeys
.
find
(
tk
=>
tk
.
key
===
weightTokenKey
.
key
);
...
...
@@ -102,19 +56,6 @@ describe('Filtered Search Token Keys (Issues EE)', () => {
});
describe
(
'
searchBySymbol
'
,
()
=>
{
it
(
'
should return null when symbol not found
'
,
()
=>
{
const
tokenKey
=
IssuableFilteredSearchTokenKeys
.
searchBySymbol
(
'
notasymbol
'
);
expect
(
tokenKey
).
toBeNull
();
});
it
(
'
should return tokenKey when found by symbol
'
,
()
=>
{
const
tokenKeys
=
IssuableFilteredSearchTokenKeys
.
get
();
const
result
=
IssuableFilteredSearchTokenKeys
.
searchBySymbol
(
tokenKeys
[
0
].
symbol
);
expect
(
result
).
toEqual
(
tokenKeys
[
0
]);
});
it
(
'
should return weight tokenKey when found by weight symbol
'
,
()
=>
{
const
tokenKeys
=
IssuableFilteredSearchTokenKeys
.
get
();
const
match
=
tokenKeys
.
find
(
tk
=>
tk
.
key
===
weightTokenKey
.
key
);
...
...
@@ -125,30 +66,6 @@ describe('Filtered Search Token Keys (Issues EE)', () => {
});
describe
(
'
searchByKeyParam
'
,
()
=>
{
it
(
'
should return null when key param not found
'
,
()
=>
{
const
tokenKey
=
IssuableFilteredSearchTokenKeys
.
searchByKeyParam
(
'
notakeyparam
'
);
expect
(
tokenKey
).
toBeNull
();
});
it
(
'
should return tokenKey when found by key param
'
,
()
=>
{
const
tokenKeys
=
IssuableFilteredSearchTokenKeys
.
get
();
const
result
=
IssuableFilteredSearchTokenKeys
.
searchByKeyParam
(
`
${
tokenKeys
[
0
].
key
}
_
${
tokenKeys
[
0
].
param
}
`
,
);
expect
(
result
).
toEqual
(
tokenKeys
[
0
]);
});
it
(
'
should return alternative tokenKey when found by key param
'
,
()
=>
{
const
tokenKeys
=
IssuableFilteredSearchTokenKeys
.
getAlternatives
();
const
result
=
IssuableFilteredSearchTokenKeys
.
searchByKeyParam
(
`
${
tokenKeys
[
0
].
key
}
_
${
tokenKeys
[
0
].
param
}
`
,
);
expect
(
result
).
toEqual
(
tokenKeys
[
0
]);
});
it
(
'
should return weight tokenKey when found by weight key param
'
,
()
=>
{
const
tokenKeys
=
IssuableFilteredSearchTokenKeys
.
get
();
const
match
=
tokenKeys
.
find
(
tk
=>
tk
.
key
===
weightTokenKey
.
key
);
...
...
@@ -159,19 +76,6 @@ describe('Filtered Search Token Keys (Issues EE)', () => {
});
describe
(
'
searchByConditionUrl
'
,
()
=>
{
it
(
'
should return null when condition url not found
'
,
()
=>
{
const
condition
=
IssuableFilteredSearchTokenKeys
.
searchByConditionUrl
(
null
);
expect
(
condition
).
toBeNull
();
});
it
(
'
should return condition when found by url
'
,
()
=>
{
const
conditions
=
IssuableFilteredSearchTokenKeys
.
getConditions
();
const
result
=
IssuableFilteredSearchTokenKeys
.
searchByConditionUrl
(
conditions
[
0
].
url
);
expect
(
result
).
toBe
(
conditions
[
0
]);
});
it
(
'
should return weight condition when found by weight url
'
,
()
=>
{
const
conditions
=
IssuableFilteredSearchTokenKeys
.
getConditions
();
const
weightConditions
=
conditions
.
filter
(
c
=>
c
.
tokenKey
===
'
weight
'
);
...
...
@@ -182,22 +86,6 @@ describe('Filtered Search Token Keys (Issues EE)', () => {
});
describe
(
'
searchByConditionKeyValue
'
,
()
=>
{
it
(
'
should return null when condition tokenKey and value not found
'
,
()
=>
{
const
condition
=
IssuableFilteredSearchTokenKeys
.
searchByConditionKeyValue
(
null
,
null
);
expect
(
condition
).
toBeNull
();
});
it
(
'
should return condition when found by tokenKey and value
'
,
()
=>
{
const
conditions
=
IssuableFilteredSearchTokenKeys
.
getConditions
();
const
result
=
IssuableFilteredSearchTokenKeys
.
searchByConditionKeyValue
(
conditions
[
0
].
tokenKey
,
conditions
[
0
].
value
,
);
expect
(
result
).
toEqual
(
conditions
[
0
]);
});
it
(
'
should return weight condition when found by weight tokenKey and value
'
,
()
=>
{
const
conditions
=
IssuableFilteredSearchTokenKeys
.
getConditions
();
const
weightConditions
=
conditions
.
filter
(
c
=>
c
.
tokenKey
===
'
weight
'
);
...
...
spec/features/issues/filtered_search/dropdown_assignee_spec.rb
View file @
deed7120
...
...
@@ -7,24 +7,11 @@ describe 'Dropdown assignee', :js do
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:user
)
{
create
(
:user
,
name:
'administrator'
,
username:
'root'
)
}
let!
(
:user_john
)
{
create
(
:user
,
name:
'John'
,
username:
'th0mas'
)
}
let!
(
:user_jacob
)
{
create
(
:user
,
name:
'Jacob'
,
username:
'otter32'
)
}
let
(
:filtered_search
)
{
find
(
'.filtered-search'
)
}
let
(
:js_dropdown_assignee
)
{
'#js-dropdown-assignee'
}
let
(
:filter_dropdown
)
{
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)
}
def
dropdown_assignee_size
filter_dropdown
.
all
(
'.filter-dropdown-item'
).
size
end
def
click_assignee
(
text
)
find
(
'#js-dropdown-assignee .filter-dropdown .filter-dropdown-item'
,
text:
text
).
click
end
before
do
project
.
add_maintainer
(
user
)
project
.
add_maintainer
(
user_john
)
project
.
add_maintainer
(
user_jacob
)
sign_in
(
user
)
create
(
:issue
,
project:
project
)
...
...
@@ -32,37 +19,10 @@ describe 'Dropdown assignee', :js do
end
describe
'behavior'
do
it
'opens when the search bar has assignee:'
do
input_filtered_search
(
'assignee:'
,
submit:
false
,
extra_space:
false
)
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
true
)
end
it
'closes when the search bar is unfocused'
do
find
(
'body'
).
click
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
false
)
end
it
'shows loading indicator when opened'
do
slow_requests
do
# We aren't using `input_filtered_search` because we want to see the loading indicator
filtered_search
.
set
(
'assignee:'
)
expect
(
page
).
to
have_css
(
'#js-dropdown-assignee .filter-dropdown-loading'
,
visible:
true
)
end
end
it
'hides loading indicator when loaded'
do
input_filtered_search
(
'assignee:'
,
submit:
false
,
extra_space:
false
)
expect
(
find
(
js_dropdown_assignee
)).
not_to
have_css
(
'.filter-dropdown-loading'
)
end
it
'loads all the assignees when opened'
do
input_filtered_search
(
'assignee:'
,
submit:
false
,
extra_space:
false
)
expect
(
dropdown_assignee_size
).
to
eq
(
4
)
expect
_filtered_search_dropdown_results
(
filter_dropdown
,
2
)
end
it
'shows current user at top of dropdown'
do
...
...
@@ -72,109 +32,6 @@ describe 'Dropdown assignee', :js do
end
end
describe
'filtering'
do
before
do
input_filtered_search
(
'assignee:'
,
submit:
false
,
extra_space:
false
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user_john
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user_jacob
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user
.
name
)
end
it
'filters by name'
do
input_filtered_search
(
'jac'
,
submit:
false
,
extra_space:
false
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user_jacob
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_no_content
(
user
.
name
)
end
it
'filters by case insensitive name'
do
input_filtered_search
(
'JAC'
,
submit:
false
,
extra_space:
false
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user_jacob
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_no_content
(
user
.
name
)
end
it
'filters by username with symbol'
do
input_filtered_search
(
'@ott'
,
submit:
false
,
extra_space:
false
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user_jacob
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_no_content
(
user_john
.
name
)
end
it
'filters by case insensitive username with symbol'
do
input_filtered_search
(
'@OTT'
,
submit:
false
,
extra_space:
false
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user_jacob
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_no_content
(
user_john
.
name
)
end
it
'filters by username without symbol'
do
input_filtered_search
(
'ott'
,
submit:
false
,
extra_space:
false
)
wait_for_requests
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user_jacob
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_no_content
(
user_john
.
name
)
end
it
'filters by case insensitive username without symbol'
do
input_filtered_search
(
'OTT'
,
submit:
false
,
extra_space:
false
)
wait_for_requests
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user_jacob
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_no_content
(
user_john
.
name
)
end
end
describe
'selecting from dropdown'
do
before
do
input_filtered_search
(
'assignee:'
,
submit:
false
,
extra_space:
false
)
end
it
'fills in the assignee username when the assignee has not been filtered'
do
click_assignee
(
user_jacob
.
name
)
wait_for_requests
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
false
)
expect_tokens
([
assignee_token
(
user_jacob
.
name
)])
expect_filtered_search_input_empty
end
it
'fills in the assignee username when the assignee has been filtered'
do
input_filtered_search
(
'roo'
,
submit:
false
,
extra_space:
false
)
click_assignee
(
user
.
name
)
wait_for_requests
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
false
)
expect_tokens
([
assignee_token
(
user
.
name
)])
expect_filtered_search_input_empty
end
it
'selects `None`'
do
find
(
'#js-dropdown-assignee .filter-dropdown-item'
,
text:
'None'
).
click
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
false
)
expect_tokens
([
assignee_token
(
'None'
)])
expect_filtered_search_input_empty
end
it
'selects `Any`'
do
find
(
'#js-dropdown-assignee .filter-dropdown-item'
,
text:
'Any'
).
click
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
false
)
expect_tokens
([
assignee_token
(
'Any'
)])
expect_filtered_search_input_empty
end
end
describe
'selecting from dropdown without Ajax call'
do
before
do
Gitlab
::
Testing
::
RequestBlockerMiddleware
.
block_requests!
...
...
@@ -186,59 +43,11 @@ describe 'Dropdown assignee', :js do
end
it
'selects current user'
do
find
(
'#js-dropdown-assignee .filter-dropdown-item'
,
text:
user
.
username
).
click
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown-item"
,
text:
user
.
username
).
click
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
false
)
expect_tokens
([
assignee_token
(
user
.
username
)])
expect_filtered_search_input_empty
end
end
describe
'input has existing content'
do
it
'opens assignee dropdown with existing search term'
do
input_filtered_search
(
'searchTerm assignee:'
,
submit:
false
,
extra_space:
false
)
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
true
)
end
it
'opens assignee dropdown with existing author'
do
input_filtered_search
(
'author:@user assignee:'
,
submit:
false
,
extra_space:
false
)
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
true
)
end
it
'opens assignee dropdown with existing label'
do
input_filtered_search
(
'label:~bug assignee:'
,
submit:
false
,
extra_space:
false
)
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
true
)
end
it
'opens assignee dropdown with existing milestone'
do
input_filtered_search
(
'milestone:%v1.0 assignee:'
,
submit:
false
,
extra_space:
false
)
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
true
)
end
it
'opens assignee dropdown with existing my-reaction'
do
input_filtered_search
(
'my-reaction:star assignee:'
,
submit:
false
,
extra_space:
false
)
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
true
)
end
end
describe
'caching requests'
do
it
'caches requests after the first load'
do
input_filtered_search
(
'assignee:'
,
submit:
false
,
extra_space:
false
)
initial_size
=
dropdown_assignee_size
expect
(
initial_size
).
to
be
>
0
new_user
=
create
(
:user
)
project
.
add_maintainer
(
new_user
)
find
(
'.filtered-search-box .clear-search'
).
click
input_filtered_search
(
'assignee:'
,
submit:
false
,
extra_space:
false
)
expect
(
dropdown_assignee_size
).
to
eq
(
initial_size
)
end
end
end
spec/features/issues/filtered_search/dropdown_author_spec.rb
View file @
deed7120
...
...
@@ -7,32 +7,11 @@ describe 'Dropdown author', :js do
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:user
)
{
create
(
:user
,
name:
'administrator'
,
username:
'root'
)
}
let!
(
:user_john
)
{
create
(
:user
,
name:
'John'
,
username:
'th0mas'
)
}
let!
(
:user_jacob
)
{
create
(
:user
,
name:
'Jacob'
,
username:
'ooter32'
)
}
let
(
:filtered_search
)
{
find
(
'.filtered-search'
)
}
let
(
:js_dropdown_author
)
{
'#js-dropdown-author'
}
def
send_keys_to_filtered_search
(
input
)
input
.
split
(
""
).
each
do
|
i
|
filtered_search
.
send_keys
(
i
)
end
sleep
0.5
wait_for_requests
end
def
dropdown_author_size
page
.
all
(
'#js-dropdown-author .filter-dropdown .filter-dropdown-item'
).
size
end
def
click_author
(
text
)
find
(
'#js-dropdown-author .filter-dropdown .filter-dropdown-item'
,
text:
text
).
click
end
let
(
:filter_dropdown
)
{
find
(
"
#{
js_dropdown_author
}
.filter-dropdown"
)
}
before
do
project
.
add_maintainer
(
user
)
project
.
add_maintainer
(
user_john
)
project
.
add_maintainer
(
user_jacob
)
sign_in
(
user
)
create
(
:issue
,
project:
project
)
...
...
@@ -40,113 +19,23 @@ describe 'Dropdown author', :js do
end
describe
'behavior'
do
it
'opens when the search bar has author:'
do
filtered_search
.
set
(
'author:'
)
expect
(
page
).
to
have_css
(
js_dropdown_author
,
visible:
true
)
end
it
'closes when the search bar is unfocused'
do
find
(
'body'
).
click
expect
(
page
).
to
have_css
(
js_dropdown_author
,
visible:
false
)
end
it
'shows loading indicator when opened'
do
slow_requests
do
filtered_search
.
set
(
'author:'
)
expect
(
page
).
to
have_css
(
'#js-dropdown-author .filter-dropdown-loading'
,
visible:
true
)
end
end
it
'hides loading indicator when loaded'
do
send_keys_to_filtered_search
(
'author:'
)
expect
(
page
).
not_to
have_css
(
'#js-dropdown-author .filter-dropdown-loading'
)
end
it
'loads all the authors when opened'
do
send_keys_to_filtered_search
(
'author:'
)
input_filtered_search
(
'author:'
,
submit:
false
,
extra_space:
false
)
expect
(
dropdown_author_size
).
to
eq
(
4
)
expect
_filtered_search_dropdown_results
(
filter_dropdown
,
2
)
end
it
'shows current user at top of dropdown'
do
send_keys_to_filtered_search
(
'author:'
)
expect
(
first
(
'#js-dropdown-author li'
)).
to
have_content
(
user
.
name
)
end
end
describe
'filtering'
do
before
do
filtered_search
.
set
(
'author'
)
send_keys_to_filtered_search
(
':'
)
end
it
'filters by name'
do
send_keys_to_filtered_search
(
'jac'
)
expect
(
dropdown_author_size
).
to
eq
(
1
)
end
it
'filters by case insensitive name'
do
send_keys_to_filtered_search
(
'Jac'
)
expect
(
dropdown_author_size
).
to
eq
(
1
)
end
it
'filters by username with symbol'
do
send_keys_to_filtered_search
(
'@oot'
)
expect
(
dropdown_author_size
).
to
eq
(
2
)
end
it
'filters by username without symbol'
do
send_keys_to_filtered_search
(
'oot'
)
input_filtered_search
(
'author:'
,
submit:
false
,
extra_space:
false
)
expect
(
dropdown_author_size
).
to
eq
(
2
)
end
it
'filters by case insensitive username without symbol'
do
send_keys_to_filtered_search
(
'OOT'
)
expect
(
dropdown_author_size
).
to
eq
(
2
)
end
end
describe
'selecting from dropdown'
do
before
do
filtered_search
.
set
(
'author'
)
send_keys_to_filtered_search
(
':'
)
end
it
'fills in the author username when the author has not been filtered'
do
click_author
(
user_jacob
.
name
)
wait_for_requests
expect
(
page
).
to
have_css
(
js_dropdown_author
,
visible:
false
)
expect_tokens
([
author_token
(
user_jacob
.
name
)])
expect_filtered_search_input_empty
end
it
'fills in the author username when the author has been filtered'
do
click_author
(
user
.
name
)
wait_for_requests
expect
(
page
).
to
have_css
(
js_dropdown_author
,
visible:
false
)
expect_tokens
([
author_token
(
user
.
name
)])
expect_filtered_search_input_empty
expect
(
filter_dropdown
.
first
(
'.filter-dropdown-item'
)).
to
have_content
(
user
.
name
)
end
end
describe
'selecting from dropdown without Ajax call'
do
before
do
Gitlab
::
Testing
::
RequestBlockerMiddleware
.
block_requests!
filtered_search
.
set
(
'author:'
)
input_filtered_search
(
'author:'
,
submit:
false
,
extra_space:
false
)
end
after
do
...
...
@@ -154,55 +43,11 @@ describe 'Dropdown author', :js do
end
it
'selects current user'
do
find
(
'#js-dropdown-author .filter-dropdown-item'
,
text:
user
.
username
).
click
find
(
"
#{
js_dropdown_author
}
.filter-dropdown-item"
,
text:
user
.
username
).
click
expect
(
page
).
to
have_css
(
js_dropdown_author
,
visible:
false
)
expect_tokens
([
author_token
(
user
.
username
)])
expect_filtered_search_input_empty
end
end
describe
'input has existing content'
do
it
'opens author dropdown with existing search term'
do
filtered_search
.
set
(
'searchTerm author:'
)
expect
(
page
).
to
have_css
(
js_dropdown_author
,
visible:
true
)
end
it
'opens author dropdown with existing assignee'
do
filtered_search
.
set
(
'assignee:@user author:'
)
expect
(
page
).
to
have_css
(
js_dropdown_author
,
visible:
true
)
end
it
'opens author dropdown with existing label'
do
filtered_search
.
set
(
'label:~bug author:'
)
expect
(
page
).
to
have_css
(
js_dropdown_author
,
visible:
true
)
end
it
'opens author dropdown with existing milestone'
do
filtered_search
.
set
(
'milestone:%v1.0 author:'
)
expect
(
page
).
to
have_css
(
js_dropdown_author
,
visible:
true
)
end
end
describe
'caching requests'
do
it
'caches requests after the first load'
do
filtered_search
.
set
(
'author'
)
send_keys_to_filtered_search
(
':'
)
initial_size
=
dropdown_author_size
expect
(
initial_size
).
to
be
>
0
new_user
=
create
(
:user
)
project
.
add_maintainer
(
new_user
)
find
(
'.filtered-search-box .clear-search'
).
click
filtered_search
.
set
(
'author'
)
send_keys_to_filtered_search
(
':'
)
expect
(
dropdown_author_size
).
to
eq
(
initial_size
)
end
end
end
spec/features/issues/filtered_search/dropdown_base_spec.rb
0 → 100644
View file @
deed7120
# frozen_string_literal: true
require
'spec_helper'
describe
'Dropdown base'
,
:js
do
include
FilteredSearchHelpers
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:user
)
{
create
(
:user
,
name:
'administrator'
,
username:
'root'
)
}
let
(
:filtered_search
)
{
find
(
'.filtered-search'
)
}
let
(
:js_dropdown_assignee
)
{
'#js-dropdown-assignee'
}
let
(
:filter_dropdown
)
{
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)
}
def
dropdown_assignee_size
filter_dropdown
.
all
(
'.filter-dropdown-item'
).
size
end
before
do
project
.
add_maintainer
(
user
)
sign_in
(
user
)
create
(
:issue
,
project:
project
)
visit
project_issues_path
(
project
)
end
describe
'behavior'
do
it
'shows loading indicator when opened'
do
slow_requests
do
# We aren't using `input_filtered_search` because we want to see the loading indicator
filtered_search
.
set
(
'assignee:'
)
expect
(
page
).
to
have_css
(
"
#{
js_dropdown_assignee
}
.filter-dropdown-loading"
,
visible:
true
)
end
end
it
'hides loading indicator when loaded'
do
input_filtered_search
(
'assignee:'
,
submit:
false
,
extra_space:
false
)
expect
(
find
(
js_dropdown_assignee
)).
not_to
have_css
(
'.filter-dropdown-loading'
)
end
end
describe
'caching requests'
do
it
'caches requests after the first load'
do
input_filtered_search
(
'assignee:'
,
submit:
false
,
extra_space:
false
)
initial_size
=
dropdown_assignee_size
expect
(
initial_size
).
to
be
>
0
new_user
=
create
(
:user
)
project
.
add_maintainer
(
new_user
)
find
(
'.filtered-search-box .clear-search'
).
click
input_filtered_search
(
'assignee:'
,
submit:
false
,
extra_space:
false
)
expect
(
dropdown_assignee_size
).
to
eq
(
initial_size
)
end
end
end
spec/features/issues/filtered_search/dropdown_emoji_spec.rb
View file @
deed7120
...
...
@@ -11,30 +11,13 @@ describe 'Dropdown emoji', :js do
let!
(
:award_emoji_star
)
{
create
(
:award_emoji
,
name:
'star'
,
user:
user
,
awardable:
issue
)
}
let
(
:filtered_search
)
{
find
(
'.filtered-search'
)
}
let
(
:js_dropdown_emoji
)
{
'#js-dropdown-my-reaction'
}
def
send_keys_to_filtered_search
(
input
)
input
.
split
(
""
).
each
do
|
i
|
filtered_search
.
send_keys
(
i
)
end
sleep
0.5
wait_for_requests
end
def
dropdown_emoji_size
all
(
'gl-emoji[data-name]'
).
size
end
def
click_emoji
(
text
)
find
(
'#js-dropdown-my-reaction .filter-dropdown .filter-dropdown-item'
,
text:
text
).
click
end
let
(
:filter_dropdown
)
{
find
(
"
#{
js_dropdown_emoji
}
.filter-dropdown"
)
}
before
do
project
.
add_maintainer
(
user
)
create_list
(
:award_emoji
,
2
,
user:
user
,
name:
'thumbsup'
)
create_list
(
:award_emoji
,
1
,
user:
user
,
name:
'thumbsdown'
)
create_list
(
:award_emoji
,
3
,
user:
user
,
name:
'star'
)
create_list
(
:award_emoji
,
1
,
user:
user
,
name:
'tea'
)
end
context
'when user not logged in'
do
...
...
@@ -65,137 +48,16 @@ describe 'Dropdown emoji', :js do
expect
(
page
).
to
have_css
(
js_dropdown_emoji
,
visible:
true
)
end
it
'closes when the search bar is unfocused'
do
find
(
'body'
).
click
expect
(
page
).
to
have_css
(
js_dropdown_emoji
,
visible:
false
)
end
it
'shows loading indicator when opened'
do
slow_requests
do
filtered_search
.
set
(
'my-reaction:'
)
expect
(
page
).
to
have_css
(
'#js-dropdown-my-reaction .filter-dropdown-loading'
,
visible:
true
)
end
end
it
'hides loading indicator when loaded'
do
send_keys_to_filtered_search
(
'my-reaction:'
)
expect
(
page
).
not_to
have_css
(
'#js-dropdown-my-reaction .filter-dropdown-loading'
)
end
it
'loads all the emojis when opened'
do
send_keys_to_filtered_search
(
'my-reaction:'
)
input_filtered_search
(
'my-reaction:'
,
submit:
false
,
extra_space:
false
)
expect
(
dropdown_emoji_size
).
to
eq
(
4
)
expect
_filtered_search_dropdown_results
(
filter_dropdown
,
3
)
end
it
'shows the most populated emoji at top of dropdown'
do
send_keys_to_filtered_search
(
'my-reaction:'
)
expect
(
first
(
'#js-dropdown-my-reaction .filter-dropdown li'
)).
to
have_content
(
award_emoji_star
.
name
)
end
end
describe
'filtering'
do
before
do
filtered_search
.
set
(
'my-reaction'
)
send_keys_to_filtered_search
(
':'
)
end
it
'filters by name'
do
send_keys_to_filtered_search
(
'up'
)
expect
(
dropdown_emoji_size
).
to
eq
(
1
)
end
it
'filters by case insensitive name'
do
send_keys_to_filtered_search
(
'Up'
)
expect
(
dropdown_emoji_size
).
to
eq
(
1
)
end
end
describe
'selecting from dropdown'
do
before
do
filtered_search
.
set
(
'my-reaction'
)
send_keys_to_filtered_search
(
':'
)
end
it
'selects `None`'
do
find
(
'#js-dropdown-my-reaction .filter-dropdown-item'
,
text:
'None'
).
click
expect
(
page
).
to
have_css
(
js_dropdown_emoji
,
visible:
false
)
expect_tokens
([
reaction_token
(
'None'
,
false
)])
expect_filtered_search_input_empty
end
it
'selects `Any`'
do
find
(
'#js-dropdown-my-reaction .filter-dropdown-item'
,
text:
'Any'
).
click
expect
(
page
).
to
have_css
(
js_dropdown_emoji
,
visible:
false
)
expect_tokens
([
reaction_token
(
'Any'
,
false
)])
expect_filtered_search_input_empty
end
it
'fills in the my-reaction name'
do
click_emoji
(
'thumbsup'
)
wait_for_requests
expect
(
page
).
to
have_css
(
js_dropdown_emoji
,
visible:
false
)
expect_tokens
([
reaction_token
(
'thumbsup'
)])
expect_filtered_search_input_empty
end
end
describe
'input has existing content'
do
it
'opens my-reaction dropdown with existing search term'
do
filtered_search
.
set
(
'searchTerm my-reaction:'
)
expect
(
page
).
to
have_css
(
js_dropdown_emoji
,
visible:
true
)
end
it
'opens my-reaction dropdown with existing assignee'
do
filtered_search
.
set
(
'assignee:@user my-reaction:'
)
expect
(
page
).
to
have_css
(
js_dropdown_emoji
,
visible:
true
)
end
it
'opens my-reaction dropdown with existing label'
do
filtered_search
.
set
(
'label:~bug my-reaction:'
)
expect
(
page
).
to
have_css
(
js_dropdown_emoji
,
visible:
true
)
end
it
'opens my-reaction dropdown with existing milestone'
do
filtered_search
.
set
(
'milestone:%v1.0 my-reaction:'
)
expect
(
page
).
to
have_css
(
js_dropdown_emoji
,
visible:
true
)
end
it
'opens my-reaction dropdown with existing my-reaction'
do
filtered_search
.
set
(
'my-reaction:star my-reaction:'
)
expect
(
page
).
to
have_css
(
js_dropdown_emoji
,
visible:
true
)
end
end
describe
'caching requests'
do
it
'caches requests after the first load'
do
filtered_search
.
set
(
'my-reaction'
)
send_keys_to_filtered_search
(
':'
)
initial_size
=
dropdown_emoji_size
expect
(
initial_size
).
to
be
>
0
create_list
(
:award_emoji
,
1
,
user:
user
,
name:
'smile'
)
find
(
'.filtered-search-box .clear-search'
).
click
filtered_search
.
set
(
'my-reaction'
)
send_keys_to_filtered_search
(
':'
)
input_filtered_search
(
'my-reaction:'
,
submit:
false
,
extra_space:
false
)
expect
(
dropdown_emoji_size
).
to
eq
(
initial_siz
e
)
expect
(
first
(
"
#{
js_dropdown_emoji
}
.filter-dropdown li"
)).
to
have_content
(
award_emoji_star
.
nam
e
)
end
end
end
...
...
spec/features/issues/filtered_search/dropdown_hint_spec.rb
View file @
deed7120
...
...
@@ -46,9 +46,7 @@ describe 'Dropdown hint', :js do
it
'opens when the search bar is first focused'
do
expect
(
page
).
to
have_css
(
js_dropdown_hint
,
visible:
true
)
end
it
'closes when the search bar is unfocused'
do
find
(
'body'
).
click
expect
(
page
).
to
have_css
(
js_dropdown_hint
,
visible:
false
)
...
...
@@ -77,73 +75,7 @@ describe 'Dropdown hint', :js do
filtered_search
.
click
end
it
'opens the author dropdown when you click on author'
do
click_hint
(
'author'
)
expect
(
page
).
to
have_css
(
js_dropdown_hint
,
visible:
false
)
expect
(
page
).
to
have_css
(
'#js-dropdown-author'
,
visible:
true
)
expect_tokens
([{
name:
'Author'
}])
expect_filtered_search_input_empty
end
it
'opens the assignee dropdown when you click on assignee'
do
click_hint
(
'assignee'
)
expect
(
page
).
to
have_css
(
js_dropdown_hint
,
visible:
false
)
expect
(
page
).
to
have_css
(
'#js-dropdown-assignee'
,
visible:
true
)
expect_tokens
([{
name:
'Assignee'
}])
expect_filtered_search_input_empty
end
it
'opens the milestone dropdown when you click on milestone'
do
click_hint
(
'milestone'
)
expect
(
page
).
to
have_css
(
js_dropdown_hint
,
visible:
false
)
expect
(
page
).
to
have_css
(
'#js-dropdown-milestone'
,
visible:
true
)
expect_tokens
([{
name:
'Milestone'
}])
expect_filtered_search_input_empty
end
it
'opens the release dropdown when you click on release'
do
click_hint
(
'release'
)
expect
(
page
).
to
have_css
(
js_dropdown_hint
,
visible:
false
)
expect
(
page
).
to
have_css
(
'#js-dropdown-release'
,
visible:
true
)
expect_tokens
([{
name:
'Release'
}])
expect_filtered_search_input_empty
end
it
'opens the label dropdown when you click on label'
do
click_hint
(
'label'
)
expect
(
page
).
to
have_css
(
js_dropdown_hint
,
visible:
false
)
expect
(
page
).
to
have_css
(
'#js-dropdown-label'
,
visible:
true
)
expect_tokens
([{
name:
'Label'
}])
expect_filtered_search_input_empty
end
it
'opens the emoji dropdown when you click on my-reaction'
do
click_hint
(
'my-reaction'
)
expect
(
page
).
to
have_css
(
js_dropdown_hint
,
visible:
false
)
expect
(
page
).
to
have_css
(
'#js-dropdown-my-reaction'
,
visible:
true
)
expect_tokens
([{
name:
'My-reaction'
}])
expect_filtered_search_input_empty
end
it
'opens the yes-no dropdown when you click on confidential'
do
click_hint
(
'confidential'
)
expect
(
page
).
to
have_css
(
js_dropdown_hint
,
visible:
false
)
expect
(
page
).
to
have_css
(
'#js-dropdown-confidential'
,
visible:
true
)
expect_tokens
([{
name:
'Confidential'
}])
expect_filtered_search_input_empty
end
end
describe
'selecting from dropdown with some input'
do
it
'opens the author dropdown when you click on author'
do
filtered_search
.
set
(
'auth'
)
it
'opens the token dropdown when you click on it'
do
click_hint
(
'author'
)
expect
(
page
).
to
have_css
(
js_dropdown_hint
,
visible:
false
)
...
...
@@ -151,50 +83,10 @@ describe 'Dropdown hint', :js do
expect_tokens
([{
name:
'Author'
}])
expect_filtered_search_input_empty
end
it
'opens the assignee dropdown when you click on assignee'
do
filtered_search
.
set
(
'assign'
)
click_hint
(
'assignee'
)
expect
(
page
).
to
have_css
(
js_dropdown_hint
,
visible:
false
)
expect
(
page
).
to
have_css
(
'#js-dropdown-assignee'
,
visible:
true
)
expect_tokens
([{
name:
'Assignee'
}])
expect_filtered_search_input_empty
end
it
'opens the milestone dropdown when you click on milestone'
do
filtered_search
.
set
(
'mile'
)
click_hint
(
'milestone'
)
expect
(
page
).
to
have_css
(
js_dropdown_hint
,
visible:
false
)
expect
(
page
).
to
have_css
(
'#js-dropdown-milestone'
,
visible:
true
)
expect_tokens
([{
name:
'Milestone'
}])
expect_filtered_search_input_empty
end
it
'opens the label dropdown when you click on label'
do
filtered_search
.
set
(
'lab'
)
click_hint
(
'label'
)
expect
(
page
).
to
have_css
(
js_dropdown_hint
,
visible:
false
)
expect
(
page
).
to
have_css
(
'#js-dropdown-label'
,
visible:
true
)
expect_tokens
([{
name:
'Label'
}])
expect_filtered_search_input_empty
end
it
'opens the emoji dropdown when you click on my-reaction'
do
filtered_search
.
set
(
'my'
)
click_hint
(
'my-reaction'
)
expect
(
page
).
to
have_css
(
js_dropdown_hint
,
visible:
false
)
expect
(
page
).
to
have_css
(
'#js-dropdown-my-reaction'
,
visible:
true
)
expect_tokens
([{
name:
'My-reaction'
}])
expect_filtered_search_input_empty
end
end
describe
'reselecting from dropdown'
do
it
'reuses existing
author
text'
do
it
'reuses existing
token
text'
do
filtered_search
.
send_keys
(
'author:'
)
filtered_search
.
send_keys
(
:backspace
)
filtered_search
.
send_keys
(
:backspace
)
...
...
@@ -203,63 +95,6 @@ describe 'Dropdown hint', :js do
expect_tokens
([{
name:
'Author'
}])
expect_filtered_search_input_empty
end
it
'reuses existing assignee text'
do
filtered_search
.
send_keys
(
'assignee:'
)
filtered_search
.
send_keys
(
:backspace
)
filtered_search
.
send_keys
(
:backspace
)
click_hint
(
'assignee'
)
expect_tokens
([{
name:
'Assignee'
}])
expect_filtered_search_input_empty
end
it
'reuses existing milestone text'
do
filtered_search
.
send_keys
(
'milestone:'
)
filtered_search
.
send_keys
(
:backspace
)
filtered_search
.
send_keys
(
:backspace
)
click_hint
(
'milestone'
)
expect_tokens
([{
name:
'Milestone'
}])
expect_filtered_search_input_empty
end
it
'reuses existing label text'
do
filtered_search
.
send_keys
(
'label:'
)
filtered_search
.
send_keys
(
:backspace
)
filtered_search
.
send_keys
(
:backspace
)
click_hint
(
'label'
)
expect_tokens
([{
name:
'Label'
}])
expect_filtered_search_input_empty
end
it
'reuses existing emoji text'
do
filtered_search
.
send_keys
(
'my-reaction:'
)
filtered_search
.
send_keys
(
:backspace
)
filtered_search
.
send_keys
(
:backspace
)
click_hint
(
'my-reaction'
)
expect_tokens
([{
name:
'My-reaction'
}])
expect_filtered_search_input_empty
end
end
end
context
'merge request page'
do
before
do
sign_in
(
user
)
visit
project_merge_requests_path
(
project
)
filtered_search
.
click
end
it
'shows the WIP menu item and opens the WIP options dropdown'
do
click_hint
(
'wip'
)
expect
(
page
).
to
have_css
(
js_dropdown_hint
,
visible:
false
)
expect
(
page
).
to
have_css
(
'#js-dropdown-wip'
,
visible:
true
)
expect_tokens
([{
name:
'WIP'
}])
expect_filtered_search_input_empty
end
end
end
spec/features/issues/filtered_search/dropdown_label_spec.rb
View file @
deed7120
This diff is collapsed.
Click to expand it.
spec/features/issues/filtered_search/dropdown_milestone_spec.rb
View file @
deed7120
...
...
@@ -9,26 +9,9 @@ describe 'Dropdown milestone', :js do
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:milestone
)
{
create
(
:milestone
,
title:
'v1.0'
,
project:
project
)
}
let!
(
:uppercase_milestone
)
{
create
(
:milestone
,
title:
'CAP_MILESTONE'
,
project:
project
)
}
let!
(
:two_words_milestone
)
{
create
(
:milestone
,
title:
'Future Plan'
,
project:
project
)
}
let!
(
:wont_fix_milestone
)
{
create
(
:milestone
,
title:
'Won"t Fix'
,
project:
project
)
}
let!
(
:special_milestone
)
{
create
(
:milestone
,
title:
'!@#$%^&*(+)'
,
project:
project
)
}
let!
(
:long_milestone
)
{
create
(
:milestone
,
title:
'this is a very long title this is a very long title this is a very long title this is a very long title this is a very long title'
,
project:
project
)
}
let
(
:filtered_search
)
{
find
(
'.filtered-search'
)
}
let
(
:js_dropdown_milestone
)
{
'#js-dropdown-milestone'
}
let
(
:filter_dropdown
)
{
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)
}
def
dropdown_milestone_size
filter_dropdown
.
all
(
'.filter-dropdown-item'
).
size
end
def
click_milestone
(
text
)
find
(
'#js-dropdown-milestone .filter-dropdown .filter-dropdown-item'
,
text:
text
).
click
end
def
click_static_milestone
(
text
)
find
(
'#js-dropdown-milestone .filter-dropdown-item'
,
text:
text
).
click
end
let
(
:filter_dropdown
)
{
find
(
'#js-dropdown-milestone .filter-dropdown'
)
}
before
do
project
.
add_maintainer
(
user
)
...
...
@@ -39,240 +22,12 @@ describe 'Dropdown milestone', :js do
end
describe
'behavior'
do
context
'filters by "milestone:"'
do
before
do
filtered_search
.
set
(
'milestone:'
)
end
it
'opens when the search bar has milestone:'
do
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
true
)
end
it
'closes when the search bar is unfocused'
do
find
(
'body'
).
click
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
end
it
'hides loading indicator when loaded'
do
expect
(
find
(
js_dropdown_milestone
)).
not_to
have_css
(
'.filter-dropdown-loading'
)
end
it
'loads all the milestones when opened'
do
expect
(
filter_dropdown
).
to
have_selector
(
'.filter-dropdown .filter-dropdown-item'
,
count:
6
)
end
end
it
'shows loading indicator when opened'
do
slow_requests
do
filtered_search
.
set
(
'milestone:'
)
expect
(
page
).
to
have_css
(
'#js-dropdown-milestone .filter-dropdown-loading'
,
visible:
true
)
end
end
end
describe
'filtering'
do
before
do
filtered_search
.
set
(
'milestone:'
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
milestone
.
title
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
uppercase_milestone
.
title
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
two_words_milestone
.
title
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
wont_fix_milestone
.
title
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
special_milestone
.
title
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
long_milestone
.
title
)
end
it
'filters by name'
do
filtered_search
.
send_keys
(
'v1'
)
expect
(
filter_dropdown
).
to
have_selector
(
'.filter-dropdown .filter-dropdown-item'
,
count:
1
)
end
it
'filters by case insensitive name'
do
filtered_search
.
send_keys
(
'V1'
)
expect
(
filter_dropdown
).
to
have_selector
(
'.filter-dropdown .filter-dropdown-item'
,
count:
1
)
end
it
'filters by name with symbol'
do
filtered_search
.
send_keys
(
'%v1'
)
expect
(
filter_dropdown
).
to
have_selector
(
'.filter-dropdown .filter-dropdown-item'
,
count:
1
)
end
it
'filters by case insensitive name with symbol'
do
filtered_search
.
send_keys
(
'%V1'
)
expect
(
filter_dropdown
).
to
have_selector
(
'.filter-dropdown .filter-dropdown-item'
,
count:
1
)
end
it
'filters by special characters'
do
filtered_search
.
send_keys
(
'(+'
)
expect
(
filter_dropdown
).
to
have_selector
(
'.filter-dropdown .filter-dropdown-item'
,
count:
1
)
end
it
'filters by special characters with symbol'
do
filtered_search
.
send_keys
(
'%(+'
)
expect
(
filter_dropdown
).
to
have_selector
(
'.filter-dropdown .filter-dropdown-item'
,
count:
1
)
end
end
describe
'selecting from dropdown'
do
before
do
filtered_search
.
set
(
'milestone:'
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
milestone
.
title
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
uppercase_milestone
.
title
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
two_words_milestone
.
title
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
wont_fix_milestone
.
title
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
special_milestone
.
title
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
long_milestone
.
title
)
end
it
'fills in the milestone name when the milestone has not been filled'
do
click_milestone
(
milestone
.
title
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
milestone_token
(
milestone
.
title
)])
expect_filtered_search_input_empty
end
it
'fills in the milestone name when the milestone is partially filled'
,
:quarantine
do
filtered_search
.
send_keys
(
'v'
)
click_milestone
(
milestone
.
title
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
milestone_token
(
milestone
.
title
)])
expect_filtered_search_input_empty
end
it
'fills in the milestone name that contains multiple words'
do
click_milestone
(
two_words_milestone
.
title
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
milestone_token
(
"
\"
#{
two_words_milestone
.
title
}
\"
"
)])
expect_filtered_search_input_empty
end
it
'fills in the milestone name that contains multiple words and is very long'
do
click_milestone
(
long_milestone
.
title
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
milestone_token
(
"
\"
#{
long_milestone
.
title
}
\"
"
)])
expect_filtered_search_input_empty
end
it
'fills in the milestone name that contains double quotes'
do
click_milestone
(
wont_fix_milestone
.
title
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
milestone_token
(
"'
#{
wont_fix_milestone
.
title
}
'"
)])
expect_filtered_search_input_empty
end
it
'fills in the milestone name with the correct capitalization'
do
click_milestone
(
uppercase_milestone
.
title
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
milestone_token
(
uppercase_milestone
.
title
)])
expect_filtered_search_input_empty
end
it
'fills in the milestone name with special characters'
do
click_milestone
(
special_milestone
.
title
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
milestone_token
(
special_milestone
.
title
)])
expect_filtered_search_input_empty
end
it
'selects `no milestone`'
do
click_static_milestone
(
'None'
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
milestone_token
(
'None'
,
false
)])
expect_filtered_search_input_empty
end
it
'selects `any milestone`'
do
click_static_milestone
(
'Any'
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
milestone_token
(
'Any'
,
false
)])
expect_filtered_search_input_empty
end
it
'selects `upcoming milestone`'
do
click_static_milestone
(
'Upcoming'
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
milestone_token
(
'Upcoming'
,
false
)])
expect_filtered_search_input_empty
end
it
'selects `started milestones`'
do
click_static_milestone
(
'Started'
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
milestone_token
(
'Started'
,
false
)])
expect_filtered_search_input_empty
end
end
describe
'input has existing content'
do
it
'opens milestone dropdown with existing search term'
do
filtered_search
.
set
(
'searchTerm milestone:'
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
true
)
end
it
'opens milestone dropdown with existing author'
do
filtered_search
.
set
(
'author:@john milestone:'
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
true
)
end
it
'opens milestone dropdown with existing assignee'
do
filtered_search
.
set
(
'assignee:@john milestone:'
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
true
)
end
it
'opens milestone dropdown with existing label'
do
filtered_search
.
set
(
'label:~important milestone:'
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
true
)
end
it
'opens milestone dropdown with existing milestone'
do
filtered_search
.
set
(
'milestone:%100 milestone:'
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
true
)
end
it
'opens milestone dropdown with existing my-reaction'
do
filtered_search
.
set
(
'my-reaction:star milestone:'
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
true
)
end
end
describe
'caching requests'
do
it
'caches requests after the first load'
do
filtered_search
.
set
(
'milestone:'
)
initial_size
=
dropdown_milestone_size
expect
(
initial_size
).
to
be
>
0
create
(
:milestone
,
project:
project
)
find
(
'.filtered-search-box .clear-search'
).
click
filtered_search
.
set
(
'milestone:'
)
expect
(
dropdown_milestone_size
).
to
eq
(
initial_size
)
expect_filtered_search_dropdown_results
(
filter_dropdown
,
2
)
end
end
end
spec/features/issues/filtered_search/dropdown_release_spec.rb
View file @
deed7120
...
...
@@ -10,13 +10,8 @@ describe 'Dropdown release', :js do
let!
(
:release
)
{
create
(
:release
,
tag:
'v1.0'
,
project:
project
)
}
let!
(
:crazy_release
)
{
create
(
:release
,
tag:
'☺!/"#%&\'{}+,-.<>;=@]_`{|}🚀'
,
project:
project
)
}
def
filtered_search
find
(
'.filtered-search'
)
end
def
filter_dropdown
find
(
'#js-dropdown-release .filter-dropdown'
)
end
let
(
:filtered_search
)
{
find
(
'.filtered-search'
)
}
let
(
:filter_dropdown
)
{
find
(
'#js-dropdown-release .filter-dropdown'
)
}
before
do
project
.
add_maintainer
(
user
)
...
...
@@ -31,25 +26,8 @@ describe 'Dropdown release', :js do
filtered_search
.
set
(
'release:'
)
end
def
expect_results
(
count
)
expect
(
filter_dropdown
).
to
have_selector
(
'.filter-dropdown .filter-dropdown-item'
,
count:
count
)
end
it
'loads all the releases when opened'
do
expect_results
(
2
)
end
it
'filters by tag name'
do
filtered_search
.
send_keys
(
"☺"
)
expect_results
(
1
)
end
it
'fills in the release name when the autocomplete hint is clicked'
do
find
(
'#js-dropdown-release .filter-dropdown-item'
,
text:
crazy_release
.
tag
).
click
expect
(
page
).
to
have_css
(
'#js-dropdown-release'
,
visible:
false
)
expect_tokens
([
release_token
(
crazy_release
.
tag
)])
expect_filtered_search_input_empty
expect_filtered_search_dropdown_results
(
filter_dropdown
,
2
)
end
end
end
spec/features/issues/filtered_search/filter_issues_spec.rb
View file @
deed7120
...
...
@@ -475,58 +475,6 @@ describe 'Filter issues', :js do
end
end
describe
'RSS feeds'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
before
do
group
.
add_developer
(
user
)
end
shared_examples
'updates atom feed link'
do
|
type
|
it
"for
#{
type
}
"
do
visit
path
link
=
find_link
(
'Subscribe to RSS feed'
)
params
=
CGI
.
parse
(
URI
.
parse
(
link
[
:href
]).
query
)
auto_discovery_link
=
find
(
'link[type="application/atom+xml"]'
,
visible:
false
)
auto_discovery_params
=
CGI
.
parse
(
URI
.
parse
(
auto_discovery_link
[
:href
]).
query
)
expected
=
{
'feed_token'
=>
[
user
.
feed_token
],
'milestone_title'
=>
[
milestone
.
title
],
'assignee_id'
=>
[
user
.
id
.
to_s
]
}
expect
(
params
).
to
include
(
expected
)
expect
(
auto_discovery_params
).
to
include
(
expected
)
end
end
it_behaves_like
'updates atom feed link'
,
:project
do
let
(
:path
)
{
project_issues_path
(
project
,
milestone_title:
milestone
.
title
,
assignee_id:
user
.
id
)
}
end
it_behaves_like
'updates atom feed link'
,
:group
do
let
(
:path
)
{
issues_group_path
(
group
,
milestone_title:
milestone
.
title
,
assignee_id:
user
.
id
)
}
end
it
'updates atom feed link for group issues'
do
visit
issues_group_path
(
group
,
milestone_title:
milestone
.
title
,
assignee_id:
user
.
id
)
link
=
find
(
'.nav-controls a[title="Subscribe to RSS feed"]'
,
visible:
false
)
params
=
CGI
.
parse
(
URI
.
parse
(
link
[
:href
]).
query
)
auto_discovery_link
=
find
(
'link[type="application/atom+xml"]'
,
visible:
false
)
auto_discovery_params
=
CGI
.
parse
(
URI
.
parse
(
auto_discovery_link
[
:href
]).
query
)
expect
(
params
).
to
include
(
'feed_token'
=>
[
user
.
feed_token
])
expect
(
params
).
to
include
(
'milestone_title'
=>
[
milestone
.
title
])
expect
(
params
).
to
include
(
'assignee_id'
=>
[
user
.
id
.
to_s
])
expect
(
auto_discovery_params
).
to
include
(
'feed_token'
=>
[
user
.
feed_token
])
expect
(
auto_discovery_params
).
to
include
(
'milestone_title'
=>
[
milestone
.
title
])
expect
(
auto_discovery_params
).
to
include
(
'assignee_id'
=>
[
user
.
id
.
to_s
])
end
end
context
'URL has a trailing slash'
do
before
do
visit
"
#{
project_issues_path
(
project
)
}
/"
...
...
spec/features/issues/filtered_search/visual_tokens_spec.rb
View file @
deed7120
...
...
@@ -34,7 +34,7 @@ describe 'Visual tokens', :js do
visit
project_issues_path
(
project
)
end
describe
'editing a
uthor
token'
do
describe
'editing a
single
token'
do
before
do
input_filtered_search
(
'author:@root assignee:none'
,
submit:
false
)
first
(
'.tokens-container .filtered-search-token'
).
click
...
...
@@ -42,9 +42,6 @@ describe 'Visual tokens', :js do
it
'opens author dropdown'
do
expect
(
page
).
to
have_css
(
'#js-dropdown-author'
,
visible:
true
)
end
it
'makes value editable'
do
expect_filtered_search_input
(
'@root'
)
end
...
...
@@ -77,139 +74,6 @@ describe 'Visual tokens', :js do
end
end
describe
'editing assignee token'
do
before
do
input_filtered_search
(
'assignee:@root author:none'
,
submit:
false
)
first
(
'.tokens-container .filtered-search-token'
).
double_click
end
it
'opens assignee dropdown'
do
expect
(
page
).
to
have_css
(
'#js-dropdown-assignee'
,
visible:
true
)
end
it
'makes value editable'
do
expect_filtered_search_input
(
'@root'
)
end
it
'filters value'
do
filtered_search
.
send_keys
(
:backspace
)
expect
(
page
).
to
have_css
(
'#js-dropdown-assignee .filter-dropdown .filter-dropdown-item'
,
count:
1
)
end
it
'ends editing mode when document is clicked'
do
find
(
'#content-body'
).
click
expect_filtered_search_input_empty
expect
(
page
).
to
have_css
(
'#js-dropdown-assignee'
,
visible:
false
)
end
describe
'selecting static option from dropdown'
do
before
do
find
(
"#js-dropdown-assignee"
).
find
(
'.filter-dropdown-item'
,
text:
'None'
).
click
end
it
'changes value in visual token'
do
expect
(
first
(
'.tokens-container .filtered-search-token .value'
).
text
).
to
eq
(
'None'
)
end
it
'moves input to the right'
do
expect
(
is_input_focused
).
to
eq
(
true
)
end
end
end
describe
'editing milestone token'
do
before
do
input_filtered_search
(
'milestone:%10.0 author:none'
,
submit:
false
)
first
(
'.tokens-container .filtered-search-token'
).
click
first
(
'#js-dropdown-milestone .filter-dropdown .filter-dropdown-item'
)
end
it
'opens milestone dropdown'
do
expect
(
filter_milestone_dropdown
.
find
(
'.filter-dropdown-item'
,
text:
milestone_ten
.
title
)).
to
be_visible
expect
(
filter_milestone_dropdown
.
find
(
'.filter-dropdown-item'
,
text:
milestone_nine
.
title
)).
to
be_visible
expect
(
page
).
to
have_css
(
'#js-dropdown-milestone'
,
visible:
true
)
end
it
'selects static option from dropdown'
do
find
(
"#js-dropdown-milestone"
).
find
(
'.filter-dropdown-item'
,
text:
'Upcoming'
).
click
expect
(
first
(
'.tokens-container .filtered-search-token .value'
).
text
).
to
eq
(
'Upcoming'
)
expect
(
is_input_focused
).
to
eq
(
true
)
end
it
'makes value editable'
do
expect_filtered_search_input
(
'%10.0'
)
end
it
'filters value'
do
filtered_search
.
send_keys
(
:backspace
)
expect
(
page
).
to
have_css
(
'#js-dropdown-milestone .filter-dropdown .filter-dropdown-item'
,
count:
1
)
end
it
'ends editing mode when document is clicked'
do
find
(
'#content-body'
).
click
expect_filtered_search_input_empty
expect
(
page
).
to
have_css
(
'#js-dropdown-milestone'
,
visible:
false
)
end
end
describe
'editing label token'
do
before
do
input_filtered_search
(
"label:~
#{
label
.
title
}
author:none"
,
submit:
false
)
first
(
'.tokens-container .filtered-search-token'
).
double_click
first
(
'#js-dropdown-label .filter-dropdown .filter-dropdown-item'
)
end
it
'opens label dropdown'
do
expect
(
filter_label_dropdown
.
find
(
'.filter-dropdown-item'
,
text:
label
.
title
)).
to
be_visible
expect
(
filter_label_dropdown
.
find
(
'.filter-dropdown-item'
,
text:
cc_label
.
title
)).
to
be_visible
expect
(
page
).
to
have_css
(
'#js-dropdown-label'
,
visible:
true
)
end
it
'selects option from dropdown'
do
expect
(
filter_label_dropdown
.
find
(
'.filter-dropdown-item'
,
text:
label
.
title
)).
to
be_visible
expect
(
filter_label_dropdown
.
find
(
'.filter-dropdown-item'
,
text:
cc_label
.
title
)).
to
be_visible
find
(
"#js-dropdown-label"
).
find
(
'.filter-dropdown-item'
,
text:
cc_label
.
title
).
click
expect
(
first
(
'.tokens-container .filtered-search-token .value'
).
text
).
to
eq
(
"~
\"
#{
cc_label
.
title
}
\"
"
)
expect
(
is_input_focused
).
to
eq
(
true
)
end
it
'makes value editable'
do
expect_filtered_search_input
(
"~
#{
label
.
title
}
"
)
end
it
'filters value'
do
expect
(
filter_label_dropdown
.
find
(
'.filter-dropdown-item'
,
text:
label
.
title
)).
to
be_visible
expect
(
filter_label_dropdown
.
find
(
'.filter-dropdown-item'
,
text:
cc_label
.
title
)).
to
be_visible
filtered_search
.
send_keys
(
:backspace
)
filter_label_dropdown
.
find
(
'.filter-dropdown-item'
)
expect
(
page
.
all
(
'#js-dropdown-label .filter-dropdown .filter-dropdown-item'
).
size
).
to
eq
(
1
)
end
it
'ends editing mode when document is clicked'
do
find
(
'#content-body'
).
click
expect_filtered_search_input_empty
expect
(
page
).
to
have_css
(
'#js-dropdown-label'
,
visible:
false
)
end
it
'ends editing mode when scroll container is clicked'
do
find
(
'.scroll-container'
).
click
expect_filtered_search_input_empty
expect
(
page
).
to
have_css
(
'#js-dropdown-label'
,
visible:
false
)
end
end
describe
'editing multiple tokens'
do
before
do
input_filtered_search
(
'author:@root assignee:none'
,
submit:
false
)
...
...
@@ -232,10 +96,6 @@ describe 'Visual tokens', :js do
first
(
'.tokens-container .filtered-search-term'
).
double_click
end
it
'opens hint dropdown'
do
expect
(
page
).
to
have_css
(
'#js-dropdown-hint'
,
visible:
true
)
end
it
'opens author dropdown'
do
find
(
'#js-dropdown-hint .filter-dropdown .filter-dropdown-item'
,
text:
'author'
).
click
...
...
@@ -255,59 +115,21 @@ describe 'Visual tokens', :js do
expect
(
page
).
to
have_css
(
'#js-dropdown-hint'
,
visible:
true
)
end
it
'opens
author
dropdown'
do
it
'opens
token
dropdown'
do
filtered_search
.
send_keys
(
'author:'
)
expect
(
page
).
to
have_css
(
'#js-dropdown-author'
,
visible:
true
)
end
it
'opens assignee dropdown'
do
filtered_search
.
send_keys
(
'assignee:'
)
expect
(
page
).
to
have_css
(
'#js-dropdown-assignee'
,
visible:
true
)
end
it
'opens milestone dropdown'
do
filtered_search
.
send_keys
(
'milestone:'
)
expect
(
page
).
to
have_css
(
'#js-dropdown-milestone'
,
visible:
true
)
end
it
'opens label dropdown'
do
filtered_search
.
send_keys
(
'label:'
)
expect
(
page
).
to
have_css
(
'#js-dropdown-label'
,
visible:
true
)
expect
(
page
).
to
have_css
(
'#js-dropdown-author'
,
visible:
true
)
end
end
describe
'
creates
visual tokens'
do
it
'creates
author
token'
do
describe
'visual tokens'
do
it
'creates
visual
token'
do
filtered_search
.
send_keys
(
'author:@thomas '
)
token
=
page
.
all
(
'.tokens-container .filtered-search-token'
)[
1
]
expect
(
token
.
find
(
'.name'
).
text
).
to
eq
(
'Author'
)
expect
(
token
.
find
(
'.value'
).
text
).
to
eq
(
'@thomas'
)
end
it
'creates assignee token'
do
filtered_search
.
send_keys
(
'assignee:@thomas '
)
token
=
page
.
all
(
'.tokens-container .filtered-search-token'
)[
1
]
expect
(
token
.
find
(
'.name'
).
text
).
to
eq
(
'Assignee'
)
expect
(
token
.
find
(
'.value'
).
text
).
to
eq
(
'@thomas'
)
end
it
'creates milestone token'
do
filtered_search
.
send_keys
(
'milestone:none '
)
token
=
page
.
all
(
'.tokens-container .filtered-search-token'
)[
1
]
expect
(
token
.
find
(
'.name'
).
text
).
to
eq
(
'Milestone'
)
expect
(
token
.
find
(
'.value'
).
text
).
to
eq
(
'none'
)
end
it
'creates label token'
do
filtered_search
.
send_keys
(
'label:~Backend '
)
token
=
page
.
all
(
'.tokens-container .filtered-search-token'
)[
1
]
expect
(
token
.
find
(
'.name'
).
text
).
to
eq
(
'Label'
)
expect
(
token
.
find
(
'.value'
).
text
).
to
eq
(
'~Backend'
)
end
end
it
'does not tokenize incomplete token'
do
...
...
spec/features/issues/rss_spec.rb
View file @
deed7120
...
...
@@ -3,11 +3,14 @@
require
'spec_helper'
describe
'Project Issues RSS'
do
let
(
:project
)
{
create
(
:project
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
}
let!
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
group:
group
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
}
let
(
:path
)
{
project_issues_path
(
project
)
}
before
do
create
(
:issue
,
project:
project
)
create
(
:issue
,
project:
project
,
assignees:
[
user
])
group
.
add_developer
(
user
)
end
context
'when signed in'
do
...
...
@@ -31,4 +34,34 @@ describe 'Project Issues RSS' do
it_behaves_like
"it has an RSS button without a feed token"
it_behaves_like
"an autodiscoverable RSS feed without a feed token"
end
describe
'feeds'
do
shared_examples
'updates atom feed link'
do
|
type
|
it
"for
#{
type
}
"
do
sign_in
(
user
)
visit
path
link
=
find_link
(
'Subscribe to RSS feed'
)
params
=
CGI
.
parse
(
URI
.
parse
(
link
[
:href
]).
query
)
auto_discovery_link
=
find
(
'link[type="application/atom+xml"]'
,
visible:
false
)
auto_discovery_params
=
CGI
.
parse
(
URI
.
parse
(
auto_discovery_link
[
:href
]).
query
)
expected
=
{
'feed_token'
=>
[
user
.
feed_token
],
'assignee_id'
=>
[
user
.
id
.
to_s
]
}
expect
(
params
).
to
include
(
expected
)
expect
(
auto_discovery_params
).
to
include
(
expected
)
end
end
it_behaves_like
'updates atom feed link'
,
:project
do
let
(
:path
)
{
project_issues_path
(
project
,
assignee_id:
user
.
id
)
}
end
it_behaves_like
'updates atom feed link'
,
:group
do
let
(
:path
)
{
issues_group_path
(
group
,
assignee_id:
user
.
id
)
}
end
end
end
spec/javascripts/filtered_search/issues_filtered_search_token_keys_spec.js
0 → 100644
View file @
deed7120
import
IssuableFilteredSearchTokenKeys
from
'
~/filtered_search/issuable_filtered_search_token_keys
'
;
describe
(
'
Issues Filtered Search Token Keys
'
,
()
=>
{
describe
(
'
get
'
,
()
=>
{
let
tokenKeys
;
beforeEach
(()
=>
{
tokenKeys
=
IssuableFilteredSearchTokenKeys
.
get
();
});
it
(
'
should return tokenKeys
'
,
()
=>
{
expect
(
tokenKeys
).
not
.
toBeNull
();
});
it
(
'
should return tokenKeys as an array
'
,
()
=>
{
expect
(
tokenKeys
instanceof
Array
).
toBe
(
true
);
});
it
(
'
should always return the same array
'
,
()
=>
{
const
tokenKeys2
=
IssuableFilteredSearchTokenKeys
.
get
();
expect
(
tokenKeys
).
toEqual
(
tokenKeys2
);
});
it
(
'
should return assignee as a string
'
,
()
=>
{
const
assignee
=
tokenKeys
.
find
(
tokenKey
=>
tokenKey
.
key
===
'
assignee
'
);
expect
(
assignee
.
type
).
toEqual
(
'
string
'
);
});
});
describe
(
'
getKeys
'
,
()
=>
{
it
(
'
should return keys
'
,
()
=>
{
const
getKeys
=
IssuableFilteredSearchTokenKeys
.
getKeys
();
const
keys
=
IssuableFilteredSearchTokenKeys
.
get
().
map
(
i
=>
i
.
key
);
keys
.
forEach
((
key
,
i
)
=>
{
expect
(
key
).
toEqual
(
getKeys
[
i
]);
});
});
});
describe
(
'
getConditions
'
,
()
=>
{
let
conditions
;
beforeEach
(()
=>
{
conditions
=
IssuableFilteredSearchTokenKeys
.
getConditions
();
});
it
(
'
should return conditions
'
,
()
=>
{
expect
(
conditions
).
not
.
toBeNull
();
});
it
(
'
should return conditions as an array
'
,
()
=>
{
expect
(
conditions
instanceof
Array
).
toBe
(
true
);
});
});
describe
(
'
searchByKey
'
,
()
=>
{
it
(
'
should return null when key not found
'
,
()
=>
{
const
tokenKey
=
IssuableFilteredSearchTokenKeys
.
searchByKey
(
'
notakey
'
);
expect
(
tokenKey
).
toBeNull
();
});
it
(
'
should return tokenKey when found by key
'
,
()
=>
{
const
tokenKeys
=
IssuableFilteredSearchTokenKeys
.
get
();
const
result
=
IssuableFilteredSearchTokenKeys
.
searchByKey
(
tokenKeys
[
0
].
key
);
expect
(
result
).
toEqual
(
tokenKeys
[
0
]);
});
});
describe
(
'
searchBySymbol
'
,
()
=>
{
it
(
'
should return null when symbol not found
'
,
()
=>
{
const
tokenKey
=
IssuableFilteredSearchTokenKeys
.
searchBySymbol
(
'
notasymbol
'
);
expect
(
tokenKey
).
toBeNull
();
});
it
(
'
should return tokenKey when found by symbol
'
,
()
=>
{
const
tokenKeys
=
IssuableFilteredSearchTokenKeys
.
get
();
const
result
=
IssuableFilteredSearchTokenKeys
.
searchBySymbol
(
tokenKeys
[
0
].
symbol
);
expect
(
result
).
toEqual
(
tokenKeys
[
0
]);
});
});
describe
(
'
searchByKeyParam
'
,
()
=>
{
it
(
'
should return null when key param not found
'
,
()
=>
{
const
tokenKey
=
IssuableFilteredSearchTokenKeys
.
searchByKeyParam
(
'
notakeyparam
'
);
expect
(
tokenKey
).
toBeNull
();
});
it
(
'
should return tokenKey when found by key param
'
,
()
=>
{
const
tokenKeys
=
IssuableFilteredSearchTokenKeys
.
get
();
const
result
=
IssuableFilteredSearchTokenKeys
.
searchByKeyParam
(
`
${
tokenKeys
[
0
].
key
}
_
${
tokenKeys
[
0
].
param
}
`
,
);
expect
(
result
).
toEqual
(
tokenKeys
[
0
]);
});
it
(
'
should return alternative tokenKey when found by key param
'
,
()
=>
{
const
tokenKeys
=
IssuableFilteredSearchTokenKeys
.
getAlternatives
();
const
result
=
IssuableFilteredSearchTokenKeys
.
searchByKeyParam
(
`
${
tokenKeys
[
0
].
key
}
_
${
tokenKeys
[
0
].
param
}
`
,
);
expect
(
result
).
toEqual
(
tokenKeys
[
0
]);
});
});
describe
(
'
searchByConditionUrl
'
,
()
=>
{
it
(
'
should return null when condition url not found
'
,
()
=>
{
const
condition
=
IssuableFilteredSearchTokenKeys
.
searchByConditionUrl
(
null
);
expect
(
condition
).
toBeNull
();
});
it
(
'
should return condition when found by url
'
,
()
=>
{
const
conditions
=
IssuableFilteredSearchTokenKeys
.
getConditions
();
const
result
=
IssuableFilteredSearchTokenKeys
.
searchByConditionUrl
(
conditions
[
0
].
url
);
expect
(
result
).
toBe
(
conditions
[
0
]);
});
});
describe
(
'
searchByConditionKeyValue
'
,
()
=>
{
it
(
'
should return null when condition tokenKey and value not found
'
,
()
=>
{
const
condition
=
IssuableFilteredSearchTokenKeys
.
searchByConditionKeyValue
(
null
,
null
);
expect
(
condition
).
toBeNull
();
});
it
(
'
should return condition when found by tokenKey and value
'
,
()
=>
{
const
conditions
=
IssuableFilteredSearchTokenKeys
.
getConditions
();
const
result
=
IssuableFilteredSearchTokenKeys
.
searchByConditionKeyValue
(
conditions
[
0
].
tokenKey
,
conditions
[
0
].
value
,
);
expect
(
result
).
toEqual
(
conditions
[
0
]);
});
});
});
spec/support/helpers/filtered_search_helpers.rb
View file @
deed7120
...
...
@@ -37,6 +37,10 @@ module FilteredSearchHelpers
filtered_search
.
send_keys
(
:enter
)
end
def
expect_filtered_search_dropdown_results
(
filter_dropdown
,
count
)
expect
(
filter_dropdown
).
to
have_selector
(
'.filter-dropdown .filter-dropdown-item'
,
count:
count
)
end
def
expect_issues_list_count
(
open_count
,
closed_count
=
0
)
all_count
=
open_count
+
closed_count
...
...
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