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
15a4cac9
Commit
15a4cac9
authored
Mar 07, 2017
by
George Andrinopoulos
Committed by
Rémy Coutable
Mar 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor dropdown_assignee_spec
parent
668844f5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
33 deletions
+45
-33
changelogs/unreleased/27568-refactor-very-slow-dropdown-asignee-spec.yml
...leased/27568-refactor-very-slow-dropdown-asignee-spec.yml
+4
-0
spec/features/issues/filtered_search/dropdown_assignee_spec.rb
...features/issues/filtered_search/dropdown_assignee_spec.rb
+41
-33
No files found.
changelogs/unreleased/27568-refactor-very-slow-dropdown-asignee-spec.yml
0 → 100644
View file @
15a4cac9
---
title
:
Refactor dropdown_assignee_spec
merge_request
:
9711
author
:
George Andrinopoulos
spec/features/issues/filtered_search/dropdown_assignee_spec.rb
View file @
15a4cac9
require
'rails_helper'
describe
'Dropdown assignee'
,
js:
true
,
feature:
true
do
include
WaitForAjax
describe
'Dropdown assignee'
,
:feature
,
:js
do
let!
(
:project
)
{
create
(
:empty_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'
}
def
send_keys_to_filtered_search
(
input
)
input
.
split
(
""
).
each
do
|
i
|
filtered_search
.
send_keys
(
i
)
sleep
5
wait_for_ajax
end
end
let
(
:filter_dropdown
)
{
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)
}
def
dropdown_assignee_size
page
.
all
(
'#js-dropdown-assignee .filter-dropdown
.filter-dropdown-item'
).
size
filter_dropdown
.
all
(
'
.filter-dropdown-item'
).
size
end
def
click_assignee
(
text
)
...
...
@@ -56,63 +47,80 @@ describe 'Dropdown assignee', js: true, feature: true do
end
it
'should hide loading indicator when loaded'
do
send_keys_to_filtered_search
(
'assignee:'
)
filtered_search
.
set
(
'assignee:'
)
expect
(
page
).
not_to
have_css
(
'#js-dropdown-assignee .filter-dropdown-loading'
)
expect
(
find
(
js_dropdown_assignee
)).
to
have_css
(
'.filter-dropdown-loading'
)
expect
(
find
(
js_dropdown_assignee
)).
not_to
have_css
(
'.filter-dropdown-loading'
)
end
it
'should load all the assignees when opened'
do
send_keys_to_filtered_search
(
'assignee:'
)
filtered_search
.
set
(
'assignee:'
)
expect
(
dropdown_assignee_size
).
to
eq
(
3
)
end
it
'shows current user at top of dropdown'
do
send_keys_to_filtered_search
(
'assignee:'
)
filtered_search
.
set
(
'assignee:'
)
expect
(
fi
rst
(
'#js-dropdown-assignee .filter-dropdown li
'
)).
to
have_content
(
user
.
name
)
expect
(
fi
lter_dropdown
.
first
(
'.filter-dropdown-item
'
)).
to
have_content
(
user
.
name
)
end
end
describe
'filtering'
do
before
do
send_keys_to_filtered_search
(
'assignee:'
)
filtered_search
.
set
(
'assignee:'
)
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
send_keys_to_filtered_search
(
'j'
)
filtered_search
.
send_keys
(
'j'
)
expect
(
dropdown_assignee_size
).
to
eq
(
2
)
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_no_content
(
user
.
name
)
end
it
'filters by case insensitive name'
do
send_keys_to_filtered_search
(
'J'
)
filtered_search
.
send_keys
(
'J'
)
expect
(
dropdown_assignee_size
).
to
eq
(
2
)
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_no_content
(
user
.
name
)
end
it
'filters by username with symbol'
do
send_keys_to_filtered_search
(
'@ot'
)
filtered_search
.
send_keys
(
'@ot'
)
expect
(
dropdown_assignee_size
).
to
eq
(
2
)
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
send_keys_to_filtered_search
(
'@OT'
)
filtered_search
.
send_keys
(
'@OT'
)
expect
(
dropdown_assignee_size
).
to
eq
(
2
)
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
send_keys_to_filtered_search
(
'ot'
)
filtered_search
.
send_keys
(
'ot'
)
expect
(
dropdown_assignee_size
).
to
eq
(
2
)
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
send_keys_to_filtered_search
(
'OT'
)
filtered_search
.
send_keys
(
'OT'
)
expect
(
dropdown_assignee_size
).
to
eq
(
2
)
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
...
...
@@ -129,7 +137,7 @@ describe 'Dropdown assignee', js: true, feature: true do
end
it
'fills in the assignee username when the assignee has been filtered'
do
send_keys_to_filtered_search
(
'roo'
)
filtered_search
.
send_keys
(
'roo'
)
click_assignee
(
user
.
name
)
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
false
)
...
...
@@ -173,7 +181,7 @@ describe 'Dropdown assignee', js: true, feature: true do
describe
'caching requests'
do
it
'caches requests after the first load'
do
filtered_search
.
set
(
'assignee'
)
send_keys_to_filtered_search
(
':'
)
filtered_search
.
send_keys
(
':'
)
initial_size
=
dropdown_assignee_size
expect
(
initial_size
).
to
be
>
0
...
...
@@ -182,7 +190,7 @@ describe 'Dropdown assignee', js: true, feature: true do
project
.
team
<<
[
new_user
,
:master
]
find
(
'.filtered-search-input-container .clear-search'
).
click
filtered_search
.
set
(
'assignee'
)
send_keys_to_filtered_search
(
':'
)
filtered_search
.
send_keys
(
':'
)
expect
(
dropdown_assignee_size
).
to
eq
(
initial_size
)
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