Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
b84d6efa
Commit
b84d6efa
authored
Aug 16, 2017
by
Clement Ho
Committed by
Rémy Coutable
Aug 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change find to within for detecting bad search specs
parent
fcce6c31
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
209 additions
and
147 deletions
+209
-147
spec/features/issues/filtered_search/dropdown_assignee_spec.rb
...features/issues/filtered_search/dropdown_assignee_spec.rb
+8
-4
spec/features/issues/filtered_search/dropdown_author_spec.rb
spec/features/issues/filtered_search/dropdown_author_spec.rb
+7
-3
spec/features/issues/filtered_search/dropdown_label_spec.rb
spec/features/issues/filtered_search/dropdown_label_spec.rb
+9
-9
spec/features/issues/filtered_search/dropdown_milestone_spec.rb
...eatures/issues/filtered_search/dropdown_milestone_spec.rb
+10
-10
spec/features/issues/filtered_search/filter_issues_spec.rb
spec/features/issues/filtered_search/filter_issues_spec.rb
+110
-82
spec/features/issues/filtered_search/search_bar_spec.rb
spec/features/issues/filtered_search/search_bar_spec.rb
+1
-1
spec/features/issues/filtered_search/visual_tokens_spec.rb
spec/features/issues/filtered_search/visual_tokens_spec.rb
+2
-2
spec/features/merge_requests/filter_by_milestone_spec.rb
spec/features/merge_requests/filter_by_milestone_spec.rb
+1
-1
spec/features/merge_requests/filter_merge_requests_spec.rb
spec/features/merge_requests/filter_merge_requests_spec.rb
+33
-25
spec/features/search_spec.rb
spec/features/search_spec.rb
+4
-8
spec/support/filtered_search_helpers.rb
spec/support/filtered_search_helpers.rb
+24
-2
No files found.
spec/features/issues/filtered_search/dropdown_assignee_spec.rb
View file @
b84d6efa
...
...
@@ -134,8 +134,10 @@ describe 'Dropdown assignee', :js do
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
([
{
name:
'assignee'
,
value:
"@
#{
user_jacob
.
username
}
"
}
])
expect_tokens
([
assignee_token
(
user_jacob
.
name
)
])
expect_filtered_search_input_empty
end
...
...
@@ -143,8 +145,10 @@ describe 'Dropdown assignee', :js do
filtered_search
.
send_keys
(
'roo'
)
click_assignee
(
user
.
name
)
wait_for_requests
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
false
)
expect_tokens
([
{
name:
'assignee'
,
value:
"@
#{
user
.
username
}
"
}
])
expect_tokens
([
assignee_token
(
user
.
name
)
])
expect_filtered_search_input_empty
end
...
...
@@ -152,7 +156,7 @@ describe 'Dropdown assignee', :js do
find
(
'#js-dropdown-assignee .filter-dropdown-item'
,
text:
'No Assignee'
).
click
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
false
)
expect_tokens
([
{
name:
'assignee'
,
value:
'none'
}
])
expect_tokens
([
assignee_token
(
'none'
)
])
expect_filtered_search_input_empty
end
end
...
...
@@ -171,7 +175,7 @@ describe 'Dropdown assignee', :js do
find
(
'#js-dropdown-assignee .filter-dropdown-item'
,
text:
user
.
username
).
click
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
false
)
expect_tokens
([
{
name:
'assignee'
,
value:
user
.
username
}
])
expect_tokens
([
assignee_token
(
user
.
username
)
])
expect_filtered_search_input_empty
end
end
...
...
spec/features/issues/filtered_search/dropdown_author_spec.rb
View file @
b84d6efa
...
...
@@ -121,16 +121,20 @@ describe 'Dropdown author', js: true do
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
([
{
name:
'author'
,
value:
"@
#{
user_jacob
.
username
}
"
}
])
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
([
{
name:
'author'
,
value:
"@
#{
user
.
username
}
"
}
])
expect_tokens
([
author_token
(
user
.
name
)
])
expect_filtered_search_input_empty
end
end
...
...
@@ -149,7 +153,7 @@ describe 'Dropdown author', js: true do
find
(
'#js-dropdown-author .filter-dropdown-item'
,
text:
user
.
username
).
click
expect
(
page
).
to
have_css
(
js_dropdown_author
,
visible:
false
)
expect_tokens
([
{
name:
'author'
,
value:
user
.
username
}
])
expect_tokens
([
author_token
(
user
.
username
)
])
expect_filtered_search_input_empty
end
end
...
...
spec/features/issues/filtered_search/dropdown_label_spec.rb
View file @
b84d6efa
...
...
@@ -47,7 +47,7 @@ describe 'Dropdown label', js: true do
filtered_search
.
native
.
send_keys
(
:down
,
:down
,
:enter
)
expect_tokens
([
{
name:
'label'
,
value:
"~
#{
bug_label
.
title
}
"
}
])
expect_tokens
([
label_token
(
bug_label
.
title
)
])
expect_filtered_search_input_empty
end
end
...
...
@@ -178,7 +178,7 @@ describe 'Dropdown label', js: true do
click_label
(
bug_label
.
title
)
expect
(
page
).
not_to
have_css
(
js_dropdown_label
)
expect_tokens
([
{
name:
'label'
,
value:
"~
#{
bug_label
.
title
}
"
}
])
expect_tokens
([
label_token
(
bug_label
.
title
)
])
expect_filtered_search_input_empty
end
...
...
@@ -187,7 +187,7 @@ describe 'Dropdown label', js: true do
click_label
(
bug_label
.
title
)
expect
(
page
).
not_to
have_css
(
js_dropdown_label
)
expect_tokens
([
{
name:
'label'
,
value:
"~
#{
bug_label
.
title
}
"
}
])
expect_tokens
([
label_token
(
bug_label
.
title
)
])
expect_filtered_search_input_empty
end
...
...
@@ -195,7 +195,7 @@ describe 'Dropdown label', js: true do
click_label
(
two_words_label
.
title
)
expect
(
page
).
not_to
have_css
(
js_dropdown_label
)
expect_tokens
([
{
name:
'label'
,
value:
"
\"
#{
two_words_label
.
title
}
\"
"
}
])
expect_tokens
([
label_token
(
"
\"
#{
two_words_label
.
title
}
\"
"
)
])
expect_filtered_search_input_empty
end
...
...
@@ -203,7 +203,7 @@ describe 'Dropdown label', js: true do
click_label
(
long_label
.
title
)
expect
(
page
).
not_to
have_css
(
js_dropdown_label
)
expect_tokens
([
{
name:
'label'
,
value:
"
\"
#{
long_label
.
title
}
\"
"
}
])
expect_tokens
([
label_token
(
"
\"
#{
long_label
.
title
}
\"
"
)
])
expect_filtered_search_input_empty
end
...
...
@@ -211,7 +211,7 @@ describe 'Dropdown label', js: true do
click_label
(
wont_fix_label
.
title
)
expect
(
page
).
not_to
have_css
(
js_dropdown_label
)
expect_tokens
([
{
name:
'label'
,
value:
"~'
#{
wont_fix_label
.
title
}
'"
}
])
expect_tokens
([
label_token
(
"'
#{
wont_fix_label
.
title
}
'"
)
])
expect_filtered_search_input_empty
end
...
...
@@ -219,7 +219,7 @@ describe 'Dropdown label', js: true do
click_label
(
uppercase_label
.
title
)
expect
(
page
).
not_to
have_css
(
js_dropdown_label
)
expect_tokens
([
{
name:
'label'
,
value:
"~
#{
uppercase_label
.
title
}
"
}
])
expect_tokens
([
label_token
(
uppercase_label
.
title
)
])
expect_filtered_search_input_empty
end
...
...
@@ -227,7 +227,7 @@ describe 'Dropdown label', js: true do
click_label
(
special_label
.
title
)
expect
(
page
).
not_to
have_css
(
js_dropdown_label
)
expect_tokens
([
{
name:
'label'
,
value:
"~
#{
special_label
.
title
}
"
}
])
expect_tokens
([
label_token
(
special_label
.
title
)
])
expect_filtered_search_input_empty
end
...
...
@@ -235,7 +235,7 @@ describe 'Dropdown label', js: true do
find
(
"
#{
js_dropdown_label
}
.filter-dropdown-item"
,
text:
'No Label'
).
click
expect
(
page
).
not_to
have_css
(
js_dropdown_label
)
expect_tokens
([
{
name:
'label'
,
value:
'none'
}
])
expect_tokens
([
label_token
(
'none'
,
false
)
])
expect_filtered_search_input_empty
end
end
...
...
spec/features/issues/filtered_search/dropdown_milestone_spec.rb
View file @
b84d6efa
...
...
@@ -134,7 +134,7 @@ describe 'Dropdown milestone', :js do
click_milestone
(
milestone
.
title
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
{
name:
'milestone'
,
value:
"%
#{
milestone
.
title
}
"
}
])
expect_tokens
([
milestone_token
(
milestone
.
title
)
])
expect_filtered_search_input_empty
end
...
...
@@ -143,7 +143,7 @@ describe 'Dropdown milestone', :js do
click_milestone
(
milestone
.
title
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
{
name:
'milestone'
,
value:
"%
#{
milestone
.
title
}
"
}
])
expect_tokens
([
milestone_token
(
milestone
.
title
)
])
expect_filtered_search_input_empty
end
...
...
@@ -151,7 +151,7 @@ describe 'Dropdown milestone', :js do
click_milestone
(
two_words_milestone
.
title
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
{
name:
'milestone'
,
value:
"%
\"
#{
two_words_milestone
.
title
}
\"
"
}
])
expect_tokens
([
milestone_token
(
"
\"
#{
two_words_milestone
.
title
}
\"
"
)
])
expect_filtered_search_input_empty
end
...
...
@@ -159,7 +159,7 @@ describe 'Dropdown milestone', :js do
click_milestone
(
long_milestone
.
title
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
{
name:
'milestone'
,
value:
"%
\"
#{
long_milestone
.
title
}
\"
"
}
])
expect_tokens
([
milestone_token
(
"
\"
#{
long_milestone
.
title
}
\"
"
)
])
expect_filtered_search_input_empty
end
...
...
@@ -167,7 +167,7 @@ describe 'Dropdown milestone', :js do
click_milestone
(
wont_fix_milestone
.
title
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
{
name:
'milestone'
,
value:
"%'
#{
wont_fix_milestone
.
title
}
'"
}
])
expect_tokens
([
milestone_token
(
"'
#{
wont_fix_milestone
.
title
}
'"
)
])
expect_filtered_search_input_empty
end
...
...
@@ -175,7 +175,7 @@ describe 'Dropdown milestone', :js do
click_milestone
(
uppercase_milestone
.
title
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
{
name:
'milestone'
,
value:
"%
#{
uppercase_milestone
.
title
}
"
}
])
expect_tokens
([
milestone_token
(
uppercase_milestone
.
title
)
])
expect_filtered_search_input_empty
end
...
...
@@ -183,7 +183,7 @@ describe 'Dropdown milestone', :js do
click_milestone
(
special_milestone
.
title
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
{
name:
'milestone'
,
value:
"%
#{
special_milestone
.
title
}
"
}
])
expect_tokens
([
milestone_token
(
special_milestone
.
title
)
])
expect_filtered_search_input_empty
end
...
...
@@ -191,7 +191,7 @@ describe 'Dropdown milestone', :js do
click_static_milestone
(
'No Milestone'
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
{
name:
'milestone'
,
value:
'none'
}
])
expect_tokens
([
milestone_token
(
'none'
,
false
)
])
expect_filtered_search_input_empty
end
...
...
@@ -199,7 +199,7 @@ describe 'Dropdown milestone', :js do
click_static_milestone
(
'Upcoming'
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
{
name:
'milestone'
,
value:
'upcoming'
}
])
expect_tokens
([
milestone_token
(
'upcoming'
,
false
)
])
expect_filtered_search_input_empty
end
...
...
@@ -207,7 +207,7 @@ describe 'Dropdown milestone', :js do
click_static_milestone
(
'Started'
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
expect_tokens
([
{
name:
'milestone'
,
value:
'started'
}
])
expect_tokens
([
milestone_token
(
'started'
,
false
)
])
expect_filtered_search_input_empty
end
end
...
...
spec/features/issues/filtered_search/filter_issues_spec.rb
View file @
b84d6efa
This diff is collapsed.
Click to expand it.
spec/features/issues/filtered_search/search_bar_spec.rb
View file @
b84d6efa
...
...
@@ -32,7 +32,7 @@ describe 'Search bar', js: true do
it
'selects item'
do
filtered_search
.
native
.
send_keys
(
:down
,
:down
,
:enter
)
expect_tokens
([
{
name:
'author'
}
])
expect_tokens
([
author_token
])
expect_filtered_search_input_empty
end
end
...
...
spec/features/issues/filtered_search/visual_tokens_spec.rb
View file @
b84d6efa
...
...
@@ -346,8 +346,8 @@ describe 'Visual tokens', js: true do
it
'tokenizes the search term to complete visual token'
do
expect_tokens
([
{
name:
'author'
,
value:
'@root'
}
,
{
name:
'assignee'
,
value:
'none'
}
author_token
(
user
.
name
)
,
assignee_token
(
'none'
)
])
end
end
...
...
spec/features/merge_requests/filter_by_milestone_spec.rb
View file @
b84d6efa
...
...
@@ -25,7 +25,7 @@ feature 'Merge Request filtering by Milestone' do
visit_merge_requests
(
project
)
input_filtered_search
(
'milestone:none'
)
expect_tokens
([
{
name:
'milestone'
,
value:
'none'
}
])
expect_tokens
([
milestone_token
(
'none'
,
false
)
])
expect_filtered_search_input_empty
expect
(
page
).
to
have_issuable_counts
(
open:
1
,
closed:
0
,
all:
1
)
...
...
spec/features/merge_requests/filter_merge_requests_spec.rb
View file @
b84d6efa
...
...
@@ -24,7 +24,9 @@ describe 'Filter merge requests' do
let
(
:search_query
)
{
"assignee:@
#{
user
.
username
}
"
}
def
expect_assignee_visual_tokens
expect_tokens
([{
name:
'assignee'
,
value:
"@
#{
user
.
username
}
"
}])
wait_for_requests
expect_tokens
([
assignee_token
(
user
.
name
)])
expect_filtered_search_input_empty
end
...
...
@@ -57,7 +59,7 @@ describe 'Filter merge requests' do
let
(
:search_query
)
{
"milestone:%
\"
#{
milestone
.
title
}
\"
"
}
def
expect_milestone_visual_tokens
expect_tokens
([
{
name:
'milestone'
,
value:
"%
\"
#{
milestone
.
title
}
\"
"
}
])
expect_tokens
([
milestone_token
(
"
\"
#{
milestone
.
title
}
\"
"
)
])
expect_filtered_search_input_empty
end
...
...
@@ -91,7 +93,7 @@ describe 'Filter merge requests' do
input_filtered_search
(
'label:none'
)
expect_mr_list_count
(
1
)
expect_tokens
([
{
name:
'label'
,
value:
'none'
}
])
expect_tokens
([
label_token
(
'none'
,
false
)
])
expect_filtered_search_input_empty
end
...
...
@@ -99,7 +101,7 @@ describe 'Filter merge requests' do
input_filtered_search
(
"label:~
#{
label
.
title
}
"
)
expect_mr_list_count
(
0
)
expect_tokens
([
{
name:
'label'
,
value:
"~
#{
label
.
title
}
"
}
])
expect_tokens
([
label_token
(
label
.
title
)
])
expect_filtered_search_input_empty
end
...
...
@@ -107,10 +109,7 @@ describe 'Filter merge requests' do
input_filtered_search
(
"label:~
\"
#{
wontfix
.
title
}
\"
label:~
#{
label
.
title
}
"
)
expect_mr_list_count
(
0
)
expect_tokens
([
{
name:
'label'
,
value:
"~
\"
#{
wontfix
.
title
}
\"
"
},
{
name:
'label'
,
value:
"~
#{
label
.
title
}
"
}
])
expect_tokens
([
label_token
(
"
\"
#{
wontfix
.
title
}
\"
"
),
label_token
(
label
.
title
)])
expect_filtered_search_input_empty
end
...
...
@@ -118,16 +117,13 @@ describe 'Filter merge requests' do
input_filtered_search
(
"label:~
\"
#{
wontfix
.
title
}
\"
"
)
expect_mr_list_count
(
0
)
expect_tokens
([
{
name:
'label'
,
value:
"~
\"
#{
wontfix
.
title
}
\"
"
}
])
expect_tokens
([
label_token
(
"
\"
#{
wontfix
.
title
}
\"
"
)
])
expect_filtered_search_input_empty
input_filtered_search_keys
(
"label:~
#{
label
.
title
}
"
)
expect_mr_list_count
(
0
)
expect_tokens
([
{
name:
'label'
,
value:
"~
\"
#{
wontfix
.
title
}
\"
"
},
{
name:
'label'
,
value:
"~
#{
label
.
title
}
"
}
])
expect_tokens
([
label_token
(
"
\"
#{
wontfix
.
title
}
\"
"
),
label_token
(
label
.
title
)])
expect_filtered_search_input_empty
end
end
...
...
@@ -143,10 +139,9 @@ describe 'Filter merge requests' do
context
'assignee and label'
,
js:
true
do
def
expect_assignee_label_visual_tokens
expect_tokens
([
{
name:
'assignee'
,
value:
"@
#{
user
.
username
}
"
},
{
name:
'label'
,
value:
"~
#{
label
.
title
}
"
}
])
wait_for_requests
expect_tokens
([
assignee_token
(
user
.
name
),
label_token
(
label
.
title
)])
expect_filtered_search_input_empty
end
...
...
@@ -214,7 +209,7 @@ describe 'Filter merge requests' do
input_filtered_search_keys
(
' label:~bug'
)
expect_mr_list_count
(
1
)
expect_tokens
([
{
name:
'label'
,
value:
'~bug'
}
])
expect_tokens
([
label_token
(
'bug'
)
])
expect_filtered_search_input
(
'Bug'
)
end
...
...
@@ -227,7 +222,7 @@ describe 'Filter merge requests' do
input_filtered_search_keys
(
' milestone:%8'
)
expect_mr_list_count
(
1
)
expect_tokens
([
{
name:
'milestone'
,
value:
'%8'
}
])
expect_tokens
([
milestone_token
(
'8'
)
])
expect_filtered_search_input
(
'Bug'
)
end
...
...
@@ -240,7 +235,10 @@ describe 'Filter merge requests' do
input_filtered_search_keys
(
" assignee:@
#{
user
.
username
}
"
)
expect_mr_list_count
(
1
)
expect_tokens
([{
name:
'assignee'
,
value:
"@
#{
user
.
username
}
"
}])
wait_for_requests
expect_tokens
([
assignee_token
(
user
.
name
)])
expect_filtered_search_input
(
'Bug'
)
end
...
...
@@ -252,8 +250,10 @@ describe 'Filter merge requests' do
input_filtered_search_keys
(
" author:@
#{
user
.
username
}
"
)
wait_for_requests
expect_mr_list_count
(
1
)
expect_tokens
([
{
name:
'author'
,
value:
"@
#{
user
.
username
}
"
}
])
expect_tokens
([
author_token
(
user
.
name
)
])
expect_filtered_search_input
(
'Bug'
)
end
end
...
...
@@ -293,7 +293,9 @@ describe 'Filter merge requests' do
it
'filter by current user'
do
visit
project_merge_requests_path
(
project
,
assignee_id:
user
.
id
)
expect_tokens
([{
name:
'assignee'
,
value:
"@
#{
user
.
username
}
"
}])
wait_for_requests
expect_tokens
([
assignee_token
(
user
.
name
)])
expect_filtered_search_input_empty
end
...
...
@@ -303,7 +305,9 @@ describe 'Filter merge requests' do
visit
project_merge_requests_path
(
project
,
assignee_id:
new_user
.
id
)
expect_tokens
([{
name:
'assignee'
,
value:
"@
#{
new_user
.
username
}
"
}])
wait_for_requests
expect_tokens
([
assignee_token
(
new_user
.
name
)])
expect_filtered_search_input_empty
end
end
...
...
@@ -312,7 +316,9 @@ describe 'Filter merge requests' do
it
'filter by current user'
do
visit
project_merge_requests_path
(
project
,
author_id:
user
.
id
)
expect_tokens
([{
name:
'author'
,
value:
"@
#{
user
.
username
}
"
}])
wait_for_requests
expect_tokens
([
author_token
(
user
.
name
)])
expect_filtered_search_input_empty
end
...
...
@@ -322,7 +328,9 @@ describe 'Filter merge requests' do
visit
project_merge_requests_path
(
project
,
author_id:
new_user
.
id
)
expect_tokens
([{
name:
'author'
,
value:
"@
#{
new_user
.
username
}
"
}])
wait_for_requests
expect_tokens
([
author_token
(
new_user
.
name
)])
expect_filtered_search_input_empty
end
end
...
...
spec/features/search_spec.rb
View file @
b84d6efa
...
...
@@ -195,37 +195,33 @@ describe "Search" do
it
'takes user to her issues page when issues assigned is clicked'
do
find
(
'.dropdown-menu'
).
click_link
'Issues assigned to me'
sleep
2
expect
(
page
).
to
have_selector
(
'.filtered-search'
)
expect_tokens
([
{
name:
'assignee'
,
value:
"@
#{
user
.
username
}
"
}
])
expect_tokens
([
assignee_token
(
user
.
name
)
])
expect_filtered_search_input_empty
end
it
'takes user to her issues page when issues authored is clicked'
do
find
(
'.dropdown-menu'
).
click_link
"Issues I've created"
sleep
2
expect
(
page
).
to
have_selector
(
'.filtered-search'
)
expect_tokens
([
{
name:
'author'
,
value:
"@
#{
user
.
username
}
"
}
])
expect_tokens
([
author_token
(
user
.
name
)
])
expect_filtered_search_input_empty
end
it
'takes user to her MR page when MR assigned is clicked'
do
find
(
'.dropdown-menu'
).
click_link
'Merge requests assigned to me'
sleep
2
expect
(
page
).
to
have_selector
(
'.merge-requests-holder'
)
expect_tokens
([
{
name:
'assignee'
,
value:
"@
#{
user
.
username
}
"
}
])
expect_tokens
([
assignee_token
(
user
.
name
)
])
expect_filtered_search_input_empty
end
it
'takes user to her MR page when MR authored is clicked'
do
find
(
'.dropdown-menu'
).
click_link
"Merge requests I've created"
sleep
2
expect
(
page
).
to
have_selector
(
'.merge-requests-holder'
)
expect_tokens
([
{
name:
'author'
,
value:
"@
#{
user
.
username
}
"
}
])
expect_tokens
([
author_token
(
user
.
name
)
])
expect_filtered_search_input_empty
end
end
...
...
spec/support/filtered_search_helpers.rb
View file @
b84d6efa
...
...
@@ -54,8 +54,8 @@ module FilteredSearchHelpers
# Iterates through each visual token inside
# .tokens-container to make sure the correct names and values are rendered
def
expect_tokens
(
tokens
)
page
.
find
'.filtered-search-box .tokens-container'
do
page
.
all
(
:css
,
'.tokens-container li'
).
each_with_index
do
|
el
,
index
|
page
.
within
'.filtered-search-box .tokens-container'
do
page
.
all
(
:css
,
'.tokens-container li
.selectable
'
).
each_with_index
do
|
el
,
index
|
token_name
=
tokens
[
index
][
:name
]
token_value
=
tokens
[
index
][
:value
]
...
...
@@ -67,6 +67,28 @@ module FilteredSearchHelpers
end
end
def
create_token
(
token_name
,
token_value
=
nil
,
symbol
=
nil
)
{
name:
token_name
,
value:
"
#{
symbol
}#{
token_value
}
"
}
end
def
author_token
(
author_name
=
nil
)
create_token
(
'Author'
,
author_name
)
end
def
assignee_token
(
assignee_name
=
nil
)
create_token
(
'Assignee'
,
assignee_name
)
end
def
milestone_token
(
milestone_name
=
nil
,
has_symbol
=
true
)
symbol
=
has_symbol
?
'%'
:
nil
create_token
(
'Milestone'
,
milestone_name
,
symbol
)
end
def
label_token
(
label_name
=
nil
,
has_symbol
=
true
)
symbol
=
has_symbol
?
'~'
:
nil
create_token
(
'Label'
,
label_name
,
symbol
)
end
def
default_placeholder
'Search or filter results...'
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